hithorizons 0.4 → 0.7.2

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: ab6f7786aec6d14befefb0c7e4a7086b6eb0ce248c085cac2b7aebc915058cb6
4
- data.tar.gz: 47c0fefec0cf906d4bad345e2befeb6060278c15e7c5bd132220f8004b43401c
3
+ metadata.gz: f186810d9cda71b1eefec60a03638876f2a18e3e635bd98186812cdf8f7e506d
4
+ data.tar.gz: 0f28899831c28fecc97ff2e65ccb24e8d5aef087a24bab793391b64121892ae9
5
5
  SHA512:
6
- metadata.gz: b86030d927a6f4733e1548655cdf066c550b56c820691785db60eed26b7ca9e7fc8900ab45a2a66ce90ebaa530759016bddc97fd0c9480289271c244a56311f8
7
- data.tar.gz: dc2473e954c543b6f13b1bff27e7323d6ae7ececee12b6c1db116b14fe945e2c6f698ba4ca00ce63071e19eadc2f06468554381ace90f8af3763424a5fcf025d
6
+ metadata.gz: c63ffdf696a6af7091d8f36b2a87a800891a9572697e4ee0a3089404c3cd15a8db35bd809a830ff0ca8a2cc77cf82fe3ec9858179c09f165f3f2f3ba235ae864
7
+ data.tar.gz: 4a4a0a60dceb2e24c0e8f267c53feb4c00c3cfeb423cf36007432bf39342c2ab8006640bc5f69127c3e12e3a50606b40cc90ede9ce27a27e3e39d7d63e121216
data/.rubocop.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.4
2
+ TargetRubyVersion: 3.1
3
3
  NewCops: enable
4
4
 
5
5
  CacheRootDirectory: /tmp
@@ -8,6 +8,7 @@ AllCops:
8
8
  Exclude:
9
9
  - 'bin/*'
10
10
  - 'tmp/**/*'
11
+ - 'spec/**/*'
11
12
 
12
13
  Layout/LineLength:
13
14
  Max: 150
data/Gemfile.lock CHANGED
@@ -1,41 +1,57 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hithorizons (0.4)
4
+ hithorizons (0.7.2)
5
5
  faraday (~> 1)
6
6
  faraday_middleware (~> 1)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- addressable (2.7.0)
11
+ addressable (2.8.0)
12
12
  public_suffix (>= 2.0.2, < 5.0)
13
- ast (2.4.1)
14
- codecov (0.2.12)
15
- json
16
- simplecov
13
+ ast (2.4.2)
14
+ codecov (0.6.0)
15
+ simplecov (>= 0.15, < 0.22)
17
16
  crack (0.4.5)
18
17
  rexml
19
- diff-lcs (1.4.4)
20
- docile (1.3.4)
21
- faraday (1.3.0)
18
+ diff-lcs (1.5.0)
19
+ docile (1.4.0)
20
+ faraday (1.9.3)
21
+ faraday-em_http (~> 1.0)
22
+ faraday-em_synchrony (~> 1.0)
23
+ faraday-excon (~> 1.1)
24
+ faraday-httpclient (~> 1.0)
25
+ faraday-multipart (~> 1.0)
22
26
  faraday-net_http (~> 1.0)
27
+ faraday-net_http_persistent (~> 1.0)
28
+ faraday-patron (~> 1.0)
29
+ faraday-rack (~> 1.0)
30
+ faraday-retry (~> 1.0)
31
+ ruby2_keywords (>= 0.0.4)
32
+ faraday-em_http (1.0.0)
33
+ faraday-em_synchrony (1.0.0)
34
+ faraday-excon (1.1.0)
35
+ faraday-httpclient (1.0.1)
36
+ faraday-multipart (1.0.3)
23
37
  multipart-post (>= 1.2, < 3)
24
- ruby2_keywords
25
- faraday-net_http (1.0.0)
26
- faraday_middleware (1.0.0)
38
+ faraday-net_http (1.0.1)
39
+ faraday-net_http_persistent (1.2.0)
40
+ faraday-patron (1.0.0)
41
+ faraday-rack (1.0.0)
42
+ faraday-retry (1.0.3)
43
+ faraday_middleware (1.2.0)
27
44
  faraday (~> 1.0)
