Class: Secretariat::TradeParty

Inherits:
Struct
  • Object
show all
Defined in:
lib/secretariat/trade_party.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cityObject

Returns the value of attribute city



18
19
20
# File 'lib/secretariat/trade_party.rb', line 18

def city
  @city
end

#country_idObject

Returns the value of attribute country_id



18
19
20
# File 'lib/secretariat/trade_party.rb', line 18

def country_id
  @country_id
end

#global_idObject

Returns the value of attribute global_id



18
19
20
# File 'lib/secretariat/trade_party.rb', line 18

def global_id
  @global_id
end

#global_id_scheme_idObject

Returns the value of attribute global_id_scheme_id



18
19
20
# File 'lib/secretariat/trade_party.rb', line 18

def global_id_scheme_id
  @global_id_scheme_id
end

#nameObject

Returns the value of attribute name



18
19
20
# File 'lib/secretariat/trade_party.rb', line 18

def name
  @name
end

#postal_codeObject

Returns the value of attribute postal_code



18
19
20
# File 'lib/secretariat/trade_party.rb', line 18

def postal_code
  @postal_code
end

#street1Object

Returns the value of attribute street1



18
19
20
# File 'lib/secretariat/trade_party.rb', line 18

def street1
  @street1
end

#street2Object

Returns the value of attribute street2



18
19
20
# File 'lib/secretariat/trade_party.rb', line 18

def street2
  @street2
end

#tax_idObject

Returns the value of attribute tax_id



18
19
20
# File 'lib/secretariat/trade_party.rb', line 18

def tax_id
  @tax_id
end

#vat_idObject

Returns the value of attribute vat_id



18
19
20
# File 'lib/secretariat/trade_party.rb', line 18

def vat_id
  @vat_id
end

Instance Method Details

#to_xml(xml, exclude_tax: false, version: 2) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/secretariat/trade_party.rb', line 22

def to_xml(xml, exclude_tax: false, version: 2)
  if global_id && global_id != '' && global_id_scheme_id && global_id_scheme_id != ''
    xml['ram'].GlobalID(schemeID: global_id_scheme_id) do
      xml.text(global_id)
    end
  end
  xml['ram'].Name name
  xml['ram'].PostalTradeAddress do
    xml['ram'].PostcodeCode postal_code
    xml['ram'].LineOne street1
    if street2 && street2 != ''
      xml['ram'].LineTwo street2
    end
    xml['ram'].CityName city
    xml['ram'].CountryID country_id
  end
  if !exclude_tax && vat_id && vat_id != ''
    xml['ram'].SpecifiedTaxRegistration do
      xml['ram'].ID(schemeID: 'VA') do
        xml.text(vat_id)
      end
    end
  elsif tax_id && tax_id != ''
    xml['ram'].SpecifiedTaxRegistration do
      xml['ram'].ID(schemeID: 'FC') do
        xml.text(tax_id)
      end
    end
  end
end