Class: Jabber::PubSub::NodeHelper
- Inherits:
-
ServiceHelper
- Object
- ServiceHelper
- Jabber::PubSub::NodeHelper
- Defined in:
- lib/xmpp4r/pubsub/helper/nodehelper.rb
Instance Attribute Summary collapse
-
#jid ⇒ Object
readonly
Returns the value of attribute jid.
-
#my_subscriptions ⇒ Object
readonly
Returns the value of attribute my_subscriptions.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#nodename ⇒ Object
readonly
Returns the value of attribute nodename.
Instance Method Summary collapse
-
#create_node(configuration = Jabber::PubSub::NodeConfig.new) ⇒ Object
- creates the node create(configuration=nil) configuration
-
[Jabber::XData].
-
#delete_node ⇒ Object
deletes the node delete.
-
#do_subscribe ⇒ Object
subscribe to this node do_subscribe.
-
#do_unsubscribe(subid) ⇒ Object
- unsubscribe from this node do_unsubscribe(subid = nil) subid
-
[String].
-
#get_affiliations ⇒ Object
get all node affiliations get_affiliations.
-
#get_all_items ⇒ Object
gets all items from the node get_all_items.
-
#get_configuration(subid = nil) ⇒ Object
- get the configuration of the node get_configuration(configuration=nil) configuration
-
[Jabber::XData].
-
#get_items(count) ⇒ Object
- get a count of items get_items(count) count
-
[Fixnum].
-
#get_subscribers ⇒ Object
get all subscribers subscribed on this node get_subscribers.
-
#get_subscriptions ⇒ Object
get all subscriptions on this node get_subscriptions.
-
#initialize(stream, jid, nodename = nil, create_if_not_exist = true) ⇒ NodeHelper
constructor
- creates a new node new(client,service,nodename) stream
- Jabber::Stream
- jid
- String
- (jid of the pubsub service) nodename
-
[String].
-
#publish_content(items) ⇒ Object
- publishing content on this node publish_content(items) items
-
[REXML::Element].
-
#purge_items ⇒ Object
purge all items from this node purge_items.
-
#set_configuration(configuration, subid = nil) ⇒ Object
- 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
#initialize(stream, jid, nodename = nil, create_if_not_exist = true) ⇒ NodeHelper
creates a new node new(client,service,nodename)
- stream
- Jabber::Stream
- jid
- String
-
(jid of the pubsub service)
- nodename
- String
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
#jid ⇒ Object (readonly)
Returns the value of attribute jid.
19 20 21 |
# File 'lib/xmpp4r/pubsub/helper/nodehelper.rb', line 19 def jid @jid end |
#my_subscriptions ⇒ Object (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 |
#name ⇒ Object (readonly)
Returns the value of attribute name.
18 19 20 |
# File 'lib/xmpp4r/pubsub/helper/nodehelper.rb', line 18 def name @name end |
#nodename ⇒ Object (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
#create_node(configuration = Jabber::PubSub::NodeConfig.new) ⇒ Object
creates the node create(configuration=nil)
- configuration
- Jabber::XData
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 |
#delete_node ⇒ Object
deletes the node delete
74 75 76 |
# File 'lib/xmpp4r/pubsub/helper/nodehelper.rb', line 74 def delete_node delete(@nodename) end |
#do_subscribe ⇒ Object
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 |
#do_unsubscribe(subid) ⇒ Object
unsubscribe from this node do_unsubscribe(subid = nil)
- subid
- String
134 135 136 |
# File 'lib/xmpp4r/pubsub/helper/nodehelper.rb', line 134 def do_unsubscribe(subid) unsubscribe(@nodename,subid) end |
#get_affiliations ⇒ Object
get all node affiliations get_affiliations
104 105 106 |
# File 'lib/xmpp4r/pubsub/helper/nodehelper.rb', line 104 def get_affiliations affiliations end |
#get_all_items ⇒ Object
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 |
#get_configuration(subid = nil) ⇒ Object
get the configuration of the node get_configuration(configuration=nil)
- configuration
- Jabber::XData
58 59 60 |
# File 'lib/xmpp4r/pubsub/helper/nodehelper.rb', line 58 def get_configuration(subid = nil) (@nodename, subid) end |
#get_items(count) ⇒ Object
get a count of items get_items(count)
- count
- Fixnum
97 98 99 |
# File 'lib/xmpp4r/pubsub/helper/nodehelper.rb', line 97 def get_items(count) get_items_from(@nodename,count) end |
#get_subscribers ⇒ Object
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 |
#get_subscriptions ⇒ Object
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 |
#publish_content(items) ⇒ Object
publishing content on this node publish_content(items)
- items
- REXML::Element
82 83 84 |
# File 'lib/xmpp4r/pubsub/helper/nodehelper.rb', line 82 def publish_content(items) publish_item_to(@nodename,items) end |
#purge_items ⇒ Object
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 |
#set_configuration(configuration, subid = nil) ⇒ Object
set the configuration of the node set_configuration(configuration=nil)
- configuration
- Jabber::XData
- subid
- String
-
default is nil
67 68 69 |
# File 'lib/xmpp4r/pubsub/helper/nodehelper.rb', line 67 def set_configuration(configuration,subid = nil) (@nodename, configuration, subid) end |