hithorizons 0.4

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ab6f7786aec6d14befefb0c7e4a7086b6eb0ce248c085cac2b7aebc915058cb6
4
+ data.tar.gz: 47c0fefec0cf906d4bad345e2befeb6060278c15e7c5bd132220f8004b43401c
5
+ SHA512:
6
+ metadata.gz: b86030d927a6f4733e1548655cdf066c550b56c820691785db60eed26b7ca9e7fc8900ab45a2a66ce90ebaa530759016bddc97fd0c9480289271c244a56311f8
7
+ data.tar.gz: dc2473e954c543b6f13b1bff27e7323d6ae7ececee12b6c1db116b14fe945e2c6f698ba4ca00ce63071e19eadc2f06468554381ace90f8af3763424a5fcf025d
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,56 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.4
3
+ NewCops: enable
4
+
5
+ CacheRootDirectory: /tmp
6
+ AllowSymlinksInCacheRootDirectory: true
7
+
8
+ Exclude:
9
+ - 'bin/*'
10
+ - 'tmp/**/*'
11
+
12
+ Layout/LineLength:
13
+ Max: 150
14
+
15
+ Layout/ParameterAlignment:
16
+ Enabled: false
17
+
18
+ Metrics/ParameterLists:
19
+ Enabled: false
20
+
21
+ Layout/MultilineMethodCallIndentation:
22
+ EnforcedStyle: indented
23
+
24
+ Metrics/BlockLength:
25
+ Exclude:
26
+ - '*.gemspec'
27
+
28
+ Naming/FileName:
29
+ Exclude:
30
+
31
+ Style/Documentation:
32
+ Enabled: false
33
+
34
+ Style/DoubleNegation:
35
+ Enabled: false
36
+
37
+ Style/FormatStringToken:
38
+ Enabled: false
39
+
40
+ Style/NumericLiterals:
41
+ Enabled: false
42
+
43
+ Style/PercentLiteralDelimiters:
44
+ PreferredDelimiters:
45
+ default: ()
46
+ '%i': '()'
47
+ '%I': '()'
48
+ '%r': '{}'
49
+ '%w': '()'
50
+ '%W': '()'
51
+
52
+ Style/TrailingCommaInArrayLiteral:
53
+ EnforcedStyleForMultiline: comma
54
+
55
+ Style/TrailingCommaInHashLiteral:
56
+ EnforcedStyleForMultiline: comma
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.7.2
6
+ before_install: gem install bundler -v 2.1.4
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in hithorizons.gemspec
6
+ gemspec
@@ -0,0 +1,93 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ hithorizons (0.4)
5
+ faraday (~> 1)
6
+ faraday_middleware (~> 1)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ addressable (2.7.0)
12
+ public_suffix (>= 2.0.2, < 5.0)
13
+ ast (2.4.1)
14
+ codecov (0.2.12)
15
+ json
16
+ simplecov
17
+ crack (0.4.5)
18
+ rexml
19
+ diff-lcs (1.4.4)
20
+ docile (1.3.4)
21
+ faraday (1.3.0)
22
+ faraday-net_http (~> 1.0)
23
+ multipart-post (>= 1.2, < 3)
24
+ ruby2_keywords
25
+ faraday-net_http (1.0.0)
26
+ faraday_middleware (1.0.0)
27
+ faraday (~> 1.0)
28
+ hashdiff (1.0.1)
29
+ json (2.5.1)
30
+ multipart-post (2.1.1)
31
+ parallel (1.20.1)
32
+ parser (3.0.0.0)
33
+ ast (~> 2.4.1)
34
+ 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)
39
+ rspec (3.10.0)
40
+ rspec-core (~> 3.10.0)
41
+ rspec-expectations (~> 3.10.0)
42
+ rspec-mocks (~> 3.10.0)
43
+ rspec-core (3.10.1)
44
+ rspec-support (~> 3.10.0)
45
+ rspec-expectations (3.10.1)
46
+ diff-lcs (>= 1.2.0, < 2.0)
47
+ rspec-support (~> 3.10.0)
48
+ rspec-mocks (3.10.1)
49
+ diff-lcs (>= 1.2.0, < 2.0)
50
+ rspec-support (~> 3.10.0)
51
+ rspec-support (3.10.1)
52
+ rubocop (1.7.0)
53
+ parallel (~> 1.10)
54
+ parser (>= 2.7.1.5)
55
+ rainbow (>= 2.2.2, < 4.0)
56
+ regexp_parser (>= 1.8, < 3.0)
57
+ rexml
58
+ rubocop-ast (>= 1.2.0, < 2.0)
59
+ 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)
65
+ ruby-progressbar (1.11.0)
66
+ ruby2_keywords (0.0.2)
67
+ simplecov (0.21.1)
68
+ docile (~> 1.1)
69
+ simplecov-html (~> 0.11)
70
+ simplecov_json_formatter (~> 0.1)
71
+ 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)
76
+ crack (>= 0.3.2)
77
+ hashdiff (>= 0.4.0, < 2.0.0)
78
+
79
+ PLATFORMS
80
+ ruby
81
+
82
+ DEPENDENCIES
83
+ codecov (~> 0.2)
84
+ hithorizons!
85
+ rake (~> 13.0)
86
+ rspec (~> 3.6)
87
+ rubocop (~> 1.7)
88
+ rubocop-rspec (~> 1.42)
89
+ simplecov (~> 0.21)
90
+ webmock (~> 3.11.0)
91
+
92
+ BUNDLED WITH
93
+ 2.1.4
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Lubomir Vnenk
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,122 @@
1
+ [![Build Status](https://travis-ci.com/lubosch/exponea.svg?branch=master)](https://travis-ci.com/lubosch/exponea)
2
+ [![Coverage Status](https://codecov.io/gh/lubosch/exponea/branch/master/graph/badge.svg)](https://codecov.io/gh/lubosch/exponea)
3
+
4
+ # Hithorizons
5
+
6
+ Gem for integration with HitHorizons. Provider api integration for
7
+ company search and company detail.
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'hithorizons'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle install
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install hithorizons
24
+
25
+ ## Usage
26
+
27
+ ### Configure it with:
28
+
29
+ ```ruby
30
+ Hithorizons.configure do |config|
31
+ config.api_key = API_KEY
32
+ end
33
+ ```
34
+
35
+ ### Hithorizons::Company::Response
36
+
37
+ Is response object
38
+
39
+ `#success` - Boolean
40
+
41
+ `#error` - Error text if not success
42
+
43
+ `#result` - Result object
44
+
45
+ `#results` - Results array of objects
46
+
47
+ `#total_count` - Total results count for multiple results
48
+
49
+ `#results_count` - Current results count
50
+
51
+ ### Retrieve company detail
52
+
53
+ https://hithorizonsapim.portal.azure-api.net/docs/services/hithorizons-api/operations/get-company-get
54
+
55
+ ```ruby
56
+ Hithorizons::Company::Detail.get(hithorizon_id)
57
+ # => Hithorizons::Company::Response
58
+ ```
59
+
60
+ ### Search company
61
+
62
+ https://hithorizonsapim.portal.azure-api.net/docs/services/hithorizons-api/operations/get-company-search
63
+
64
+ ```ruby
65
+ Hithorizons::Company::Search.get(
66
+ duns_number: nil, company_name: nil, national_id: nil,
67
+ address_unstructured: nil, address_street: nil,
68
+ city: nil, state_province: nil, country: nil,
69
+ show_branches: nil, company_types: nil, max_results: nil
70
+ )
71
+ # => Hithorizons::Company::Response
72
+ ```
73
+
74
+ ### Search company unstructured / raw
75
+
76
+ https://hithorizonsapim.portal.azure-api.net/docs/services/hithorizons-api/operations/get-company-searchunstructured
77
+
78
+ ```ruby
79
+ Hithorizons::Company::SearchUnstructured.get(
80
+ ids: nil, name: nil, address: nil, show_branches: nil,
81
+ company_types: nil, max_results: nil
82
+ )
83
+ # => Hithorizons::Company::Response
84
+ ```
85
+
86
+ ### Helpers
87
+
88
+ ```ruby
89
+ Hithorizons::CompanyTypes.find_by_code('3')
90
+ # => corporation
91
+ ```
92
+
93
+ ```ruby
94
+ Hithorizons::IndustryTypes.find_by_code('D')
95
+ # => Manufacturing
96
+ ```
97
+
98
+ ```ruby
99
+ Hithorizons::Countries.find_by_iso3('SVK')
100
+ # => SLOVAKIA
101
+ Hithorizons::Countries.iso3_by_country('SLOVAKIA')
102
+ # => SVK
103
+ ```
104
+
105
+ ### Errors
106
+
107
+ `Hithorizons::Error` - If API throws an error (invalid credentials, ..)
108
+
109
+ ## Development
110
+
111
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
112
+
113
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
114
+
115
+ ## Contributing
116
+
117
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/hithorizons.
118
+
119
+
120
+ ## License
121
+
122
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'hithorizons'
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require 'irb'
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,16 @@
1
+ # Changelog
2
+
3
+ ## 0.1
4
+ Init
5
+
6
+ ## 0.2
7
+ Connect to APIs
8
+
9
+ ## 0.3
10
+ Response object
11
+
12
+ ## 0.3.1
13
+ Response object fix
14
+
15
+ ## 0.4
16
+ Helpers, readme
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/hithorizons/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'hithorizons'
7
+ spec.version = Hithorizons::VERSION
8
+ spec.authors = ['Lubomir Vnenk']
9
+ spec.email = ['lubomir.vnenk@zoho.com']
10
+
11
+ spec.summary = 'Horizonts api integration'
12
+ spec.description = 'Horizonts api integration for get, search and search unstructured'
13
+ spec.homepage = 'https://github.com/lubosch/hithorizons'
14
+ spec.license = 'MIT'
15
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.4.0')
16
+
17
+ spec.metadata['homepage_uri'] = spec.homepage
18
+ spec.metadata['source_code_uri'] = spec.homepage
19
+ spec.metadata['changelog_uri'] = 'https://github.com/lubosch/hithorizons/blob/master/changelog.md'
20
+
21
+ # Specify which files should be added to the gem when it is released.
22
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
24
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
+ end
26
+ spec.bindir = 'exe'
27
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
+ spec.require_paths = ['lib']
29
+
30
+ spec.add_dependency 'faraday', '~> 1'
31
+ spec.add_dependency 'faraday_middleware', '~> 1'
32
+
33
+ spec.add_development_dependency 'codecov', '~> 0.2'
34
+ spec.add_development_dependency 'rake', '~> 13.0'
35
+ spec.add_development_dependency 'rspec', '~> 3.6'
36
+ spec.add_development_dependency 'rubocop', '~> 1.7'
37
+ spec.add_development_dependency 'rubocop-rspec', '~> 1.42'
38
+ spec.add_development_dependency 'simplecov', '~> 0.21'
39
+ spec.add_development_dependency 'webmock', '~> 3.11.0'
40
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'faraday'
4
+ require 'faraday_middleware'
5
+
6
+ require 'hithorizons/version'
7
+ require 'hithorizons/configuration'
8
+ require 'hithorizons/company'
9
+ require 'hithorizons/countries'
10
+ require 'hithorizons/company_types'
11
+ require 'hithorizons/industry_types'
12
+
13
+ module Hithorizons
14
+ @configuration = Configuration.new
15
+
16
+ def self.config
17
+ @configuration
18
+ end
19
+
20
+ def self.configure
21
+ yield(@configuration)
22
+ end
23
+
24
+ class Error < StandardError
25
+ end
26
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'hithorizons/company/base_api'
4
+ require 'hithorizons/company/response'
5
+ require 'hithorizons/company/detail'
6
+ require 'hithorizons/company/search'
7
+ require 'hithorizons/company/search_unstructured'
8
+
9
+ module Hithorizons
10
+ module Company
11
+ end
12
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Hithorizons
4
+ module Company
5
+ class BaseApi
6
+ API_URL = '/Company'
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')
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Hithorizons
4
+ module Company
5
+ class Detail < BaseApi
6
+ def self.get(id)
7
+ process_request('/Get', 'GET', { HitHorizonsId: id })
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,37 @@
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
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Hithorizons
4
+ module Company
5
+ class Search < BaseApi
6
+ def self.get(duns_number: nil, company_name: nil, national_id: nil, address_unstructured: nil, address_street: nil,
7
+ city: nil, state_province: nil, country: nil, show_branches: nil, company_types: nil, max_results: nil)
8
+ payload = {
9
+ DUNSNumber: duns_number, CompanyName: company_name, NationalId: national_id, AddressUnstructured: address_unstructured,
10
+ AddressStreet: address_street, City: city, StateProvince: state_province, Country: country, ShowBranches: show_branches,
11
+ CompanyTypes: company_types, MaxResults: max_results
12
+ }
13
+ process_request('/Search', 'GET', payload.compact)
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Hithorizons
4
+ module Company
5
+ class SearchUnstructured < BaseApi
6
+ def self.get(ids: nil, name: nil, address: nil, show_branches: nil, company_types: nil, max_results: nil)
7
+ payload = {
8
+ Ids: ids, Name: name, Address: address, ShowBranches: show_branches,
9
+ CompanyTypes: company_types, MaxResults: max_results
10
+ }
11
+ process_request('/SearchUnstructured', 'GET', payload.compact)
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Hithorizons
4
+ class CompanyTypes
5
+ MAPPING = {
6
+ 3 => 'corporation',
7
+ 8 => 'joint venture',
8
+ 12 => 'partnership of unknown type',
9
+ 13 => 'proprietorship',
10
+ 50 => 'government body',
11
+ 100 => 'cooperative',
12
+ 101 => 'non profit organization',
13
+ 118 => 'local government body',
14
+ 120 => 'foreign company',
15
+ }.freeze
16
+
17
+ def self.find_by_code(code)
18
+ MAPPING[code.to_i] || 'Other'
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Hithorizons
4
+ class Configuration
5
+ attr_accessor :api_key, :api_url
6
+
7
+ def initialize
8
+ @api_key = ENV['HITHORIZONS_API_KEY']
9
+ @api_url = 'https://api.hithorizons.com'
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Hithorizons
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
63
+
64
+ def self.find_by_iso3(iso3)
65
+ MAPPING[iso3.upcase.to_sym] if iso3
66
+ end
67
+
68
+ def self.iso3_by_country(country)
69
+ MAPPING.invert[country]
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Hithorizons
4
+ class IndustryTypes
5
+ MAPPING = {
6
+ 'A' => 'Agriculture, Forestry, and Fishing',
7
+ 'B' => 'Mining',
8
+ 'C' => 'Construction',
9
+ 'D' => 'Manufacturing',
10
+ 'E' => 'Transportation, Communications, Electric, Gas, and Sanitary Services',
11
+ 'F' => 'Wholesale Trade',
12
+ 'G' => 'Retail Trade',
13
+ 'H' => 'Finance, Insurance, and Real Estate',
14
+ 'I' => 'Services',
15
+ 'J' => 'Public Sector',
16
+ 'Y' => 'Unknown industry',
17
+ }.freeze
18
+
19
+ def self.find_by_code(code)
20
+ MAPPING[code] || 'Other'
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Hithorizons
4
+ VERSION = '0.4'
5
+ end
metadata ADDED
@@ -0,0 +1,197 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hithorizons
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.4'
5
+ platform: ruby
6
+ authors:
7
+ - Lubomir Vnenk
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-01-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: faraday_middleware
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: codecov
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.2'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.2'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '13.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '13.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.6'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.6'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.7'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.7'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop-rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.42'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.42'
111
+ - !ruby/object:Gem::Dependency
112
+ name: simplecov
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0.21'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '0.21'
125
+ - !ruby/object:Gem::Dependency
126
+ name: webmock
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 3.11.0
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: 3.11.0
139
+ description: Horizonts api integration for get, search and search unstructured
140
+ email:
141
+ - lubomir.vnenk@zoho.com
142
+ executables: []
143
+ extensions: []
144
+ extra_rdoc_files: []
145
+ files:
146
+ - ".gitignore"
147
+ - ".rspec"
148
+ - ".rubocop.yml"
149
+ - ".travis.yml"
150
+ - Gemfile
151
+ - Gemfile.lock
152
+ - LICENSE.txt
153
+ - README.md
154
+ - Rakefile
155
+ - bin/console
156
+ - bin/setup
157
+ - changelog.md
158
+ - hithorizons.gemspec
159
+ - lib/hithorizons.rb
160
+ - lib/hithorizons/company.rb
161
+ - lib/hithorizons/company/base_api.rb
162
+ - lib/hithorizons/company/detail.rb
163
+ - lib/hithorizons/company/response.rb
164
+ - lib/hithorizons/company/search.rb
165
+ - lib/hithorizons/company/search_unstructured.rb
166
+ - lib/hithorizons/company_types.rb
167
+ - lib/hithorizons/configuration.rb
168
+ - lib/hithorizons/countries.rb
169
+ - lib/hithorizons/industry_types.rb
170
+ - lib/hithorizons/version.rb
171
+ homepage: https://github.com/lubosch/hithorizons
172
+ licenses:
173
+ - MIT
174
+ metadata:
175
+ homepage_uri: https://github.com/lubosch/hithorizons
176
+ source_code_uri: https://github.com/lubosch/hithorizons
177
+ changelog_uri: https://github.com/lubosch/hithorizons/blob/master/changelog.md
178
+ post_install_message:
179
+ rdoc_options: []
180
+ require_paths:
181
+ - lib
182
+ required_ruby_version: !ruby/object:Gem::Requirement
183
+ requirements:
184
+ - - ">="
185
+ - !ruby/object:Gem::Version
186
+ version: 2.4.0
187
+ required_rubygems_version: !ruby/object:Gem::Requirement
188
+ requirements:
189
+ - - ">="
190
+ - !ruby/object:Gem::Version
191
+ version: '0'
192
+ requirements: []
193
+ rubygems_version: 3.1.4
194
+ signing_key:
195
+ specification_version: 4
196
+ summary: Horizonts api integration
197
+ test_files: []