Class: Jabber::Subscription
- Inherits:
-
Object
- Object
- Jabber::Subscription
- Defined in:
- lib/jabber4r/session.rb
Instance Attribute Summary collapse
-
#from ⇒ Object
Returns the value of attribute from.
-
#id ⇒ Object
Returns the value of attribute id.
-
#session ⇒ Object
Returns the value of attribute session.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #accept ⇒ Object
-
#initialize(session, type, from, id) ⇒ Subscription
constructor
A new instance of Subscription.
Constructor Details
#initialize(session, type, from, id) ⇒ Subscription
Returns a new instance of Subscription.
44 45 46 47 48 49 |
# File 'lib/jabber4r/session.rb', line 44 def initialize(session, type, from, id) @session = session @type = type @from = from @id = id end |
Instance Attribute Details
#from ⇒ Object
Returns the value of attribute from.
43 44 45 |
# File 'lib/jabber4r/session.rb', line 43 def from @from end |
#id ⇒ Object
Returns the value of attribute id.
43 44 45 |
# File 'lib/jabber4r/session.rb', line 43 def id @id end |
#session ⇒ Object
Returns the value of attribute session.
43 44 45 |
# File 'lib/jabber4r/session.rb', line 43 def session @session end |
#type ⇒ Object
Returns the value of attribute type.
43 44 45 |
# File 'lib/jabber4r/session.rb', line 43 def type @type end |
Instance Method Details
#accept ⇒ Object
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/jabber4r/session.rb', line 50 def accept case type when :subscribe @session.connection.send(Jabber::Protocol::Presence.gen_accept_subscription(@id, @from)) when :unsubscribe @session.connection.send(Jabber::Protocol::Presence.gen_accept_unsubscription(@id, @from)) else raise "Cannot accept a subscription of type #{type.to_s}" end end |