Class: Blather::Stanza::PubSub::Subscription
Constant Summary
collapse
- VALID_TYPES =
[:none, :pending, :subscribed, :unconfigured]
Constants inherited
from XMPPNode
XMPPNode::BASE_NAMES
Class Method Summary
collapse
Instance Method Summary
collapse
import, #inherit, #pubsub
Methods inherited from Iq
import, #type=
#as_error, attribute_helpers_for, #from, handler_list, next_id, register, #reply, #reply!, #to
Methods inherited from XMPPNode
attribute_accessor, attribute_reader, attribute_writer, class_from_registration, content_attr_accessor, content_attr_reader, content_attr_writer, #content_from, import, #inherit, #inherit_attrs, #namespace=, #namespace_href, #nokogiri_namespace=, register, #remove_child, #remove_children, #set_content_for, #to_stanza
#[]=, #attr_set, #find_first, #nokogiri_xpath, #xpath
Class Method Details
.new(type = :result, host = nil, node = nil, jid = nil, subid = nil, subscription = nil) ⇒ Object
10
11
12
13
14
15
16
17
|
# File 'lib/blather/stanza/pubsub/subscription.rb', line 10
def self.new(type = :result, host = nil, node = nil, jid = nil, subid = nil, subscription = nil)
new_node = super(type, host)
new_node.node = node
new_node.jid = jid
new_node.subid = subid
new_node.subscription = subscription
new_node
end
|
Instance Method Details
21
22
23
|
# File 'lib/blather/stanza/pubsub/subscription.rb', line 21
def jid
JID.new(subscription_node[:jid])
end
|
#jid=(jid) ⇒ Object
25
26
27
|
# File 'lib/blather/stanza/pubsub/subscription.rb', line 25
def jid=(jid)
subscription_node[:jid] = jid
end
|
29
30
31
|
# File 'lib/blather/stanza/pubsub/subscription.rb', line 29
def node
subscription_node[:node]
end
|
#node=(node) ⇒ Object
33
34
35
|
# File 'lib/blather/stanza/pubsub/subscription.rb', line 33
def node=(node)
subscription_node[:node] = node
end
|
37
38
39
|
# File 'lib/blather/stanza/pubsub/subscription.rb', line 37
def subid
subscription_node[:subid]
end
|
#subid=(subid) ⇒ Object
41
42
43
|
# File 'lib/blather/stanza/pubsub/subscription.rb', line 41
def subid=(subid)
subscription_node[:subid] = subid
end
|
#subscription ⇒ Object
45
46
47
48
|
# File 'lib/blather/stanza/pubsub/subscription.rb', line 45
def subscription
s = subscription_node[:subscription]
s.to_sym if s
end
|
#subscription=(subscription) ⇒ Object
50
51
52
53
|
# File 'lib/blather/stanza/pubsub/subscription.rb', line 50
def subscription=(subscription)
raise ArgumentError, "Invalid Type (#{type}), use: #{VALID_TYPES*' '}" if subscription && !VALID_TYPES.include?(subscription.to_sym)
subscription_node[:subscription] = subscription
end
|
#subscription_node ⇒ Object
55
56
57
58
59
60
61
|
# File 'lib/blather/stanza/pubsub/subscription.rb', line 55
def subscription_node
unless subscription = pubsub.find_first('ns:subscription', :ns => self.class.registered_ns)
self.pubsub << (subscription = XMPPNode.new('subscription', self.document))
subscription.namespace = self.pubsub.namespace
end
subscription
end
|