oneaccess 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +24 -0
  3. data/.rubocop.yml +11 -29
  4. data/.rubocop_todo.yml +50 -0
  5. data/Gemfile +1 -1
  6. data/Gemfile.lock +9 -5
  7. data/Rakefile +4 -4
  8. data/docker-compose.yml +0 -5
  9. data/lib/oneaccess.rb +25 -24
  10. data/lib/oneaccess/api/api_base.rb +9 -9
  11. data/lib/oneaccess/api/v1_1/base.rb +1 -1
  12. data/lib/oneaccess/api/v1_1/entitlement/model/user_requests.rb +62 -0
  13. data/lib/oneaccess/api/v1_1/entitlement/organization/product_group.rb +10 -8
  14. data/lib/oneaccess/api/v1_1/entitlement/research/user_requests.rb +17 -15
  15. data/lib/oneaccess/api/v1_1/entitlement/user/product_group.rb +10 -8
  16. data/lib/oneaccess/api/v1_1/entitlement/user_subscription.rb +5 -5
  17. data/lib/oneaccess/api/v1_1/organizations.rb +2 -2
  18. data/lib/oneaccess/api/v1_1/references.rb +9 -9
  19. data/lib/oneaccess/api/v1_1/research.rb +7 -5
  20. data/lib/oneaccess/api/v1_1/symbology.rb +10 -8
  21. data/lib/oneaccess/api/v1_1/user.rb +3 -3
  22. data/lib/oneaccess/api/v3_0/base.rb +1 -1
  23. data/lib/oneaccess/api/v3_0/interactions.rb +8 -8
  24. data/lib/oneaccess/api/v3_0/providers.rb +8 -10
  25. data/lib/oneaccess/api/v3_0/references.rb +11 -11
  26. data/lib/oneaccess/configuration.rb +6 -6
  27. data/lib/oneaccess/data_object/address.rb +1 -1
  28. data/lib/oneaccess/data_object/city.rb +1 -1
  29. data/lib/oneaccess/data_object/company.rb +1 -1
  30. data/lib/oneaccess/data_object/company_light.rb +1 -1
  31. data/lib/oneaccess/data_object/contributor.rb +1 -1
  32. data/lib/oneaccess/data_object/country.rb +1 -1
  33. data/lib/oneaccess/data_object/global_region.rb +1 -1
  34. data/lib/oneaccess/data_object/inducement.rb +1 -1
  35. data/lib/oneaccess/data_object/industry.rb +1 -1
  36. data/lib/oneaccess/data_object/investor.rb +1 -1
  37. data/lib/oneaccess/data_object/meta.rb +1 -1
  38. data/lib/oneaccess/data_object/organization.rb +1 -1
  39. data/lib/oneaccess/data_object/organization_light.rb +1 -1
  40. data/lib/oneaccess/data_object/product_group.rb +1 -1
  41. data/lib/oneaccess/data_object/providers_user_details.rb +1 -1
  42. data/lib/oneaccess/data_object/providers_user_details_vendor.rb +1 -1
  43. data/lib/oneaccess/data_object/providers_users_details.rb +1 -1
  44. data/lib/oneaccess/data_object/region.rb +1 -1
  45. data/lib/oneaccess/data_object/representer/address.rb +3 -3
  46. data/lib/oneaccess/data_object/representer/city.rb +2 -2
  47. data/lib/oneaccess/data_object/representer/company.rb +12 -6
  48. data/lib/oneaccess/data_object/representer/contributor.rb +2 -2
  49. data/lib/oneaccess/data_object/representer/country.rb +10 -6
  50. data/lib/oneaccess/data_object/representer/global_region.rb +2 -2
  51. data/lib/oneaccess/data_object/representer/inducement.rb +6 -2
  52. data/lib/oneaccess/data_object/representer/industry.rb +5 -3
  53. data/lib/oneaccess/data_object/representer/investor.rb +1 -1
  54. data/lib/oneaccess/data_object/representer/meta.rb +2 -2
  55. data/lib/oneaccess/data_object/representer/providers_user_details.rb +4 -3
  56. data/lib/oneaccess/data_object/representer/providers_users_details.rb +4 -3
  57. data/lib/oneaccess/data_object/representer/research_document_info.rb +5 -3
  58. data/lib/oneaccess/data_object/representer/user.rb +10 -6
  59. data/lib/oneaccess/data_object/representer/user_entitlement_request.rb +19 -11
  60. data/lib/oneaccess/data_object/research_document_info.rb +1 -1
  61. data/lib/oneaccess/data_object/saml_info.rb +1 -1
  62. data/lib/oneaccess/data_object/sell_side_user_group_entitlement.rb +1 -1
  63. data/lib/oneaccess/data_object/user.rb +1 -1
  64. data/lib/oneaccess/data_object/user_entitlement_request.rb +1 -1
  65. data/lib/oneaccess/data_object/user_light.rb +1 -1
  66. data/lib/oneaccess/error/api_error.rb +2 -2
  67. data/lib/oneaccess/http/http_client.rb +10 -12
  68. data/lib/oneaccess/request/contributors_request_handler.rb +2 -2
  69. data/lib/oneaccess/request/investors_request_handler.rb +2 -2
  70. data/lib/oneaccess/response/api_error.rb +1 -1
  71. data/lib/oneaccess/response/buy_side_interactions_response.rb +2 -2
  72. data/lib/oneaccess/response/changed_users_response.rb +2 -2
  73. data/lib/oneaccess/response/companies_response.rb +2 -2
  74. data/lib/oneaccess/response/company_response.rb +2 -2
  75. data/lib/oneaccess/response/contributors_response.rb +2 -2
  76. data/lib/oneaccess/response/countries_response.rb +2 -2
  77. data/lib/oneaccess/response/inducement_response.rb +2 -2
  78. data/lib/oneaccess/response/industries_response.rb +2 -2
  79. data/lib/oneaccess/response/investors_response.rb +2 -2
  80. data/lib/oneaccess/response/organization_response.rb +1 -1
  81. data/lib/oneaccess/response/paginated_response.rb +1 -1
  82. data/lib/oneaccess/response/product_groups_response.rb +2 -2
  83. data/lib/oneaccess/response/providers_users_details_response.rb +2 -2
  84. data/lib/oneaccess/response/representer/buy_side_interactions_response.rb +1 -1
  85. data/lib/oneaccess/response/representer/changed_users_response.rb +1 -1
  86. data/lib/oneaccess/response/representer/companies_response.rb +6 -5
  87. data/lib/oneaccess/response/representer/company_response.rb +7 -6
  88. data/lib/oneaccess/response/representer/contributors_response.rb +9 -7
  89. data/lib/oneaccess/response/representer/countries_response.rb +6 -5
  90. data/lib/oneaccess/response/representer/inducement_response.rb +7 -6
  91. data/lib/oneaccess/response/representer/industries_response.rb +6 -5
  92. data/lib/oneaccess/response/representer/investors_response.rb +8 -6
  93. data/lib/oneaccess/response/representer/organization_response.rb +2 -2
  94. data/lib/oneaccess/response/representer/paginated_response.rb +1 -1
  95. data/lib/oneaccess/response/representer/product_groups_response.rb +6 -5
  96. data/lib/oneaccess/response/representer/providers_users_details_response.rb +3 -3
  97. data/lib/oneaccess/response/representer/research_document_response.rb +6 -5
  98. data/lib/oneaccess/response/representer/subscribe_to_updates_response.rb +1 -1
  99. data/lib/oneaccess/response/representer/user_entitlement_requests_response.rb +6 -5
  100. data/lib/oneaccess/response/representer/user_requests_response.rb +1 -1
  101. data/lib/oneaccess/response/representer/user_response.rb +2 -2
  102. data/lib/oneaccess/response/research_document_response.rb +2 -2
  103. data/lib/oneaccess/response/subscribe_to_updates_response.rb +2 -2
  104. data/lib/oneaccess/response/user_entitlement_requests_response.rb +2 -2
  105. data/lib/oneaccess/response/user_requests_response.rb +2 -2
  106. data/lib/oneaccess/response/user_response.rb +2 -2
  107. data/oneaccess.gemspec +24 -24
  108. metadata +17 -15
  109. data/circle.yml +0 -9
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "./representer/user"
3
+ require_relative './representer/user'
4
4
 
