Class: SMSBox::XMLRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/sms_box/xml_request.rb

Direct Known Subclasses

WebsendRequest

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#passwordObject

Returns the value of attribute password.



6
7
8
# File 'lib/sms_box/xml_request.rb', line 6

def password
  @password
end

#usernameObject

Returns the value of attribute username.



5
6
7
# File 'lib/sms_box/xml_request.rb', line 5

def username
  @username
end

Instance Method Details

#commandObject



8
9
10
# File 'lib/sms_box/xml_request.rb', line 8

def command
  raise NotImplementedError.new 'XMLRequest needs to be subclassed'
end

#decorate_xml(root) ⇒ Object



12
13
14
15
16
17
# File 'lib/sms_box/xml_request.rb', line 12

def decorate_xml(root)
  root.username username
  root.password password
  root.command command
  root
end

#to_xmlObject



19
20
21
22
23
24
# File 'lib/sms_box/xml_request.rb', line 19

def to_xml
  builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
    decorate_xml(xml)
  end
  builder.to_xml
end