Class: HostConnect::SupplierInfoBuilder

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

Instance Method Summary collapse

Methods inherited from AbstractBuilder

#submit, #to_s

Constructor Details

#initialize(options = {}) ⇒ SupplierInfoBuilder

Returns a new instance of SupplierInfoBuilder.



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

def initialize(options = {})
  @valid_options = [ :agent_id, :password, :supplier_code, :supplier_id ].freeze
  super(options)
end

Instance Method Details

#to_xmlObject



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

def to_xml
  x = bare
  x.Request {
    x.SupplierInfoRequest {
      x.AgentID @agent_id
      x.Password @password
      
      if @supplier_code
        @supplier_code.each { |s| x.SupplierCode s }
      end
      
      if @supplier_id
        @opt.each { |s| s.SupplierId s }
      end
    }
  }
  x
end