28
45
  hashdiff (1.0.1)
29
- json (2.5.1)
30
46
  multipart-post (2.1.1)
31
- parallel (1.20.1)
32
- parser (3.0.0.0)
47
+ parallel (1.21.0)
48
+ parser (3.1.0.0)
33
49
  ast (~> 2.4.1)
34
50
  public_suffix (4.0.6)
35
- rainbow (3.0.0)
36
- rake (13.0.3)
37
- regexp_parser (2.0.3)
38
- rexml (3.2.4)
51
+ rainbow (3.1.1)
52
+ rake (13.0.6)
53
+ regexp_parser (2.2.0)
54
+ rexml (3.2.5)
39
55
  rspec (3.10.0)
40
56
  rspec-core (~> 3.10.0)
41
57
  rspec-expectations (~> 3.10.0)
@@ -45,34 +61,34 @@ GEM
45
61
  rspec-expectations (3.10.1)
46
62
  diff-lcs (>= 1.2.0, < 2.0)
47
63
  rspec-support (~> 3.10.0)
48
- rspec-mocks (3.10.1)
64
+ rspec-mocks (3.10.2)
49
65
  diff-lcs (>= 1.2.0, < 2.0)
50
66
  rspec-support (~> 3.10.0)
51
- rspec-support (3.10.1)
52
- rubocop (1.7.0)
67
+ rspec-support (3.10.3)
68
+ rubocop (1.24.1)
53
69
  parallel (~> 1.10)
54
- parser (>= 2.7.1.5)
70
+ parser (>= 3.0.0.0)
55
71
  rainbow (>= 2.2.2, < 4.0)
56
72
  regexp_parser (>= 1.8, < 3.0)
57
73
  rexml
58
- rubocop-ast (>= 1.2.0, < 2.0)
74
+ rubocop-ast (>= 1.15.1, < 2.0)
59
75
  ruby-progressbar (~> 1.7)
60
- unicode-display_width (>= 1.4.0, < 2.0)
61
- rubocop-ast (1.4.0)
62
- parser (>= 2.7.1.5)
63
- rubocop-rspec (1.42.0)
64
- rubocop (>= 0.87.0)
76
+ unicode-display_width (>= 1.4.0, < 3.0)
77
+ rubocop-ast (1.15.1)
78
+ parser (>= 3.0.1.1)
79
+ rubocop-rspec (2.7.0)
80
+ rubocop (~> 1.19)
65
81
  ruby-progressbar (1.11.0)
66
- ruby2_keywords (0.0.2)
67
- simplecov (0.21.1)
82
+ ruby2_keywords (0.0.5)
83
+ simplecov (0.21.2)
68
84
  docile (~> 1.1)
69
85
  simplecov-html (~> 0.11)
70
86
  simplecov_json_formatter (~> 0.1)
71
87
  simplecov-html (0.12.3)
72
- simplecov_json_formatter (0.1.2)
73
- unicode-display_width (1.7.0)
74
- webmock (3.11.0)
75
- addressable (>= 2.3.6)
88
+ simplecov_json_formatter (0.1.3)
89
+ unicode-display_width (2.1.0)
90
+ webmock (3.14.0)
91
+ addressable (>= 2.8.0)
76
92
  crack (>= 0.3.2)
77
93
  hashdiff (>= 0.4.0, < 2.0.0)
78
94
 
@@ -85,9 +101,9 @@ DEPENDENCIES
85
101
  rake (~> 13.0)
86
102
  rspec (~> 3.6)
87
103
  rubocop (~> 1.7)
88
- rubocop-rspec (~> 1.42)
104
+ rubocop-rspec (~> 2)
89
105
  simplecov (~> 0.21)
90
- webmock (~> 3.11.0)
106
+ webmock (~> 3)
91
107
 
92
108
  BUNDLED WITH
93
109
  2.1.4
data/README.md CHANGED
@@ -29,6 +29,7 @@ Or install it yourself as:
29
29
  ```ruby
30
30
  Hithorizons.configure do |config|
31
31
  config.api_key = API_KEY
32
+ config.invoicing_api_key = INVOICING_API_KEY
32
33
  end
33
34
  ```
