hithorizons 0.4 → 0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -0
- data/Gemfile.lock +5 -4
- data/bin/console +1 -0
- data/changelog.md +3 -0
- data/hithorizons.gemspec +1 -1
- data/lib/hithorizons.rb +1 -0
- data/lib/hithorizons/countries.rb +61 -61
- data/lib/hithorizons/country.rb +45 -0
- data/lib/hithorizons/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b2a3fdd9358b75537051add7674e7ed684ecaac7c450609c40a02d1cb6b1f96
|
4
|
+
data.tar.gz: 200ba0a9e296e71db76386bdcd3743ea31705efb5157d1eccb026b474246e50b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5d94eaec4dcc218bed43470719ed78d0cb669756b2c6074a108d70b780797917204629901d68d2caa4eea80158bc891c82b214f50df66b3b122a29184bcaf0d
|
7
|
+
data.tar.gz: e5ec04de3143846cb682b55098124ca4013902b15b601605e6d2aa5a3a3105830cca01cf897e3f9105b70c8270e24b28b9dfd90bc6415a13af3218ea0dbb7b44
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
hithorizons (0.
|
4
|
+
hithorizons (0.5)
|
5
5
|
faraday (~> 1)
|
6
6
|
faraday_middleware (~> 1)
|
7
7
|
|
@@ -60,8 +60,9 @@ GEM
|
|
60
60
|
unicode-display_width (>= 1.4.0, < 2.0)
|
61
61
|
rubocop-ast (1.4.0)
|
62
62
|
parser (>= 2.7.1.5)
|
63
|
-
rubocop-rspec (1.
|
64
|
-
rubocop (
|
63
|
+
rubocop-rspec (2.1.0)
|
64
|
+
rubocop (~> 1.0)
|
65
|
+
rubocop-ast (>= 1.1.0)
|
65
66
|
ruby-progressbar (1.11.0)
|
66
67
|
ruby2_keywords (0.0.2)
|
67
68
|
simplecov (0.21.1)
|
@@ -85,7 +86,7 @@ DEPENDENCIES
|
|
85
86
|
rake (~> 13.0)
|
86
87
|
rspec (~> 3.6)
|
87
88
|
rubocop (~> 1.7)
|
88
|
-
rubocop-rspec (~>
|
89
|
+
rubocop-rspec (~> 2)
|
89
90
|
simplecov (~> 0.21)
|
90
91
|
webmock (~> 3.11.0)
|
91
92
|
|
data/bin/console
CHANGED
data/changelog.md
CHANGED
data/hithorizons.gemspec
CHANGED
@@ -34,7 +34,7 @@ Gem::Specification.new do |spec|
|
|
34
34
|
spec.add_development_dependency 'rake', '~> 13.0'
|
35
35
|
spec.add_development_dependency 'rspec', '~> 3.6'
|
36
36
|
spec.add_development_dependency 'rubocop', '~> 1.7'
|
37
|
-
spec.add_development_dependency 'rubocop-rspec', '~>
|
37
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 2'
|
38
38
|
spec.add_development_dependency 'simplecov', '~> 0.21'
|
39
39
|
spec.add_development_dependency 'webmock', '~> 3.11.0'
|
40
40
|
end
|
data/lib/hithorizons.rb
CHANGED
@@ -6,6 +6,7 @@ require 'faraday_middleware'
|
|
6
6
|
require 'hithorizons/version'
|
7
7
|
require 'hithorizons/configuration'
|
8
8
|
require 'hithorizons/company'
|
9
|
+
require 'hithorizons/country'
|
9
10
|
require 'hithorizons/countries'
|
10
11
|
require 'hithorizons/company_types'
|
11
12
|
require 'hithorizons/industry_types'
|
@@ -2,71 +2,71 @@
|
|
2
2
|
|
3
3
|
module Hithorizons
|
4
4
|
class Countries
|
5
|
-
|
6
|
-
ALB
|
7
|
-
AND
|
8
|
-
ARM
|
9
|
-
AUS
|
10
|
-
AZE
|
11
|
-
BLR
|
12
|
-
BEL
|
13
|
-
BIH
|
14
|
-
BGR
|
15
|
-
HRV
|
16
|
-
CYP
|
17
|
-
CZE
|
18
|
-
DNK
|
19
|
-
GBR
|
20
|
-
EST
|
21
|
-
FRO
|
22
|
-
FIN
|
23
|
-
FRA
|
24
|
-
GEO
|
25
|
-
DEU
|
26
|
-
GIB
|
27
|
-
GRC
|
28
|
-
GRL
|
29
|
-
HUN
|
30
|
-
ISL
|
31
|
-
ITA
|
32
|
-
KAZ
|
33
|
-
XKX
|
34
|
-
KGZ
|
35
|
-
LVA
|
36
|
-
LIE
|
37
|
-
LTU
|
38
|
-
LUX
|
39
|
-
MKD
|
40
|
-
MLT
|
41
|
-
MDA
|
42
|
-
MCO
|
43
|
-
MNE
|
44
|
-
NLD
|
45
|
-
NOR
|
46
|
-
POL
|
47
|
-
PRT
|
48
|
-
ROU
|
49
|
-
RUS
|
50
|
-
SMR
|
51
|
-
SRB
|
52
|
-
SVK
|
53
|
-
SVN
|
54
|
-
ESP
|
55
|
-
SWE
|
56
|
-
CHE
|
57
|
-
TJK
|
58
|
-
TUR
|
59
|
-
TKM
|
60
|
-
UKR
|
61
|
-
UZB
|
62
|
-
}
|
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) }
|
63
63
|
|
64
64
|
def self.find_by_iso3(iso3)
|
65
|
-
|
65
|
+
LIST.find { |country| country.iso3 == iso3 }
|
66
66
|
end
|
67
67
|
|
68
|
-
def self.
|
69
|
-
|
68
|
+
def self.find_by_name(country_name)
|
69
|
+
LIST.find { |country| country.name == country_name }
|
70
70
|
end
|
71
71
|
end
|
72
72
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Hithorizons
|
4
|
+
class Country
|
5
|
+
attr_reader :iso3, :name
|
6
|
+
|
7
|
+
def initialize(iso3, name, registration_number)
|
8
|
+
@iso3 = iso3
|
9
|
+
@name = name
|
10
|
+
@registration_number = registration_number
|
11
|
+
end
|
12
|
+
|
13
|
+
def vat_id?
|
14
|
+
!@registration_number
|
15
|
+
end
|
16
|
+
|
17
|
+
def registration_number?
|
18
|
+
@registration_number
|
19
|
+
end
|
20
|
+
|
21
|
+
def vat_id(company)
|
22
|
+
return unless vat_id?
|
23
|
+
|
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
|
32
|
+
end
|
33
|
+
|
34
|
+
def tax_id(company)
|
35
|
+
case iso3
|
36
|
+
when 'HUN', 'ROU'
|
37
|
+
company['NationalId']
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def registration_number(company)
|
42
|
+
@registration_number ? company['NationalId'] : nil
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
data/lib/hithorizons/version.rb
CHANGED
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.
|
4
|
+
version: '0.5'
|
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-
|
11
|
+
date: 2021-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '2'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
110
|
+
version: '2'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: simplecov
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -166,6 +166,7 @@ files:
|
|
166
166
|
- lib/hithorizons/company_types.rb
|
167
167
|
- lib/hithorizons/configuration.rb
|
168
168
|
- lib/hithorizons/countries.rb
|
169
|
+
- lib/hithorizons/country.rb
|
169
170
|
- lib/hithorizons/industry_types.rb
|
170
171
|
- lib/hithorizons/version.rb
|
171
172
|
homepage: https://github.com/lubosch/hithorizons
|