Class: HostConnect::RoomConfigBuilder

Inherits:
AbstractBuilder show all
Defined in:
lib/hostconnect/builders/room_config_builder.rb

Instance Method Summary collapse

Methods inherited from AbstractBuilder

#submit, #to_s

Constructor Details

#initialize(options = {}) ⇒ RoomConfigBuilder

Room types: SG (single), TW (twin), DB (double), TR (triple), QD (quad)



4
5
6
7
# File 'lib/hostconnect/builders/room_config_builder.rb', line 4

def initialize(options = {})
  @valid_options = [ :adults, :room_type, :pax_list ].freeze
  super(options)
end

Instance Method Details

#to_xmlObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/hostconnect/builders/room_config_builder.rb', line 9

def to_xml
  x = Builder::XmlMarkup.new(:indent => 2, :margin => 3)
  x.RoomConfig {
    x.Adults @adults if @adults
    x.RoomType @room_type if @room_type

    if @pax_list
      # Stack the PaxDetails builder objects onto the request
      x.PaxList { |i|
        @pax_list.each { |pax| i << pax.to_xml.target! }
      }
    end
  }
  x
end