Class: HostConnect::ListBookingsBuilder

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

Overview

The ListBookings request returns header-level details of zero or more bookings made by the specifed agent, and that meet all of the criteria specified. If a sub-login is supplied then only details of bookings associated with that sub-login are returned.

Instance Method Summary collapse

Methods inherited from AbstractBuilder

#submit, #to_s

Constructor Details

#initialize(options = {}) ⇒ ListBookingsBuilder

Returns a new instance of ListBookingsBuilder.



7
8
9
10
11
12
# File 'lib/hostconnect/builders/list_bookings_builder.rb', line 7

def initialize(options = {})
  @valid_options = [ :agent_id, :password, :travel_date_from, :travel_date_to,
                     :entered_date_from, :entered_date_to, :name_contains,
                     :agent_ref ].freeze
  super(options)
end

Instance Method Details

#to_xmlObject



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/hostconnect/builders/list_bookings_builder.rb', line 14

def to_xml
  x = bare
  x.Request {
    x.ListBookingsRequest {
      @valid_options.each do |opt|
        val = eval "#{opt}"
        eval "x.#{opt.camelize.requestify} #{opt}" unless val.blank?
      end
    }
  }
  x
end