hithorizons 0.5 → 0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0b2a3fdd9358b75537051add7674e7ed684ecaac7c450609c40a02d1cb6b1f96
4
- data.tar.gz: 200ba0a9e296e71db76386bdcd3743ea31705efb5157d1eccb026b474246e50b
3
+ metadata.gz: dd4123e7f39897f826b6a63299c3d109098b61d9de82e882a7f8b890671d03c4
4
+ data.tar.gz: bf965383e5a05c52efe9c245fd05a0f4bc52d70acda91cac4cee6cf477c12d35
5
5
  SHA512:
6
- metadata.gz: d5d94eaec4dcc218bed43470719ed78d0cb669756b2c6074a108d70b780797917204629901d68d2caa4eea80158bc891c82b214f50df66b3b122a29184bcaf0d
7
- data.tar.gz: e5ec04de3143846cb682b55098124ca4013902b15b601605e6d2aa5a3a3105830cca01cf897e3f9105b70c8270e24b28b9dfd90bc6415a13af3218ea0dbb7b44
6
+ metadata.gz: 10b4a5c2dbb55827d3ab241c99a53e449e582bb25ac18db9f9bc0def008d2356a00808f6cde722cd3a09ad9727d7d7670708612657feaca0bc0c3463a28435b5
7
+ data.tar.gz: c8486701a31bbb462ec8ccb294f8fedf4c16591aeb2bcbb0d9d24f04c133ec52b5993df8f2f0288a0f2b3c5939ba2a3a786dbede82a9013b5344e3a1f4f53a69
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hithorizons (0.5)
4
+ hithorizons (0.6)
5
5
  faraday (~> 1)
6
6
  faraday_middleware (~> 1)
7
7
 
@@ -17,3 +17,6 @@ Helpers, readme
17
17
 
18
18
  ## 0.5
19
19
  Better countries API
20
+
21
+ ## 0.6
22
+ Countries fixes
@@ -3,63 +3,63 @@
3
3
  module Hithorizons
4
4
  class Countries
