Class: Blather::Stanza::Presence::Subscription

Inherits:
Blather::Stanza::Presence show all
Includes:
InstanceMethods
Defined in:
lib/blather/stanza/presence/subscription.rb

Overview

# Subscription Stanza

[RFC 3921 Section 8 - Integration of Roster Items and Presence Subscriptions](xmpp.org/rfcs/rfc3921.html#rfc.section.8)

Blather handles subscription request/response through this class. It provides a set of helper methods to quickly transform the stanza into a response.

Defined Under Namespace

Modules: InstanceMethods

Constant Summary

Constants inherited from Blather::Stanza::Presence

VALID_TYPES

Constants inherited from XMPPNode

XMPPNode::BASE_NAMES

Instance Attribute Summary

Attributes inherited from Blather::Stanza

#handler_hierarchy

Class Method Summary collapse

Methods included from InstanceMethods

#approve!, #cancel!, #refuse!, #request!, #request?, #to=, #unsubscribe!

Methods inherited from Blather::Stanza::Presence

#error?, import, #probe?, #subscribe?, #subscribed?, #type=, #unavailable?, #unsubscribe?, #unsubscribed?

Methods inherited from Blather::Stanza

#as_error, #error?, #from, #from=, handler_list, #id, #id=, #initialize, next_id, register, #reply, #reply!, #to, #to=, #type, #type=

Methods inherited from XMPPNode

class_from_registration, #decorate, decorator_modules, import, parse, register, #to_stanza

Constructor Details

This class inherits a constructor from Blather::Stanza

Class Method Details

.new(to = nil, type = nil) ⇒ Object

Create a new Subscription stanza

Parameters:

  • to (Blather::JID, #to_s) (defaults to: nil)

    the JID to subscribe to

  • type (Symbol, nil) (defaults to: nil)

    the subscription type



21
22
23
24
25
26
# File 'lib/blather/stanza/presence/subscription.rb', line 21

def self.new(to = nil, type = nil)
  node = super()
  node.to = to
  node.type = type
  node
end