34
35
 
data/bin/console CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'bundler/setup'
4
5
  require 'hithorizons'
data/changelog.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0
4
+
5
+ - Upgrade ruby to 3.1
6
+ - Add invoicing API
7
+
3
8
  ## 0.1
4
9
  Init
5
10
 
@@ -14,3 +19,9 @@ Response object fix
14
19
 
15
20
  ## 0.4
16
21
  Helpers, readme
22
+
23
+ ## 0.5
24
+ Better countries API
25
+
26
+ ## 0.6
27
+ Countries fixes
data/hithorizons.gemspec CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.description = 'Horizonts api integration for get, search and search unstructured'
13
13
  spec.homepage = 'https://github.com/lubosch/hithorizons'
14
14
  spec.license = 'MIT'
15
- spec.required_ruby_version = Gem::Requirement.new('>= 2.4.0')
15
+ spec.required_ruby_version = Gem::Requirement.new('>= 3.1')
16
16
 
17
17
  spec.metadata['homepage_uri'] = spec.homepage
18
18
  spec.metadata['source_code_uri'] = spec.homepage
@@ -34,7 +34,8 @@ 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', '~> 1.42'
37
+ spec.add_development_dependency 'rubocop-rspec', '~> 2'
38
38
  spec.add_development_dependency 'simplecov', '~> 0.21'
39
- spec.add_development_dependency 'webmock', '~> 3.11.0'
39
+ spec.add_development_dependency 'webmock', '~> 3'
40
+ spec.metadata['rubygems_mfa_required'] = 'true'
40
41
  end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Hithorizons
4
+ class BaseApi
5
+ API_URL = ''
6
+
7
+ def self.process_request(uri, method = 'GET', payload = nil)
8
+ response = request(uri, method, payload)
9
+
10
+ raise(Hithorizons::Error, response.body) if response.status != 200
11
+
12
+ Response.new(response.body)
13
+ end
14
+
15
+ def self.request(uri, method = 'GET', payload = nil)
16
+ client = initialize_client
17
+
18
+ client.send(method.downcase.to_sym) do |request|
19
+ request.headers['Ocp-Apim-Subscription-Key'] = api_key
20
+ request.url("#{self::API_URL}#{uri}")
21
+ if method == 'GET'
22
+ request.params = payload
23
+ else
24
+ request.body = payload
25
+ end
26
+ end
27
+ end
28
+
29
+ def self.api_key
30
+ Hithorizons.config.api_key
31
+ end
32
+
33
+ def self.initialize_client
34
+ ::Faraday.new(url: Hithorizons.config.api_url) do |faraday|
35
+ faraday.request :json
36
+ faraday.response :json
37
+
38
+ faraday.adapter Faraday.default_adapter
39
+ end
40
+ end
41
+
42
+ def self.get(path)
43
+ request(path, 'GET')
44
+ end
45
+ end
46
+ end
@@ -2,42 +2,11 @@
2
2
 
3
3
  module Hithorizons
4
4
  module Company
5
- class BaseApi
5
+ class BaseApi < Hithorizons::BaseApi
6
6
  API_URL = '/Company'
7
7
 
8
- def self.process_request(uri, method = 'GET', payload = nil)
9
- response = request(uri, method, payload)
10
-
11
- raise(Hithorizons::Error, response.body) if response.status != 200
12
-
13
- Hithorizons::Company::Response.new(response.body)
14
- end
15
-
16
- def self.request(uri, method = 'GET', payload = nil)
17
- client = initialize_client
18
-
19
- client.send(method.downcase.to_sym) do |request|
20
- request.headers['Ocp-Apim-Subscription-Key'] = Hithorizons.config.api_key
21
- request.url("#{API_URL}#{uri}")
22
- if method == 'GET'
23
- request.params = payload
24
- else
25
- request.body = payload
26
- end
27
- end
28
- end
29
-
30
- def self.initialize_client
31
- ::Faraday.new(url: Hithorizons.config.api_url) do |faraday|
32
- faraday.request :json
33
- faraday.response :json
34
-
35
- faraday.adapter Faraday.default_adapter
36
- end
37
- end
38
-
39
- def self.get(path)
40
- request(path, 'GET')
8
+ def self.api_key
9
+ Hithorizons.config.api_key
41
10
  end