5
5
  LIST = [
6
- ['ALB', 'ALBANIA', true],
7
- ['AND', 'ANDORRA', true],
8
- ['ARM', 'ARMENIA', true],
9
- ['AUS', 'AUSTRIA', false],
10
- ['AZE', 'AZERBAIJAN', true],
11
- ['BLR', 'BELARUS', true],
12
- ['BEL', 'BELGIUM', true],
13
- ['BIH', 'BOSNIA AND HERZEGOVINA', true],
14
- ['BGR', 'BULGARIA', true],
15
- ['HRV', 'CROATIA', true],
16
- ['CYP', 'CYPRUS', false],
17
- ['CZE', 'CZECH REPUBLIC', true],
18
- ['DNK', 'DENMARK', true],
19
- ['GBR', 'ENGLAND', false],
20
- ['EST', 'ESTONIA', false],
21
- ['FRO', 'FAROE ISLANDS', true],
22
- ['FIN', 'FINLAND', true],
23
- ['FRA', 'FRANCE', false],
24
- ['GEO', 'GEORGIA', true],
25
- ['DEU', 'GERMANY', false],
26
- ['GIB', 'GIBRALTAR', true],
27
- ['GRC', 'GREECE', true],
28
- ['GRL', 'GREENLAND', true],
29
- ['HUN', 'HUNGARY', false],
30
- ['ISL', 'ICELAND', true],
31
- ['ITA', 'ITALY', true],
32
- ['KAZ', 'KAZAKHSTAN', true],
33
- ['XKX', 'KOSOVO', true],
34
- ['KGZ', 'KYRGYZSTAN', true],
35
- ['LVA', 'LATVIA', false],
36
- ['LIE', 'LIECHTENSTEIN', false],
37
- ['LTU', 'LITHUANIA', true],
38
- ['LUX', 'LUXEMBOURG', false],
39
- ['MKD', 'MACEDONIA', true],
40
- ['MLT', 'MALTA', false],
41
- ['MDA', 'MOLDOVA', true],
42
- ['MCO', 'MONACO', true],
43
- ['MNE', 'MONTENEGRO', true],
44
- ['NLD', 'NETHERLANDS', false],
45
- ['NOR', 'NORWAY', true],
46
- ['POL', 'POLAND', true],
47
- ['PRT', 'PORTUGAL', true],
48
- ['ROU', 'ROMANIA', false],
49
- ['RUS', 'RUSSIAN FEDERATION', true],
50
- ['SMR', 'SAN MARINO', true],
51
- ['SRB', 'SERBIA', true],
52
- ['SVK', 'SLOVAKIA', true],
53
- ['SVN', 'SLOVENIA', false],
54
- ['ESP', 'SPAIN', true],
55
- ['SWE', 'SWEDEN', false],
56
- ['CHE', 'SWITZERLAND', true],
57
- ['TJK', 'TAJIKISTAN', true],
58
- ['TUR', 'TURKEY', true],
59
- ['TKM', 'TURKMENISTAN', true],
60
- ['UKR', 'UKRAINE', true],
61
- ['UZB', 'UZBEKISTAN', true],
62
- ].map { |country| Country.new(*country) }
6
+ Country.new('ALB', 'ALBANIA', registration_number: true),
7
+ Country.new('AND', 'ANDORRA', registration_number: true),
8
+ Country.new('ARM', 'ARMENIA', registration_number: true),
9
+ Country.new('AUS', 'AUSTRIA', vat_id: true),
10
+ Country.new('AZE', 'AZERBAIJAN', registration_number: true),
11
+ Country.new('BLR', 'BELARUS', registration_number: true),
12
+ Country.new('BEL', 'BELGIUM', registration_number: true),
13
+ Country.new('BIH', 'BOSNIA AND HERZEGOVINA', registration_number: true),
14
+ Country.new('BGR', 'BULGARIA', registration_number: true),
15
+ Country.new('HRV', 'CROATIA', registration_number: true),
16
+ Country.new('CYP', 'CYPRUS', vat_id: true),
17
+ Country.new('CZE', 'CZECH REPUBLIC', registration_number: true),
18
+ Country.new('DNK', 'DENMARK', registration_number: true),
19
+ Country.new('GBR', 'ENGLAND', vat_id: true),
20
+ Country.new('EST', 'ESTONIA', vat_id: true),
21
+ Country.new('FRO', 'FAROE ISLANDS', registration_number: true),
22
+ Country.new('FIN', 'FINLAND', registration_number: true),
23
+ Country.new('FRA', 'FRANCE', vat_id: true),
24
+ Country.new('GEO', 'GEORGIA', registration_number: true),
25
+ Country.new('DEU', 'GERMANY', vat_id: true),
26
+ Country.new('GIB', 'GIBRALTAR', registration_number: true),
27
+ Country.new('GRC', 'GREECE', registration_number: true),
28
+ Country.new('GRL', 'GREENLAND', registration_number: true),
29
+ Country.new('HUN', 'HUNGARY', tax_id: true),
30
+ Country.new('ISL', 'ICELAND', registration_number: true),
31
+ Country.new('ITA', 'ITALY', registration_number: true),
32
+ Country.new('KAZ', 'KAZAKHSTAN', registration_number: true),
33
+ Country.new('XKX', 'KOSOVO', registration_number: true),
34
+ Country.new('KGZ', 'KYRGYZSTAN', registration_number: true),
35
+ Country.new('LVA', 'LATVIA', vat_id: true),
36
+ Country.new('LIE', 'LIECHTENSTEIN', vat_id: true),
37
+ Country.new('LTU', 'LITHUANIA', registration_number: true),
38
+ Country.new('LUX', 'LUXEMBOURG', vat_id: true),
39
+ Country.new('MKD', 'MACEDONIA', registration_number: true),
40
+ Country.new('MLT', 'MALTA', vat_id: true),
41
+ Country.new('MDA', 'MOLDOVA', registration_number: true),
42
+ Country.new('MCO', 'MONACO', registration_number: true),
43
+ Country.new('MNE', 'MONTENEGRO', registration_number: true),
44
+ Country.new('NLD', 'NETHERLANDS', vat_id: true),
45
+ Country.new('NOR', 'NORWAY', registration_number: true),
46
+ Country.new('POL', 'POLAND', registration_number: true),
47
+ Country.new('PRT', 'PORTUGAL', registration_number: true),
48
+ Country.new('ROU', 'ROMANIA', tax_id: true),
49
+ Country.new('RUS', 'RUSSIAN FEDERATION', registration_number: true),
50
+ Country.new('SMR', 'SAN MARINO', registration_number: true),
51
+ Country.new('SRB', 'SERBIA', registration_number: true),
52
+ Country.new('SVK', 'SLOVAKIA', registration_number: true),
53
+ Country.new('SVN', 'SLOVENIA', vat_id: true),
54
+ Country.new('ESP', 'SPAIN', registration_number: true),
55
+ Country.new('SWE', 'SWEDEN', vat_id: true),
56
+ Country.new('CHE', 'SWITZERLAND', registration_number: true),
57
+ Country.new('TJK', 'TAJIKISTAN', registration_number: true),
58
+ Country.new('TUR', 'TURKEY', registration_number: true),
59
+ Country.new('TKM', 'TURKMENISTAN', registration_number: true),
60
+ Country.new('UKR', 'UKRAINE', registration_number: true),
61
+ Country.new('UZB', 'UZBEKISTAN', registration_number: true),
62
+ ].freeze
63
63
 
64
64
  def self.find_by_iso3(iso3)
65
65
  LIST.find { |country| country.iso3 == iso3 }
@@ -4,14 +4,20 @@ module Hithorizons
4
4
  class Country
5
5
  attr_reader :iso3, :name
6
6
 
7
- def initialize(iso3, name, registration_number)
7
+ def initialize(iso3, name, registration_number: false, tax_id: false, vat_id: false)
8
8
  @iso3 = iso3
9
9
  @name = name
10
10
  @registration_number = registration_number
11
+ @tax_id = tax_id
12
+ @vat_id = vat_id
11
13
  end
12
14
 
13
15
  def vat_id?
14
- !@registration_number
16
+ @vat_id
17
+ end
18
+
19
+ def tax_id?
20
+ @tax_id
15
21
  end
16
22
 
17
23
  def registration_number?
@@ -21,25 +27,19 @@ module Hithorizons
21
27
  def vat_id(company)
22
28
  return unless vat_id?
23
29
 
24
- case iso3
25
- when 'HUN'
26
- "HU#{company['NationalId'][0...-3]}"
27
- when 'ROU'
28
- "RO#{company['NationalId']}"
29
- else
30
- company['NationalId']
31
- end
30
+ company['NationalId']
32
31
  end
33
32
 
34
33
  def tax_id(company)
35
- case iso3
36
- when 'HUN', 'ROU'
37
- company['NationalId']
38
- end
34
+ return unless tax_id?
35
+
36
+ company['NationalId']
39
37
  end
40
38
 
41
39
  def registration_number(company)
42
- @registration_number ? company['NationalId'] : nil
40
+ return unless registration_number?
41
+
42
+ company['NationalId']
43
43
  end
44
44
  end
45
45
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Hithorizons
4
- VERSION = '0.5'
4
+ VERSION = '0.6'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hithorizons
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.5'
4
+ version: '0.6'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lubomir Vnenk
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-15 00:00:00.000000000 Z
11
+ date: 2021-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday