module Blather::Stanza::Presence::Subscription::InstanceMethods

Public Instance Methods

approve!() click to toggle source

Transform the stanza into an approve stanza makes approving requests simple

@example approve an incoming request

subscription(:request?) { |s| write_to_stream s.approve! }

@return [self]

# File lib/blather/stanza/presence/subscription.rb, line 43
def approve!
  self.type = :subscribed
  reply_if_needed!
end
cancel!() click to toggle source

Transform the stanza into a cancel stanza makes canceling simple

@return [self]

# File lib/blather/stanza/presence/subscription.rb, line 72
def cancel!
  self.type = :unsubscribed
  reply_if_needed!
end
refuse!() click to toggle source

Transform the stanza into a refuse stanza makes refusing requests simple

@example refuse an incoming request

subscription(:request?) { |s| write_to_stream s.refuse! }

@return [self]

# File lib/blather/stanza/presence/subscription.rb, line 54
def refuse!
  self.type = :unsubscribed
  reply_if_needed!
end
request!() click to toggle source

Transform the stanza into a request stanza makes requests simple

@return [self]

# File lib/blather/stanza/presence/subscription.rb, line 81
def request!
  self.type = :subscribe
  reply_if_needed!
end
request?() click to toggle source

Check if the stanza is a request

@return [true, false]

# File lib/blather/stanza/presence/subscription.rb, line 89
def request?
  self.type == :subscribe
end
to=(to) click to toggle source

Set the to value on the stanza

@param [Blather::JID, to_s] to a JID to subscribe to

Calls superclass method
# File lib/blather/stanza/presence/subscription.rb, line 33
def to=(to)
  super JID.new(to).stripped
end
unsubscribe!() click to toggle source

Transform the stanza into an unsubscribe stanza makes unsubscribing simple

@return [self]

# File lib/blather/stanza/presence/subscription.rb, line 63
def unsubscribe!
  self.type = :unsubscribe
  reply_if_needed!
end