Class: IqQueryStanza

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

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ 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

#fromObject



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

def from
  @iq["from"]
end

#idObject



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

def id
  @iq["id"]
end

#random_iq_idObject



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

def random_iq_id
  rand(1000)
end

#toObject



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

def to
  @iq["to"]
end

#to_sObject



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

def to_s
  @iq.to_s
end

#typeObject



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

def type
  @iq["type"]
end