Class: Jabber::PubSub::NodeHelper
- Inherits:
-
ServiceHelper
- Object
- ServiceHelper
- Jabber::PubSub::NodeHelper
- Defined in:
- lib/xmpp4r/pubsub/helper/nodehelper.rb
Instance Attribute Summary (collapse)
-
- (Object) jid
readonly
Returns the value of attribute jid.
-
- (Object) my_subscriptions
readonly
Returns the value of attribute my_subscriptions.
-
- (Object) name
readonly
Returns the value of attribute name.
-
- (Object) nodename
readonly
Returns the value of attribute nodename.
Instance Method Summary (collapse)
-
- (Object) create_node(configuration = Jabber::PubSub::NodeConfig.new)
creates the node create(configuration=nil)
configuration
[Jabber::XData].
-
- (Object) delete_node
deletes the node delete.
-
- (Object) do_subscribe
subscribe to this node do_subscribe.
-
- (Object) do_unsubscribe(subid)
unsubscribe from this node do_unsubscribe(subid = nil)
subid
[String].
-
- (Object) get_affiliations
get all node affiliations get_affiliations.
-
- (Object) get_all_items
gets all items from the node get_all_items.
-
- (Object) get_configuration(subid = nil)
get the configuration of the node get_configuration(configuration=nil)
configuration
[Jabber::XData].
-
- (Object) get_items(count)
get a count of items get_items(count)
count
[Fixnum].
-
- (Object) get_subscribers
get all subscribers subscribed on this node get_subscribers.
-
- (Object) get_subscriptions
get all subscriptions on this node get_subscriptions.
-
- (NodeHelper) initialize(stream, jid, nodename = nil, create_if_not_exist = true)
constructor
creates a new node new(client,service,nodename)
stream
- Jabber::Stream
jid
- String
-
(jid of the pubsub service)
nodename
[String].
-
- (Object) publish_content(items)
publishing content on this node publish_content(items)
items
[REXML::Element].
-
- (Object) purge_items
purge all items from this node purge_items.
-
- (Object) set_configuration(configuration, subid = nil)
set the configuration of the node set_configuration(configuration=nil)
configuration
- Jabber::XData
subid
- String
-
default is nil.
Methods inherited from ServiceHelper
#add_event_callback, #create_collection_node, #delete_item_from, #get_config_from, #get_items_from, #get_options_from, #get_subids_for, #get_subscribers_from, #get_subscriptions_from, #get_subscriptions_from_all_nodes, #publish_item_to, #publish_item_with_id_to, #purge_items_from, #set_affiliations, #set_config_for, #set_options_for, #subscribe_to, #to_s, #unsubscribe_from
Constructor Details
- (NodeHelper) initialize(stream, jid, nodename = nil, create_if_not_exist = true)
creates a new node new(client,service,nodename)
stream |
|
jid |
|
nodename |
|
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/xmpp4r/pubsub/helper/nodehelper.rb', line 27 def initialize(stream, jid, nodename = nil, create_if_not_exist = true) super(stream,jid) @nodename = nodename @jid = jid @stream = stream if create_if_not_exist and !node_exist? # if no nodename is given a instant node will created # (if the service supports instant nodes) @nodename = create_node else get_subscriptions end end |
Instance Attribute Details
- (Object) jid (readonly)
Returns the value of attribute jid
19 20 21 |
# File 'lib/xmpp4r/pubsub/helper/nodehelper.rb', line 19 def jid @jid end |
- (Object) my_subscriptions (readonly)
Returns the value of attribute my_subscriptions
20 21 22 |
# File 'lib/xmpp4r/pubsub/helper/nodehelper.rb', line 20 def my_subscriptions @my_subscriptions end |
- (Object) name (readonly)
Returns the value of attribute name
18 19 20 |
# File 'lib/xmpp4r/pubsub/helper/nodehelper.rb', line 18 def name @name end |
- (Object) nodename (readonly)
Returns the value of attribute nodename
17 18 19 |
# File 'lib/xmpp4r/pubsub/helper/nodehelper.rb', line 17 def nodename @nodename end |
Instance Method Details
- (Object) create_node(configuration = Jabber::PubSub::NodeConfig.new)
creates the node create(configuration=nil)
configuration |
|
46 47 48 49 50 51 52 |
# File 'lib/xmpp4r/pubsub/helper/nodehelper.rb', line 46 def create_node(configuration = Jabber::PubSub::NodeConfig.new) unless node_exist? super(@nodename,configuration) else false end end |
- (Object) delete_node
deletes the node delete
74 75 76 |
# File 'lib/xmpp4r/pubsub/helper/nodehelper.rb', line 74 def delete_node delete(@nodename) end |
- (Object) do_subscribe
subscribe to this node do_subscribe
125 126 127 128 |
# File 'lib/xmpp4r/pubsub/helper/nodehelper.rb', line 125 def do_subscribe subscribe_to(@nodename) get_subscriptions end |
- (Object) do_unsubscribe(subid)
unsubscribe from this node do_unsubscribe(subid = nil)
subid |
|
134 135 136 |
# File 'lib/xmpp4r/pubsub/helper/nodehelper.rb', line 134 def do_unsubscribe(subid) unsubscribe(@nodename,subid) end |
- (Object) get_affiliations
get all node affiliations get_affiliations
104 105 106 |
# File 'lib/xmpp4r/pubsub/helper/nodehelper.rb', line 104 def get_affiliations affiliations end |
- (Object) get_all_items
gets all items from the node get_all_items
89 90 91 |
# File 'lib/xmpp4r/pubsub/helper/nodehelper.rb', line 89 def get_all_items get_items_from(@nodename) end |
- (Object) get_configuration(subid = nil)
get the configuration of the node get_configuration(configuration=nil)
configuration |
|
58 59 60 |
# File 'lib/xmpp4r/pubsub/helper/nodehelper.rb', line 58 def get_configuration(subid = nil) (@nodename, subid) end |
- (Object) get_items(count)
get a count of items get_items(count)
count |
|
97 98 99 |
# File 'lib/xmpp4r/pubsub/helper/nodehelper.rb', line 97 def get_items(count) get_items_from(@nodename,count) end |
- (Object) get_subscribers
get all subscribers subscribed on this node get_subscribers
118 119 120 |
# File 'lib/xmpp4r/pubsub/helper/nodehelper.rb', line 118 def get_subscribers @subscriptions = subscribers(@nodename) end |
- (Object) get_subscriptions
get all subscriptions on this node get_subscriptions
111 112 113 |
# File 'lib/xmpp4r/pubsub/helper/nodehelper.rb', line 111 def get_subscriptions get_subscriptions_from(@nodename) end |
- (Object) publish_content(items)
publishing content on this node publish_content(items)
items |
|
82 83 84 |
# File 'lib/xmpp4r/pubsub/helper/nodehelper.rb', line 82 def publish_content(items) publish_item_to(@nodename,items) end |
- (Object) purge_items
purge all items from this node purge_items
141 142 143 |
# File 'lib/xmpp4r/pubsub/helper/nodehelper.rb', line 141 def purge_items purge(@nodename) end |
- (Object) set_configuration(configuration, subid = nil)
set the configuration of the node set_configuration(configuration=nil)
configuration |
|
subid |
|
67 68 69 |
# File 'lib/xmpp4r/pubsub/helper/nodehelper.rb', line 67 def set_configuration(configuration,subid = nil) (@nodename, configuration, subid) end |