5
5
  module ONEAccess
6
6
  module DataObject
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "./representer/user_entitlement_request"
3
+ require_relative './representer/user_entitlement_request'
4
4
 
5
5
  module ONEAccess
6
6
  module DataObject
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "./representer/user_light"
3
+ require_relative './representer/user_light'
4
4
 
5
5
  module ONEAccess
6
6
  module DataObject
@@ -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 = http_status_code
12
- @api_status_code = 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 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 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["Content-Type"] == "application/json"
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 :raise_error
52
+ faraday.response(:raise_error)
53
53
  faraday.adapter(detect_adapter)
54
54
  if Configuration.log_requests
55
- faraday.response :logger, Configuration.logger, bodies: true do |logger|
56
- logger.filter(/(Api-Key)([\s:"]*)(.+)(\"{1})/, "[REMOVED]")
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["Content-Type"] == "application/json"
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
- "X-One-Access-Api-Key" => Configuration.api_key,
92
- "Authorization" => "X-One-Access-Master-Api-Key #{Configuration.master_api_key}"
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 "../response/contributors_response"
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 "../response/investors_response"
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,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "./representer/api_error"
3
+ require_relative './representer/api_error'
4
4
 
5
5
  module ONEAccess
6
6
  module Response
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "./base_response"
4
- require_relative "./representer/buy_side_interactions_response"
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 "./base_response"
4
- require_relative "./representer/changed_users_response"
3
+ require_relative './base_response'
4
+ require_relative './representer/changed_users_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 "./paginated_response"
4
- require_relative "./representer/companies_response"
3
+ require_relative './paginated_response'
4
+ require_relative './representer/companies_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 "./base_response"
4
- require_relative "./representer/company_response"
3
+ require_relative './base_response'
4
+ require_relative './representer/company_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 "./base_response"
4
- require_relative "./representer/contributors_response"
3
+ require_relative './base_response'
4
+ require_relative './representer/contributors_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 "./paginated_response"
4
- require_relative "./representer/countries_response"
3
+ require_relative './paginated_response'
4
+ require_relative './representer/countries_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 "./base_response"
4
- require_relative "./representer/inducement_response"
3
+ require_relative './base_response'
4
+ require_relative './representer/inducement_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 "./paginated_response"
4
- require_relative "./representer/industries_response"
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 "./base_response"
4
- require_relative "./representer/investors_response"
3
+ require_relative './base_response'
4
+ require_relative './representer/investors_response'
5
5
 
6
6
  module ONEAccess
7
7
  module Response
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "./representer/organization_response"
3
+ require_relative './representer/organization_response'
4
4
 
5
5
  module ONEAccess
6
6
  module Response
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "./base_response"
3
+ require_relative './base_response'
4
4
 
5
5
  module ONEAccess
6
6
  module Response
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "./paginated_response"
4
- require_relative "./representer/product_groups_response"
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 "./collection_response"
4
- require_relative "./representer/providers_users_details_response"
3
+ require_relative './collection_response'
4
+ require_relative './representer/providers_users_details_response'
5
5
 
6
6
  module ONEAccess
7
7
  module Response
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "./base_response"
3
+ require_relative './base_response'
4
4
 
5
5
  module ONEAccess
6
6
  module Response
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "./base_response"
3
+ require_relative './base_response'
4
4
 
5
5
  module ONEAccess
6
6
  module Response
@@ -1,15 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "./paginated_response"
4
- require_relative "../../data_object/company_light"
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, as: :Data,
11
- decorator: DataObject::Representer::CompanyLight,
12
- class: DataObject::CompanyLight
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 "./base_response"
4
- require_relative "../../data_object/industry"
5
- require_relative "../../data_object/company"
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, as: :Data,
12
- decorator: DataObject::Representer::Company,
13
- class: DataObject::Company
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 "./base_response"
4
- require_relative "../../data_object/meta"
5
- require_relative "../../data_object/contributor"
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, decorator: DataObject::Representer::Meta,
14
- class: DataObject::Meta
15
- collection :data, decorator: DataObject::Representer::Contributor,
16
- class: DataObject::Contributor
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 "./paginated_response"
4
- require_relative "../../data_object/industry"
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, as: :Data,
11
- decorator: DataObject::Representer::Country,
12
- class: DataObject::Country
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 "./base_response"
4
- require_relative "../../data_object/inducement"
5
- require_relative "../../data_object/representer/inducement"
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, as: :EmailInducement,
12
- decorator: DataObject::Representer::Inducement,
13
- class: DataObject::Inducement
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 "./paginated_response"
4
- require_relative "../../data_object/industry"
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, as: :Data,
11
- decorator: DataObject::Representer::Industry,
12
- class: DataObject::Industry
10
+ collection :data,
11
+ as: :Data,
12
+ decorator: DataObject::Representer::Industry,
13
+ class: DataObject::Industry
13
14
  end
14
15
  end
15
16
  end