42
11
  end
43
12
  end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'hithorizons/company/base_api'
4
- require 'hithorizons/company/response'
5
4
  require 'hithorizons/company/detail'
6
5
  require 'hithorizons/company/search'
7
6
  require 'hithorizons/company/search_unstructured'
@@ -2,10 +2,11 @@
2
2
 
3
3
  module Hithorizons
4
4
  class Configuration
5
- attr_accessor :api_key, :api_url
5
+ attr_accessor :invoicing_api_key, :api_key, :api_url
6
6
 
7
7
  def initialize
8
8
  @api_key = ENV['HITHORIZONS_API_KEY']
9
+ @invoicing_api_key = ENV['HITHORIZONS_INVOICING_API_KEY']
9
10
  @api_url = 'https://api.hithorizons.com'
10
11
  end
11
12
  end
@@ -2,71 +2,71 @@
2
2
 
3
3
  module Hithorizons
4
4
  class Countries
5
- MAPPING = {
6
- ALB: 'ALBANIA',
7
- AND: 'ANDORRA',
8
- ARM: 'ARMENIA',
9
- AUS: 'AUSTRIA',
10
- AZE: 'AZERBAIJAN',
11
- BLR: 'BELARUS',
12
- BEL: 'BELGIUM',
13
- BIH: 'BOSNIA AND HERZEGOVINA',
14
- BGR: 'BULGARIA',
15
- HRV: 'CROATIA',
16
- CYP: 'CYPRUS',
17
- CZE: 'CZECH REPUBLIC',
18
- DNK: 'DENMARK',
19
- GBR: 'ENGLAND',
20
- EST: 'ESTONIA',
21
- FRO: 'FAROE ISLANDS',
22
- FIN: 'FINLAND',
23
- FRA: 'FRANCE',
24
- GEO: 'GEORGIA',
25
- DEU: 'GERMANY',
26
- GIB: 'GIBRALTAR',
27
- GRC: 'GREECE',
28
- GRL: 'GREENLAND',
29
- HUN: 'HUNGARY',
30
- ISL: 'ICELAND',
31
- ITA: 'ITALY',
32
- KAZ: 'KAZAKHSTAN',
33
- XKX: 'KOSOVO',
34
- KGZ: 'KYRGYZSTAN',
35
- LVA: 'LATVIA',
36
- LIE: 'LIECHTENSTEIN',
37
- LTU: 'LITHUANIA',
38
- LUX: 'LUXEMBOURG',
39
- MKD: 'MACEDONIA',
40
- MLT: 'MALTA',
41
- MDA: 'MOLDOVA',
42
- MCO: 'MONACO',
43
- MNE: 'MONTENEGRO',
44
- NLD: 'NETHERLANDS',
45
- NOR: 'NORWAY',
46
- POL: 'POLAND',
47
- PRT: 'PORTUGAL',
48
- ROU: 'ROMANIA',
49
- RUS: 'RUSSIAN FEDERATION',
50
- SMR: 'SAN MARINO',
51
- SRB: 'SERBIA',
52
- SVK: 'SLOVAKIA',
53
- SVN: 'SLOVENIA',
54
- ESP: 'SPAIN',
55
- SWE: 'SWEDEN',
56
- CHE: 'SWITZERLAND',
57
- TJK: 'TAJIKISTAN',
58
- TUR: 'TURKEY',
59
- TKM: 'TURKMENISTAN',
60
- UKR: 'UKRAINE',
61
- UZB: 'UZBEKISTAN',
62
- }.freeze
5
+ LIST = [
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, invoicing_api: true, iso2: 'CZ'),
18
+ Country.new('DNK', 'DENMARK', registration_number: true),
19
+ Country.new('GBR', 'ENGLAND', vat_id: true, invoicing_api: true, iso2: 'GB'),
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, invoicing_api: true, iso2: 'DE'),
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, invoicing_api: true, iso2: 'HU'),
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, invoicing_api: true, iso2: 'PL'),
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, invoicing_api: true, iso2: 'SK'),
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
- MAPPING[iso3.upcase.to_sym] if iso3
65
+ LIST.find { |country| country.iso3 == iso3 }
66
66
  end
