oneaccess 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.circleci/config.yml +24 -0
- data/.rubocop.yml +11 -29
- data/.rubocop_todo.yml +50 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +9 -5
- data/Rakefile +4 -4
- data/docker-compose.yml +0 -5
- data/lib/oneaccess.rb +25 -24
- data/lib/oneaccess/api/api_base.rb +9 -9
- data/lib/oneaccess/api/v1_1/base.rb +1 -1
- data/lib/oneaccess/api/v1_1/entitlement/model/user_requests.rb +62 -0
- data/lib/oneaccess/api/v1_1/entitlement/organization/product_group.rb +10 -8
- data/lib/oneaccess/api/v1_1/entitlement/research/user_requests.rb +17 -15
- data/lib/oneaccess/api/v1_1/entitlement/user/product_group.rb +10 -8
- data/lib/oneaccess/api/v1_1/entitlement/user_subscription.rb +5 -5
- data/lib/oneaccess/api/v1_1/organizations.rb +2 -2
- data/lib/oneaccess/api/v1_1/references.rb +9 -9
- data/lib/oneaccess/api/v1_1/research.rb +7 -5
- data/lib/oneaccess/api/v1_1/symbology.rb +10 -8
- data/lib/oneaccess/api/v1_1/user.rb +3 -3
- data/lib/oneaccess/api/v3_0/base.rb +1 -1
- data/lib/oneaccess/api/v3_0/interactions.rb +8 -8
- data/lib/oneaccess/api/v3_0/providers.rb +8 -10
- data/lib/oneaccess/api/v3_0/references.rb +11 -11
- data/lib/oneaccess/configuration.rb +6 -6
- data/lib/oneaccess/data_object/address.rb +1 -1
- data/lib/oneaccess/data_object/city.rb +1 -1
- data/lib/oneaccess/data_object/company.rb +1 -1
- data/lib/oneaccess/data_object/company_light.rb +1 -1
- data/lib/oneaccess/data_object/contributor.rb +1 -1
- data/lib/oneaccess/data_object/country.rb +1 -1
- data/lib/oneaccess/data_object/global_region.rb +1 -1
- data/lib/oneaccess/data_object/inducement.rb +1 -1
- data/lib/oneaccess/data_object/industry.rb +1 -1
- data/lib/oneaccess/data_object/investor.rb +1 -1
- data/lib/oneaccess/data_object/meta.rb +1 -1
- data/lib/oneaccess/data_object/organization.rb +1 -1
- data/lib/oneaccess/data_object/organization_light.rb +1 -1
- data/lib/oneaccess/data_object/product_group.rb +1 -1
- data/lib/oneaccess/data_object/providers_user_details.rb +1 -1
- data/lib/oneaccess/data_object/providers_user_details_vendor.rb +1 -1
- data/lib/oneaccess/data_object/providers_users_details.rb +1 -1
- data/lib/oneaccess/data_object/region.rb +1 -1
- data/lib/oneaccess/data_object/representer/address.rb +3 -3
- data/lib/oneaccess/data_object/representer/city.rb +2 -2
- data/lib/oneaccess/data_object/representer/company.rb +12 -6
- data/lib/oneaccess/data_object/representer/contributor.rb +2 -2
- data/lib/oneaccess/data_object/representer/country.rb +10 -6
- data/lib/oneaccess/data_object/representer/global_region.rb +2 -2
- data/lib/oneaccess/data_object/representer/inducement.rb +6 -2
- data/lib/oneaccess/data_object/representer/industry.rb +5 -3
- data/lib/oneaccess/data_object/representer/investor.rb +1 -1
- data/lib/oneaccess/data_object/representer/meta.rb +2 -2
- data/lib/oneaccess/data_object/representer/providers_user_details.rb +4 -3
- data/lib/oneaccess/data_object/representer/providers_users_details.rb +4 -3
- data/lib/oneaccess/data_object/representer/research_document_info.rb +5 -3
- data/lib/oneaccess/data_object/representer/user.rb +10 -6
- data/lib/oneaccess/data_object/representer/user_entitlement_request.rb +19 -11
- data/lib/oneaccess/data_object/research_document_info.rb +1 -1
- data/lib/oneaccess/data_object/saml_info.rb +1 -1
- data/lib/oneaccess/data_object/sell_side_user_group_entitlement.rb +1 -1
- data/lib/oneaccess/data_object/user.rb +1 -1
- data/lib/oneaccess/data_object/user_entitlement_request.rb +1 -1
- data/lib/oneaccess/data_object/user_light.rb +1 -1
- data/lib/oneaccess/error/api_error.rb +2 -2
- data/lib/oneaccess/http/http_client.rb +10 -12
- data/lib/oneaccess/request/contributors_request_handler.rb +2 -2
- data/lib/oneaccess/request/investors_request_handler.rb +2 -2
- data/lib/oneaccess/response/api_error.rb +1 -1
- data/lib/oneaccess/response/buy_side_interactions_response.rb +2 -2
- data/lib/oneaccess/response/changed_users_response.rb +2 -2
- data/lib/oneaccess/response/companies_response.rb +2 -2
- data/lib/oneaccess/response/company_response.rb +2 -2
- data/lib/oneaccess/response/contributors_response.rb +2 -2
- data/lib/oneaccess/response/countries_response.rb +2 -2
- data/lib/oneaccess/response/inducement_response.rb +2 -2
- data/lib/oneaccess/response/industries_response.rb +2 -2
- data/lib/oneaccess/response/investors_response.rb +2 -2
- data/lib/oneaccess/response/organization_response.rb +1 -1
- data/lib/oneaccess/response/paginated_response.rb +1 -1
- data/lib/oneaccess/response/product_groups_response.rb +2 -2
- data/lib/oneaccess/response/providers_users_details_response.rb +2 -2
- data/lib/oneaccess/response/representer/buy_side_interactions_response.rb +1 -1
- data/lib/oneaccess/response/representer/changed_users_response.rb +1 -1
- data/lib/oneaccess/response/representer/companies_response.rb +6 -5
- data/lib/oneaccess/response/representer/company_response.rb +7 -6
- data/lib/oneaccess/response/representer/contributors_response.rb +9 -7
- data/lib/oneaccess/response/representer/countries_response.rb +6 -5
- data/lib/oneaccess/response/representer/inducement_response.rb +7 -6
- data/lib/oneaccess/response/representer/industries_response.rb +6 -5
- data/lib/oneaccess/response/representer/investors_response.rb +8 -6
- data/lib/oneaccess/response/representer/organization_response.rb +2 -2
- data/lib/oneaccess/response/representer/paginated_response.rb +1 -1
- data/lib/oneaccess/response/representer/product_groups_response.rb +6 -5
- data/lib/oneaccess/response/representer/providers_users_details_response.rb +3 -3
- data/lib/oneaccess/response/representer/research_document_response.rb +6 -5
- data/lib/oneaccess/response/representer/subscribe_to_updates_response.rb +1 -1
- data/lib/oneaccess/response/representer/user_entitlement_requests_response.rb +6 -5
- data/lib/oneaccess/response/representer/user_requests_response.rb +1 -1
- data/lib/oneaccess/response/representer/user_response.rb +2 -2
- data/lib/oneaccess/response/research_document_response.rb +2 -2
- data/lib/oneaccess/response/subscribe_to_updates_response.rb +2 -2
- data/lib/oneaccess/response/user_entitlement_requests_response.rb +2 -2
- data/lib/oneaccess/response/user_requests_response.rb +2 -2
- data/lib/oneaccess/response/user_response.rb +2 -2
- data/oneaccess.gemspec +24 -24
- metadata +17 -15
- data/circle.yml +0 -9
@@ -8,8 +8,8 @@ module ONEAccess
|
|
8
8
|
attr_reader :api_status_message
|
9
9
|
|
10
10
|
def initialize(http_status_code, api_status_code, api_status_message)
|
11
|
-
@http_status_code
|
12
|
-
@api_status_code
|
11
|
+
@http_status_code = http_status_code
|
12
|
+
@api_status_code = api_status_code
|
13
13
|
@api_status_message = api_status_message
|
14
14
|
super(api_status_message)
|
15
15
|
end
|
@@ -8,7 +8,7 @@ module ONEAccess
|
|
8
8
|
|
9
9
|
def get(url, params = {}, headers = {})
|
10
10
|
response = connection.get do |request|
|
11
|
-
request.url
|
11
|
+
request.url(url)
|
12
12
|
request.params.merge!(params)
|
13
13
|
request.headers.merge!(headers)
|
14
14
|
end
|
@@ -21,7 +21,7 @@ module ONEAccess
|
|
21
21
|
|
22
22
|
def post(url, body, headers = {})
|
23
23
|
response = connection.post do |request|
|
24
|
-
request.url
|
24
|
+
request.url(url)
|
25
25
|
request.headers.merge!(headers)
|
26
26
|
request.body = body.to_json
|
27
27
|
end
|
@@ -36,7 +36,7 @@ module ONEAccess
|
|
36
36
|
|
37
37
|
def handle_response(response)
|
38
38
|
# make sure we have a valid JSON in the response
|
39
|
-
if response.headers[
|
39
|
+
if response.headers['Content-Type'] == 'application/json'
|
40
40
|
begin
|
41
41
|
MultiJson.load(response.body)
|
42
42
|
rescue MultiJson::ParseError
|
@@ -49,11 +49,11 @@ module ONEAccess
|
|
49
49
|
def connection
|
50
50
|
parameters = { url: Configuration.base_url, headers: auth_headers, request: { timeout: DEFAULT_TIMEOUT } }
|
51
51
|
Faraday.new(parameters) do |faraday|
|
52
|
-
faraday.response
|
52
|
+
faraday.response(:raise_error)
|
53
53
|
faraday.adapter(detect_adapter)
|
54
54
|
if Configuration.log_requests
|
55
|
-
faraday.response
|
56
|
-
logger.filter(/(Api-Key)([\s:"]*)(.+)(\"{1})/,
|
55
|
+
faraday.response(:logger, Configuration.logger, bodies: true) do |logger|
|
56
|
+
logger.filter(/(Api-Key)([\s:"]*)(.+)(\"{1})/, '[REMOVED]')
|
57
57
|
end
|
58
58
|
end
|
59
59
|
end
|
@@ -67,7 +67,7 @@ module ONEAccess
|
|
67
67
|
status = error.response[:status]
|
68
68
|
body = error.response[:body]
|
69
69
|
headers = error.response[:headers]
|
70
|
-
if headers[
|
70
|
+
if headers['Content-Type'] == 'application/json'
|
71
71
|
handle_json_error(body, status)
|
72
72
|
else
|
73
73
|
Error::APIError.new(status, status, "API Response body:'#{body}'")
|
@@ -80,7 +80,7 @@ module ONEAccess
|
|
80
80
|
Error::APIError.new(
|
81
81
|
status,
|
82
82
|
api_error_data.api_status_code,
|
83
|
-
api_error_data.api_status_message
|
83
|
+
api_error_data.api_status_message,
|
84
84
|
)
|
85
85
|
rescue MultiJson::ParseError
|
86
86
|
Error::APIError.new(500, 500, "Invalid JSON:'#{body}'")
|
@@ -88,14 +88,13 @@ module ONEAccess
|
|
88
88
|
|
89
89
|
def auth_headers
|
90
90
|
{
|
91
|
-
|
92
|
-
|
91
|
+
'X-One-Access-Api-Key' => Configuration.api_key,
|
92
|
+
'Authorization' => "X-One-Access-Master-Api-Key #{Configuration.master_api_key}",
|
93
93
|
}
|
94
94
|
end
|
95
95
|
|
96
96
|
# Auto-detect the best adapter (HTTP "driver") available, based on libraries
|
97
97
|
# loaded by the user, preferring those with persistent connections ("keep-alive") by default
|
98
|
-
# rubocop:disable Metrics/MethodLength
|
99
98
|
def detect_adapter
|
100
99
|
if defined?(::Patron)
|
101
100
|
:patron
|
@@ -109,7 +108,6 @@ module ONEAccess
|
|
109
108
|
::Faraday.default_adapter
|
110
109
|
end
|
111
110
|
end
|
112
|
-
# rubocop:enable Metrics/MethodLength
|
113
111
|
end
|
114
112
|
end
|
115
113
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
3
|
+
require_relative '../response/contributors_response'
|
4
4
|
|
5
5
|
module ONEAccess
|
6
6
|
module Request
|
@@ -33,7 +33,7 @@ module ONEAccess
|
|
33
33
|
def build_params(offset)
|
34
34
|
{
|
35
35
|
limit: limit,
|
36
|
-
offset: offset
|
36
|
+
offset: offset,
|
37
37
|
}
|
38
38
|
end
|
39
39
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
3
|
+
require_relative '../response/investors_response'
|
4
4
|
|
5
5
|
module ONEAccess
|
6
6
|
module Request
|
@@ -33,7 +33,7 @@ module ONEAccess
|
|
33
33
|
def build_params(offset)
|
34
34
|
{
|
35
35
|
limit: limit,
|
36
|
-
offset: offset
|
36
|
+
offset: offset,
|
37
37
|
}
|
38
38
|
end
|
39
39
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
4
|
-
require_relative
|
3
|
+
require_relative './base_response'
|
4
|
+
require_relative './representer/buy_side_interactions_response'
|
5
5
|
|
6
6
|
module ONEAccess
|
7
7
|
module Response
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
4
|
-
require_relative
|
3
|
+
require_relative './paginated_response'
|
4
|
+
require_relative './representer/industries_response'
|
5
5
|
|
6
6
|
module ONEAccess
|
7
7
|
module Response
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
4
|
-
require_relative
|
3
|
+
require_relative './paginated_response'
|
4
|
+
require_relative './representer/product_groups_response'
|
5
5
|
|
6
6
|
module ONEAccess
|
7
7
|
module Response
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
4
|
-
require_relative
|
3
|
+
require_relative './collection_response'
|
4
|
+
require_relative './representer/providers_users_details_response'
|
5
5
|
|
6
6
|
module ONEAccess
|
7
7
|
module Response
|
@@ -1,15 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
4
|
-
require_relative
|
3
|
+
require_relative './paginated_response'
|
4
|
+
require_relative '../../data_object/company_light'
|
5
5
|
|
6
6
|
module ONEAccess
|
7
7
|
module Response
|
8
8
|
module Representer
|
9
9
|
class CompaniesResponse < PaginatedResponse
|
10
|
-
collection :data,
|
11
|
-
|
12
|
-
|
10
|
+
collection :data,
|
11
|
+
as: :Data,
|
12
|
+
decorator: DataObject::Representer::CompanyLight,
|
13
|
+
class: DataObject::CompanyLight
|
13
14
|
end
|
14
15
|
end
|
15
16
|
end
|
@@ -1,16 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
4
|
-
require_relative
|
5
|
-
require_relative
|
3
|
+
require_relative './base_response'
|
4
|
+
require_relative '../../data_object/industry'
|
5
|
+
require_relative '../../data_object/company'
|
6
6
|
|
7
7
|
module ONEAccess
|
8
8
|
module Response
|
9
9
|
module Representer
|
10
10
|
class CompanyResponse < BaseResponse
|
11
|
-
property :data,
|
12
|
-
|
13
|
-
|
11
|
+
property :data,
|
12
|
+
as: :Data,
|
13
|
+
decorator: DataObject::Representer::Company,
|
14
|
+
class: DataObject::Company
|
14
15
|
end
|
15
16
|
end
|
16
17
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
4
|
-
require_relative
|
5
|
-
require_relative
|
3
|
+
require_relative './base_response'
|
4
|
+
require_relative '../../data_object/meta'
|
5
|
+
require_relative '../../data_object/contributor'
|
6
6
|
|
7
7
|
module ONEAccess
|
8
8
|
module Response
|
@@ -10,10 +10,12 @@ module ONEAccess
|
|
10
10
|
class ContributorsResponse < Representable::Decorator
|
11
11
|
include Representable::JSON
|
12
12
|
|
13
|
-
property :meta,
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
property :meta,
|
14
|
+
decorator: DataObject::Representer::Meta,
|
15
|
+
class: DataObject::Meta
|
16
|
+
collection :data,
|
17
|
+
decorator: DataObject::Representer::Contributor,
|
18
|
+
class: DataObject::Contributor
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
@@ -1,15 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
4
|
-
require_relative
|
3
|
+
require_relative './paginated_response'
|
4
|
+
require_relative '../../data_object/industry'
|
5
5
|
|
6
6
|
module ONEAccess
|
7
7
|
module Response
|
8
8
|
module Representer
|
9
9
|
class CountriesResponse < PaginatedResponse
|
10
|
-
collection :data,
|
11
|
-
|
12
|
-
|
10
|
+
collection :data,
|
11
|
+
as: :Data,
|
12
|
+
decorator: DataObject::Representer::Country,
|
13
|
+
class: DataObject::Country
|
13
14
|
end
|
14
15
|
end
|
15
16
|
end
|
@@ -1,16 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
4
|
-
require_relative
|
5
|
-
require_relative
|
3
|
+
require_relative './base_response'
|
4
|
+
require_relative '../../data_object/inducement'
|
5
|
+
require_relative '../../data_object/representer/inducement'
|
6
6
|
|
7
7
|
module ONEAccess
|
8
8
|
module Response
|
9
9
|
module Representer
|
10
10
|
class InducementResponse < BaseResponse
|
11
|
-
property :email_inducement,
|
12
|
-
|
13
|
-
|
11
|
+
property :email_inducement,
|
12
|
+
as: :EmailInducement,
|
13
|
+
decorator: DataObject::Representer::Inducement,
|
14
|
+
class: DataObject::Inducement
|
14
15
|
property :message, as: :Message
|
15
16
|
end
|
16
17
|
end
|
@@ -1,15 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
4
|
-
require_relative
|
3
|
+
require_relative './paginated_response'
|
4
|
+
require_relative '../../data_object/industry'
|
5
5
|
|
6
6
|
module ONEAccess
|
7
7
|
module Response
|
8
8
|
module Representer
|
9
9
|
class IndustriesResponse < PaginatedResponse
|
10
|
-
collection :data,
|
11
|
-
|
12
|
-
|
10
|
+
collection :data,
|
11
|
+
as: :Data,
|
12
|
+
decorator: DataObject::Representer::Industry,
|
13
|
+
class: DataObject::Industry
|
13
14
|
end
|
14
15
|
end
|
15
16
|
end
|