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



20
21
22
# File 'lib/secretariat/trade_party.rb', line 20

def city
  @city
end

#country_idObject

Returns the value of attribute country_id



20
21
22
# File 'lib/secretariat/trade_party.rb', line 20

def country_id
  @country_id
end

#global_idObject

Returns the value of attribute global_id



20
21
22
# File 'lib/secretariat/trade_party.rb', line 20

def global_id
  @global_id
end

#global_id_scheme_idObject

Returns the value of attribute global_id_scheme_id



20
21
22
# File 'lib/secretariat/trade_party.rb', line 20

def global_id_scheme_id
  @global_id_scheme_id
end

#nameObject

Returns the value of attribute name



20
21
22
# File 'lib/secretariat/trade_party.rb', line 20

def name
  @name
end

#postal_codeObject

Returns the value of attribute postal_code



20
21
22
# File 'lib/secretariat/trade_party.rb', line 20

def postal_code
  @postal_code
end

#street1Object

Returns the value of attribute street1



20
21
22
# File 'lib/secretariat/trade_party.rb', line 20

def street1
  @street1
end

#street2Object

Returns the value of attribute street2



20
21
22
# File 'lib/secretariat/trade_party.rb', line 20

def street2
  @street2
end

#tax_idObject

Returns the value of attribute tax_id



20
21
22
# File 'lib/secretariat/trade_party.rb', line 20

def tax_id
  @tax_id
end

#vat_idObject

Returns the value of attribute vat_id



20
21
22
# File 'lib/secretariat/trade_party.rb', line 20

def vat_id
  @vat_id
end

Instance Method Details

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



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
52
53
# File 'lib/secretariat/trade_party.rb', line 24

def to_xml(xml, exclude_tax: false, version: 2)
  if global_id.present? && global_id_scheme_id.present?
    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.present?
      xml['ram'].LineTwo street2
    end
    xml['ram'].CityName city
    xml['ram'].CountryID country_id
  end
  if !exclude_tax && vat_id.present?
    xml['ram'].SpecifiedTaxRegistration do
      xml['ram'].ID(schemeID: 'VA') do
        xml.text(vat_id)
      end
    end
  elsif tax_id.present?
    xml['ram'].SpecifiedTaxRegistration do
      xml['ram'].ID(schemeID: 'FC') do
        xml.text(tax_id)
      end
    end
  end
end