67
67
 
68
- def self.iso3_by_country(country)
69
- MAPPING.invert[country]
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,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Hithorizons
4
+ class Country
5
+ attr_reader :iso3, :iso2, :name, :invoicing_api
6
+
7
+ def initialize(iso3, name, registration_number: false, iso2: nil, tax_id: false, vat_id: false, invoicing_api: false)
8
+ @iso3 = iso3
9
+ @iso2 = iso2
10
+ @name = name
11
+ @registration_number = registration_number
12
+ @tax_id = tax_id
13
+ @vat_id = vat_id
14
+ @invoicing_api = invoicing_api
15
+ end
16
+
17
+ def invoicing_api?
18
+ @invoicing_api
19
+ end
20
+
21
+ def vat_id?
22
+ @vat_id
23
+ end
24
+
25
+ def tax_id?
26
+ @tax_id
27
+ end
28
+
29
+ def registration_number?
30
+ @registration_number
31
+ end
32
+
33
+ def vat_id(company)
34
+ return unless vat_id?
35
+
36
+ company['NationalId']
37
+ end
38
+
39
+ def tax_id(company)
40
+ return unless tax_id?
41
+
42
+ company['NationalId']
43
+ end
44
+
45
+ def registration_number(company)
46
+ return unless registration_number?
47
+
48
+ company['NationalId']
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Hithorizons
4
+ module Invoicing
5
+ class BaseApi < Hithorizons::BaseApi
6
+ API_URL = '/invoicing'
7
+
8
+ def self.api_key
9
+ Hithorizons.config.invoicing_api_key
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Hithorizons
4
+ module Invoicing
5
+ class Detail < BaseApi
6
+ def self.get(country_code:, id:)
7
+ process_request("/#{country_code}/Company/Detail", 'GET', { Id: id })
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Hithorizons
4
+ module Invoicing
5
+ class Search < BaseApi
6
+ def self.get(country_code:,
7
+ company_name: nil, national_id: nil, tax_id: nil, vat_id: nil, address_unstructured: nil, address_street: nil,
8
+ street_number: nil, locality: nil, district: nil, region: nil, postal_code: nil, city: nil, country: nil,
9
+ max_results: nil)
10
+ payload = {
11
+ CompanyName: company_name, NationalId: national_id, TaxId: tax_id, VatId: vat_id, AddressUnstructured: address_unstructured,
12
+ AddressStreet: address_street, StreetNumber: street_number, Locality: locality, District: district, Region: region,
13
+ PostalCode: postal_code, City: city, Country: country, MaxResults: max_results
14
+ }
15
+ process_request("/#{country_code}/Company/Search", 'GET', payload.compact)
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Hithorizons
4
+ module Invoicing
5
+ class SearchUnstructured < BaseApi
6
+ def self.get(country_code:, ids: nil, name: nil, address: nil, max_results: nil)
7
+ payload = { Ids: ids, Name: name, Address: address, MaxResults: max_results }
8
+ process_request("/#{country_code}/Company/SearchUnstructured", 'GET', payload.compact)
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'hithorizons/invoicing/base_api'
4
+ require 'hithorizons/invoicing/detail'
5
+ require 'hithorizons/invoicing/search'
6
+ require 'hithorizons/invoicing/search_unstructured'
7
+
8
+ module Hithorizons
9
+ module Company
10
+ end
11
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Hithorizons
4
+ class Response
5
+ attr_reader :response
6
+
7
+ def initialize(response)
8
+ @response = response
9
+ end
10
+
11
+ def success
12
+ response['Success']
13
+ end
14
+
15
+ def error
16
+ response['Error']
17
+ end
18
+
19
+ def result
20
+ response['Result']
21
+ end
22
+
23
+ def results
24
+ response.dig('Result', 'Results')
25
+ end
26
+
27
+ def total_count
28
+ response.dig('Result', 'TotalCount')
29
+ end
30
+
31
+ def results_count
32
+ response.dig('Result', 'ResultsCount')
33
+ end
34
+ end
35
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Hithorizons
4
- VERSION = '0.4'
4
+ VERSION = '0.7.2'
5
5
  end
