Class: IqQueryStanza

Inherits:
Object
  • Object
show all
Defined in:
lib/stanzas/iq_query_stanza.rb

Direct Known Subclasses

SubscribeQueryStanza, SubscriptionsQueryStanza, UnsubscribeQueryStanza

Instance Method Summary (collapse)

Constructor Details

- (IqQueryStanza) initialize(params = {})

Returns a new instance of IqQueryStanza



3
4
5
6
7
8
9
10
# File 'lib/stanzas/iq_query_stanza.rb', line 3

def initialize(params =  {})
  @doc = Nokogiri::XML::Document.new
  @iq = Nokogiri::XML::Node.new("iq", @doc)
  @iq["type"] = params[:type].to_s
  @iq["to"] = Superfeedr.conf[:superfeedr_jid]
  @iq["id"] = "#{random_iq_id}"
  @iq["from"] = params[:from] if params[:from]
end

Instance Method Details

- (Object) from



20
21
22
# File 'lib/stanzas/iq_query_stanza.rb', line 20

def from
  @iq["from"]
end

- (Object) id



24
25
26
# File 'lib/stanzas/iq_query_stanza.rb', line 24

def id
  @iq["id"]
end

- (Object) random_iq_id



28
29
30
# File 'lib/stanzas/iq_query_stanza.rb', line 28

def random_iq_id
  rand(1000)
end

- (Object) to



16
17
18
# File 'lib/stanzas/iq_query_stanza.rb', line 16

def to
  @iq["to"]
end

- (Object) to_s



32
33
34
# File 'lib/stanzas/iq_query_stanza.rb', line 32

def to_s
  @iq.to_s
end

- (Object) type



12
13
14
# File 'lib/stanzas/iq_query_stanza.rb', line 12

def type
  @iq["type"]
end