Class: Jabber::PubSub::NodeHelper

Class | Jabber::PubSub::NodeHelper
In: | lib/xmpp4r/pubsub/helper/nodehelper.rb
Parent: | ServiceHelper

### Methods

create_node delete_node do_subscribe do_unsubscribe get_affiliations get_all_items get_configuration get_items get_subscribers get_subscriptions new publish_content purge_items set_configuration

### Attributes

jid | [R] |
my_subscriptions | [R] |
name | [R] |
nodename | [R] |

### Public Class methods

new(stream, jid, nodename = nil, create_if_not_exist = true)

creates a new node new(client,service,nodename)

stream: | [Jabber::Stream]
jid: | [String] (jid of the pubsub service)
nodename: | [String]

[Source]

        # File lib/xmpp4r/pubsub/helper/nodehelper.rb, line 27
    27:       def initialize(stream, jid, nodename = nil, create_if_not_exist = true)
    28:         super(stream,jid)
    29:         @nodename = nodename
    30:         @jid = jid
    31:         @stream = stream
    32:
    33:         if create_if_not_exist and not node_exist?
    34:           # if no nodename is given a instant node will created
    35:           # (if the service supports instant nodes)
    36:           @nodename = create_node
    37:         else
    38:           get_subscriptions
    39:         end
    40:       end

### Public Instance methods

create_node(configuration = Jabber::PubSub::NodeConfig.new)

creates the node create(configuration=nil)

configuration: | [Jabber::XData]

[Source]

        # File lib/xmpp4r/pubsub/helper/nodehelper.rb, line 46
    46:       def create_node(configuration = Jabber::PubSub::NodeConfig.new)
    47:         unless node_exist?
    48:           super(@nodename,configuration)
    49:         else
    50:           false
    51:         end
    52:       end

delete_node()

deletes the node delete

[Source]

        # File lib/xmpp4r/pubsub/helper/nodehelper.rb, line 74
    74:       def delete_node
    75:         delete(@nodename)
    76:       end

do_subscribe()

subscribe to this node do_subscribe

[Source]

         # File lib/xmpp4r/pubsub/helper/nodehelper.rb, line 125
    125:       def do_subscribe
    126:         subscribe_to(@nodename)
    127:         get_subscriptions
    128:       end

do_unsubscribe(subid)

unsubscribe from this node do_unsubscribe(subid = nil)

subid: | [String]

[Source]

         # File lib/xmpp4r/pubsub/helper/nodehelper.rb, line 134
    134:       def do_unsubscribe(subid)
    135:         unsubscribe(@nodename,subid)
    136:       end

get_affiliations()

get all node affiliations get_affiliations

[Source]

         # File lib/xmpp4r/pubsub/helper/nodehelper.rb, line 104
    104:       def get_affiliations
    105:         affiliations
    106:       end

get_all_items()

gets all items from the node get_all_items

[Source]

        # File lib/xmpp4r/pubsub/helper/nodehelper.rb, line 89
    89:       def get_all_items
    90:         items(@nodename)
    91:       end

get_configuration(subid = nil)

get the configuration of the node get_configuration(configuration=nil)

configuration: | [Jabber::XData]

[Source]

        # File lib/xmpp4r/pubsub/helper/nodehelper.rb, line 58
    58:       def get_configuration(subid = nil)
    59:         get_options(@nodename, subid)
    60:       end

get_items(count)

get a count of items get_items(count)

count: | [Fixnum]

[Source]

        # File lib/xmpp4r/pubsub/helper/nodehelper.rb, line 97
    97:       def get_items(count)
    98:         items(@nodename,count)
    99:       end

get_subscribers()

get all subscribers subscribed on this node get_subscribers

[Source]

         # File lib/xmpp4r/pubsub/helper/nodehelper.rb, line 118
    118:       def get_subscribers
    119:         @subscriptions = subscribers(@nodename)
    120:       end

get_subscriptions()

get all subscriptions on this node get_subscriptions

[Source]

         # File lib/xmpp4r/pubsub/helper/nodehelper.rb, line 111
    111:       def get_subscriptions
    112:         get_subscriptions_from(@nodename)
    113:       end

publish_content(items)

publishing content on this node publish_content(items)

items: | [REXML::Element]

[Source]

        # File lib/xmpp4r/pubsub/helper/nodehelper.rb, line 82
    82:       def publish_content(items)
    83:         publish_item_to(@nodename,items)
    84:       end

purge_items()

purge all items from this node purge_items

[Source]

         # File lib/xmpp4r/pubsub/helper/nodehelper.rb, line 141
    141:       def purge_items
    142:         purge(@nodename)
    143:       end

set_configuration(configuration,subid = nil)

set the configuration of the node set_configuration(configuration=nil)

configuration: | [Jabber::XData]
subid: | [String] default is nil

[Source]

        # File lib/xmpp4r/pubsub/helper/nodehelper.rb, line 67
    67:       def set_configuration(configuration,subid = nil)
    68:         set_options(@nodename, configuration, subid)
    69:       end

[Validate]