data/lib/hithorizons.rb CHANGED
@@ -5,7 +5,11 @@ require 'faraday_middleware'
5
5
 
6
6
  require 'hithorizons/version'
7
7
  require 'hithorizons/configuration'
8
+ require 'hithorizons/base_api'
9
+ require 'hithorizons/response'
8
10
  require 'hithorizons/company'
11
+ require 'hithorizons/invoicing'
12
+ require 'hithorizons/country'
9
13
  require 'hithorizons/countries'
10
14
  require 'hithorizons/company_types'
11
15
  require 'hithorizons/industry_types'
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'
4
+ version: 0.7.2
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-06 00:00:00.000000000 Z
11
+ date: 2022-01-14 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: '1.42'
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: '1.42'
110
+ version: '2'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: simplecov
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 3.11.0
131
+ version: '3'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: 3.11.0
138
+ version: '3'
139
139
  description: Horizonts api integration for get, search and search unstructured
140
140
  email:
141
141
  - lubomir.vnenk@zoho.com
@@ -157,16 +157,23 @@ files:
157
157
  - changelog.md
158
158
  - hithorizons.gemspec
159
159
  - lib/hithorizons.rb
160
+ - lib/hithorizons/base_api.rb
160
161
  - lib/hithorizons/company.rb
161
162
  - lib/hithorizons/company/base_api.rb
162
163
  - lib/hithorizons/company/detail.rb
163
- - lib/hithorizons/company/response.rb
164
164
  - lib/hithorizons/company/search.rb
165
165
  - lib/hithorizons/company/search_unstructured.rb
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
171
+ - lib/hithorizons/invoicing.rb
172
+ - lib/hithorizons/invoicing/base_api.rb
173
+ - lib/hithorizons/invoicing/detail.rb
174
+ - lib/hithorizons/invoicing/search.rb
175
+ - lib/hithorizons/invoicing/search_unstructured.rb
176
+ - lib/hithorizons/response.rb
170
177
  - lib/hithorizons/version.rb
171
178
  homepage: https://github.com/lubosch/hithorizons
172
179
  licenses:
@@ -175,6 +182,7 @@ metadata:
175
182
  homepage_uri: https://github.com/lubosch/hithorizons
176
183
  source_code_uri: https://github.com/lubosch/hithorizons
177
184
  changelog_uri: https://github.com/lubosch/hithorizons/blob/master/changelog.md
185
+ rubygems_mfa_required: 'true'
178
186
  post_install_message:
179
187
  rdoc_options: []
180
188
  require_paths:
@@ -183,14 +191,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
183
191
  requirements:
184
192
  - - ">="
185
193
  - !ruby/object:Gem::Version
186
- version: 2.4.0
194
+ version: '3.1'
187
195
  required_rubygems_version: !ruby/object:Gem::Requirement
188
196
  requirements:
189
197
  - - ">="
190
198
  - !ruby/object:Gem::Version
191
199
  version: '0'
192
200
  requirements: []
193
- rubygems_version: 3.1.4
201
+ rubygems_version: 3.3.3
194
202
  signing_key:
195
203
  specification_version: 4
196
204
  summary: Horizonts api integration
@@ -1,37 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Hithorizons
4
- module Company
5
- class Response
6
- attr_reader :response
7
-
8
- def initialize(response)
9
- @response = response
10
- end
11
-
12
- def success
13
- response['Success']
14
- end
15
-
16
- def error
17
- response['Error']
18
- end
19
-
20
- def result
21
- response['Result']
22
- end
23
-
24
- def results
25
- response.dig('Result', 'Results')
26
- end
27
-
28
- def total_count
29
- response.dig('Result', 'TotalCount')
30
- end
31
-
32
- def results_count
33
- response.dig('Result', 'ResultsCount')
34
- end
35
- end
36
- end
37
- end