Class: Beds24::XMLRequest

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

Instance Method Summary collapse

Constructor Details

#initialize(auth, opts = {}) ⇒ XMLRequest

Returns a new instance of XMLRequest.



3
4
5
6
# File 'lib/beds24/xml_request.rb', line 3

def initialize(auth, opts = {})
  @auth = auth
  @opts = opts
end

Instance Method Details

#to_xmlObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/beds24/xml_request.rb', line 8

def to_xml
  data = builder.new do |xml|
    xml.request do
      xml.auth do
        xml.username @auth[:username]
        xml.password @auth[:password]
      end
      @opts.each do |prop, value|
        xml.public_send prop, value
      end
    end
  end
  data.doc.root.to_xml
end