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

Returns:

  • (Object)

    the current value of 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

Returns:

  • (Object)

    the current value of country_id



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

def country_id
  @country_id
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of 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

Returns:

  • (Object)

    the current value of 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

Returns:

  • (Object)

    the current value of street1



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

def street1
  @street1
end

#street2Object

Returns the value of attribute street2

Returns:

  • (Object)

    the current value of street2



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

def street2
  @street2
end

#vat_idObject

Returns the value of attribute vat_id

Returns:

  • (Object)

    the current value of 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
# File 'lib/secretariat/trade_party.rb', line 22

def to_xml(xml, exclude_tax: false, version: 2)
  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
  end
end