Class: Hithorizons::Country

Inherits:
Object
  • Object
show all
Defined in:
lib/hithorizons/country.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(iso3, name, registration_number: false, iso2: nil, tax_id: false, vat_id: false, invoicing_api: false) ⇒ Country

Returns a new instance of Country.



7
8
9
10
11
12
13
14
15
# File 'lib/hithorizons/country.rb', line 7

def initialize(iso3, name, registration_number: false, iso2: nil, tax_id: false, vat_id: false, invoicing_api: false)
  @iso3 = iso3
  @iso2 = iso2
  @name = name
  @registration_number = registration_number
  @tax_id = tax_id
  @vat_id = vat_id
  @invoicing_api = invoicing_api
end

Instance Attribute Details

#invoicing_apiObject (readonly)

Returns the value of attribute invoicing_api.



5
6
7
# File 'lib/hithorizons/country.rb', line 5

def invoicing_api
  @invoicing_api
end

#iso2Object (readonly)

Returns the value of attribute iso2.



5
6
7
# File 'lib/hithorizons/country.rb', line 5

def iso2
  @iso2
end

#iso3Object (readonly)

Returns the value of attribute iso3.



5
6
7
# File 'lib/hithorizons/country.rb', line 5

def iso3
  @iso3
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/hithorizons/country.rb', line 5

def name
  @name
end

Instance Method Details

#invoicing_api?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/hithorizons/country.rb', line 17

def invoicing_api?
  @invoicing_api
end

#registration_number(company) ⇒ Object



45
46
47
48
49
# File 'lib/hithorizons/country.rb', line 45

def registration_number(company)
  return unless registration_number?

  company['NationalId']
end

#registration_number?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/hithorizons/country.rb', line 29

def registration_number?
  @registration_number
end

#tax_id(company) ⇒ Object



39
40
41
42
43
# File 'lib/hithorizons/country.rb', line 39

def tax_id(company)
  return unless tax_id?

  company['NationalId']
end

#tax_id?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/hithorizons/country.rb', line 25

def tax_id?
  @tax_id
end

#vat_id(company) ⇒ Object



33
34
35
36
37
# File 'lib/hithorizons/country.rb', line 33

def vat_id(company)
  return unless vat_id?

  company['NationalId']
end

#vat_id?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/hithorizons/country.rb', line 21

def vat_id?
  @vat_id
end