Class: HostConnect::PaxDetailsBuilder

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

Instance Method Summary collapse

Methods inherited from AbstractBuilder

#submit, #to_s

Constructor Details

#initialize(options = {}) ⇒ PaxDetailsBuilder

Returns a new instance of PaxDetailsBuilder.



3
4
5
6
7
8
# File 'lib/hostconnect/builders/pax_details_builder.rb', line 3

def initialize(options = {})
  @valid_options = [ :title, :forename, :surname, :date_of_birth, :pax_type,
                     :pax_text1, :pax_text2, :pax_text3, :pax_text4,
                     :pax_text5 ].freeze
  super(options)
end

Instance Method Details

#to_xmlObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/hostconnect/builders/pax_details_builder.rb', line 10

def to_xml
  x = Builder::XmlMarkup.new(:indent => 2, :margin => 5)
  x.PaxDetails {
    @valid_options.each do |opt|
      val = eval "#{opt}"
      eval "x.#{opt.camelize} #{opt}" unless val.blank?
    end
  }
  x
end