Class: HostConnect::NewBookingInfoBuilder

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

Instance Method Summary collapse

Methods inherited from AbstractBuilder

#submit, #to_s

Constructor Details

#initialize(options = {}) ⇒ NewBookingInfoBuilder

Returns a new instance of NewBookingInfoBuilder.



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

def initialize(options = {})
  @valid_options = [ :name, :qb, :branch, :department,
                     :sales_analysis1, :sales_analysis2, :sales_analysis3 ].freeze
  super(options)
end

Instance Method Details

#to_xmlObject



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

def to_xml
  x = Builder::XmlMarkup.new(:indent => 2, :margin => 2)
  x.NewBookingInfo {
    x.Name @name
    x.QB @qb
    x.Branch @branch if @branch
    x.Department @department if @department
    x.SalesAnalysis1 @sales_analysis1 if @sales_analysis1
    x.SalesAnalysis2 @sales_analysis2 if @sales_analysis2
    x.SalesAnalysis3 @sales_analysis3 if @sales_analysis3
  }
  x
end