oneaccess 0.1.9 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +38 -22
  3. data/lib/oneaccess.rb +17 -10
  4. data/lib/oneaccess/api/api_base.rb +51 -0
  5. data/lib/oneaccess/api/v1_1/base.rb +19 -0
  6. data/lib/oneaccess/api/v1_1/entitlement/organization/product_group.rb +26 -0
  7. data/lib/oneaccess/api/v1_1/entitlement/research/user_requests.rb +60 -0
  8. data/lib/oneaccess/api/v1_1/entitlement/user/product_group.rb +26 -0
  9. data/lib/oneaccess/api/v1_1/entitlement/user_subscription.rb +29 -0
  10. data/lib/oneaccess/api/v1_1/organizations.rb +18 -0
  11. data/lib/oneaccess/api/v1_1/references.rb +45 -0
  12. data/lib/oneaccess/api/v1_1/research.rb +23 -0
  13. data/lib/oneaccess/api/v1_1/symbology.rb +28 -0
  14. data/lib/oneaccess/api/v1_1/user.rb +17 -0
  15. data/lib/oneaccess/api/v3_0/base.rb +19 -0
  16. data/lib/oneaccess/api/v3_0/references.rb +32 -0
  17. data/lib/oneaccess/configuration.rb +6 -3
  18. data/lib/oneaccess/data_object/contributor.rb +20 -0
  19. data/lib/oneaccess/data_object/meta.rb +16 -0
  20. data/lib/oneaccess/data_object/representer/contributor.rb +16 -0
  21. data/lib/oneaccess/data_object/representer/meta.rb +15 -0
  22. data/lib/oneaccess/http/http_client.rb +36 -0
  23. data/lib/oneaccess/request/contributors_request_handler.rb +45 -0
  24. data/lib/oneaccess/response/contributors_response.rb +16 -0
  25. data/lib/oneaccess/response/representer/contributors_response.rb +20 -0
  26. data/oneaccess.gemspec +2 -2
  27. metadata +23 -12
  28. data/lib/oneaccess/api/base.rb +0 -64
  29. data/lib/oneaccess/api/entitlement/organization/product_group.rb +0 -24
  30. data/lib/oneaccess/api/entitlement/research/user_requests.rb +0 -58
  31. data/lib/oneaccess/api/entitlement/user/product_group.rb +0 -24
  32. data/lib/oneaccess/api/entitlement/user_subscription.rb +0 -27
  33. data/lib/oneaccess/api/organizations.rb +0 -16
  34. data/lib/oneaccess/api/references.rb +0 -42
  35. data/lib/oneaccess/api/research.rb +0 -21
  36. data/lib/oneaccess/api/symbology.rb +0 -26
  37. data/lib/oneaccess/api/user.rb +0 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9345968033df9754320ae59b779ee0a12fa1da66
4
- data.tar.gz: 87cd0f91f5de14cf0c3774fa514187a1f3fd0c25
3
+ metadata.gz: 836845ecbb1939336288daf6be66a83ca10c80a1
4
+ data.tar.gz: 16607132135ce2ea5cde2abc5cf5b0ef19c15f26
5
5
  SHA512:
6
- metadata.gz: 6164fd7a024bd81e6963bd82b9e9808c0cc67a38098cea3e6f45c4f175a4c511b742e274f6bf6524fd1d37eac1a3179f957b05b79df3b0c7f9326c663bd15a41
7
- data.tar.gz: a4b9c4f1a6c9a336eb03c2d832f0aefb8974fe2352d1ce1511bf4d7e66cd6bfe410b466438aac8d0f8bf5713aaee686a97f36ba788edaf7f6323743ee77a9684
6
+ metadata.gz: 49d3e9169e15f060e8954cbcd5c031382fdf00c31dd1a965ed9219e9b4e4771c6a18f6b2441d538edfef593414f05586956df54394844c00c66935949508bdb6
7
+ data.tar.gz: 77555cb7e8a18d7db375b4b5d31b6eae4a23283360fb76e3da4c95b443a84bbf23dff11cb3b876803f7d7df896a34659360024ac1354cdd4b6eb7cc8d2e2cf1c
data/README.md CHANGED
@@ -4,7 +4,7 @@ This is a ruby gem that wraps the ONEAccess API in an easy to use ruby library,
4
4
  The full documentation about the ONEAccess API can be found at:
5
5
  http://apidocs.oneaccess.io/docs
6
6
 
7
- Currently, only the version `v1.1` is supported by this gem.
7
+ Currently, only the version `v1.1` and `v3.0` are supported by this gem.
8
8
 
9
9
  ## Installation & Setup
10
10
  Install the gem directly:
@@ -51,9 +51,9 @@ This method returns a `User` object if it matches the first name, last name, and
51
51
 
52
52
  #### How to use:
53
53
  ```ruby
54
- resp = ONEAccess::API::User.getByEmail(first_name: 'Alex', last_name: 'Santos', email: 'alex@ae.com')
54
+ resp = ONEAccess::API::V1_1::User.getByEmail(first_name: 'Alex', last_name: 'Santos', email: 'alex@ae.com')
55
55
 
56
- resp.data #=> instance of ONEAcess::DataObject::User
56
+ resp.data #=> instance of ONEAccess::DataObject::User
57
57
  resp.data.id #=> 305 (id of the user)
58
58
  resp.data.organization.id #=> 805 (id of the company)
59
59
  resp.data.email #=> alex@ae.com
@@ -67,9 +67,9 @@ This method retrieves a research document by providing the research ID and the f
67
67
  #### How to use:
68
68
  ```ruby
69
69
  begin
70
- resp = ONEAccess::API::Research.document(document_id: 2341, first_name: 'Alex', last_name: 'Santos', email: 'alex@ae.com')
70
+ resp = ONEAccess::API::V1_1::Research.document(document_id: 2341, first_name: 'Alex', last_name: 'Santos', email: 'alex@ae.com')
71
71
 
72
- resp.data #=> instance of ONEAcess::DataObject::ResearchDocumentInfo
72
+ resp.data #=> instance of ONEAccess::DataObject::ResearchDocumentInfo
73
73
  resp.data.url #=> url of the document
74
74
  resp.data.title #=> document's title
75
75
  resp.data.saml #=> instance of ONEAccess::DataObject::SAMLInfo
@@ -91,9 +91,9 @@ Similar to the previous method, this method retrieves a research document by pro
91
91
  #### How to use:
92
92
  ```ruby
93
93
  begin
94
- resp = ONEAccess::API::Research.document_by_user_id(document_id: 2341, user_id: 805)
94
+ resp = ONEAccess::API::V1_1::Research.document_by_user_id(document_id: 2341, user_id: 805)
95
95
 
96
- resp.data #=> instance of ONEAcess::DataObject::ResearchDocumentInfo
96
+ resp.data #=> instance of ONEAccess::DataObject::ResearchDocumentInfo
97
97
  resp.data.url #=> url of the document
98
98
  resp.data.title #=> document's title
99
99
  resp.data.saml #=> instance of ONEAccess::DataObject::SAMLInfo
@@ -114,10 +114,10 @@ This method retrieves a list of symbology companies by providing a `IsPrivate`,
114
114
 
115
115
  #### How to use:
116
116
  ```ruby
117
- resp = ONEAccess::API::Symbology.companies(is_private: false, page_number: 0, page_size: 20)
117
+ resp = ONEAccess::API::V1_1::Symbology.companies(is_private: false, page_number: 0, page_size: 20)
118
118
 
119
- resp #=> instance of ONEAcess::Response::CompaniesResponse
120
- resp.data #=> instance of Array containing ONEAcess::DataObject::CompanyLight
119
+ resp #=> instance of ONEAccess::Response::CompaniesResponse
120
+ resp.data #=> instance of Array containing ONEAccess::DataObject::CompanyLight
121
121
 
122
122
  end
123
123
  ```
@@ -129,10 +129,10 @@ This method retrieves a company by providing an `Id`.
129
129
 
130
130
  #### How to use:
131
131
  ```ruby
132
- resp = ONEAccess::API::Symbology.company(id: 1)
132
+ resp = ONEAccess::API::V1_1::Symbology.company(id: 1)
133
133
 
134
- resp #=> instance of ONEAcess::Response::CompanyResponse
135
- resp.data #=> instance of Array containing ONEAcess::DataObject::Company
134
+ resp #=> instance of ONEAccess::Response::CompanyResponse
135
+ resp.data #=> instance of Array containing ONEAccess::DataObject::Company
136
136
 
137
137
  end
138
138
  ```
@@ -144,9 +144,9 @@ This method returns an Organization by providing the Organization ID.
144
144
 
145
145
  #### How to use:
146
146
  ```ruby
147
- resp = ONEAccess::API::Organizations.get_organization(id: 123)
147
+ resp = ONEAccess::API::V1_1::Organizations.get_organization(id: 123)
148
148
 
149
- resp.data #=> instance of ONEAcess::DataObject::Organization
149
+ resp.data #=> instance of ONEAccess::DataObject::Organization
150
150
  resp.data.id #=> id of the Organization
151
151
  resp.data.name #=> name of the Organization
152
152
  resp.data.short_name #=> Short Name of the Organization
@@ -167,7 +167,7 @@ Creates a new Research Entitlement Request for the given User.
167
167
  #### How to use
168
168
  ```ruby
169
169
  begin
170
- resp = ONEAccess::API::Entitlement::Research::UserRequests.create(user_id:'123', sell_side_org_id:'456',
170
+ resp = ONEAccess::API::V1_1::Entitlement::Research::UserRequests.create(user_id:'123', sell_side_org_id:'456',
171
171
  sales_contact_first_name:'John', sales_contact_last_name:'Doe', sales_contact_email:'john.doe@example.com')
172
172
 
173
173
  resp.data #=> ID of the new Request
@@ -184,9 +184,9 @@ This method returns a list of user entitlement requests based on the specified `
184
184
  #### How to use:
185
185
  ```ruby
186
186
  begin
187
- resp = ONEAccess::API::Entitlement::Research::UserRequests.get_list
187
+ resp = ONEAccess::API::V1_1::Entitlement::Research::UserRequests.get_list
188
188
 
189
- resp.data #=> Array of instances of ONEAcess::DataObject::UserEntitlementRequest
189
+ resp.data #=> Array of instances of ONEAccess::DataObject::UserEntitlementRequest
190
190
  rescue ONEAccess::Error::APIError => e
191
191
  puts "Error listing the available user entitlement requests"
192
192
  end
@@ -201,9 +201,9 @@ to receive updates from. Returns the API Status Code as the result of the subscr
201
201
  #### How to use:
202
202
  ```ruby
203
203
  begin
204
- resp = ONEAccess::API::Entitlement::UserSubscription.subscribe(user_ids: [<user_ids>])
204
+ resp = ONEAccess::API::V1_1::Entitlement::UserSubscription.subscribe(user_ids: [<user_ids>])
205
205
 
206
- resp #=> instance of ONEAcess::Response::SubscribeToUpdatesResponse
206
+ resp #=> instance of ONEAccess::Response::SubscribeToUpdatesResponse
207
207
  rescue ONEAccess::Error::APIError => e
208
208
  puts "Error subscribing users for entitlements updates"
209
209
  end
@@ -223,10 +223,26 @@ Use UTC time zone for date parameter.
223
223
  #### How to use:
224
224
  ```ruby
225
225
  begin
226
- resp = ONEAccess::API::Entitlement::UserSubscription.changed_users(from_date: <utc_string_date>)
226
+ resp = ONEAccess::API::V1_1::Entitlement::UserSubscription.changed_users(from_date: <utc_string_date>)
227
227
 
228
- resp #=> instance of ONEAcess::Response::ChangedUsersResponse
228
+ resp #=> instance of ONEAccess::Response::ChangedUsersResponse
229
229
  rescue ONEAccess::Error::APIError => e
230
230
  puts "Error getting the list of user ids which entitlements have changed"
231
231
  end
232
232
  ```
233
+
234
+ ### Get Contributors _(/references/contributors)_
235
+ Official Documentation: http://apidocs.oneaccess.io/v2.0/docs/referencescontributors
236
+
237
+ Reference endpoint to help retrieve contributor IDs from names.
238
+
239
+ #### How to use:
240
+ ```ruby
241
+ begin
242
+ resp = ONEAccess::API::V3_0::References.contributors(contributor_names: [<names>], limit: <limit>, offset: <offset>)
243
+
244
+ resp #=> instance of ONEAccess::Response::ContributorsResponse
245
+ rescue ONEAccess::Error::APIError => e
246
+ puts "Error getting the list of contributors"
247
+ end
248
+ ```
data/lib/oneaccess.rb CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  require "representable"
4
4
 
5
+ require_relative "./oneaccess/http/http_client"
6
+
5
7
  require_relative "./oneaccess/configuration"
6
8
  require_relative "./oneaccess/serializable"
7
9
 
@@ -10,16 +12,21 @@ require_relative "./oneaccess/enum/product_type"
10
12
  require_relative "./oneaccess/enum/product_group_status"
11
13
  require_relative "./oneaccess/enum/entitlement_status"
12
14
 
13
- require_relative "./oneaccess/api/base"
14
- require_relative "./oneaccess/api/user"
15
- require_relative "./oneaccess/api/research"
16
- require_relative "./oneaccess/api/organizations"
17
- require_relative "./oneaccess/api/symbology"
18
- require_relative "./oneaccess/api/references"
19
- require_relative "./oneaccess/api/entitlement/user_subscription"
20
- require_relative "./oneaccess/api/entitlement/organization/product_group"
21
- require_relative "./oneaccess/api/entitlement/user/product_group"
22
- require_relative "./oneaccess/api/entitlement/research/user_requests"
15
+ require_relative "./oneaccess/api/api_base"
16
+
17
+ require_relative "./oneaccess/api/v1_1/base"
18
+ require_relative "./oneaccess/api/v1_1/user"
19
+ require_relative "./oneaccess/api/v1_1/research"
20
+ require_relative "./oneaccess/api/v1_1/organizations"
21
+ require_relative "./oneaccess/api/v1_1/symbology"
22
+ require_relative "./oneaccess/api/v1_1/references"
23
+ require_relative "./oneaccess/api/v1_1/entitlement/user_subscription"
24
+ require_relative "./oneaccess/api/v1_1/entitlement/organization/product_group"
25
+ require_relative "./oneaccess/api/v1_1/entitlement/user/product_group"
26
+ require_relative "./oneaccess/api/v1_1/entitlement/research/user_requests"
27
+
28
+ require_relative "./oneaccess/api/v3_0/base"
29
+ require_relative "./oneaccess/api/v3_0/references"
23
30
 
24
31
  module ONEAccess
25
32
  def self.configure
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rest-client"
4
+ require "json"
5
+ require_relative "../response/api_error"
6
+ require_relative "../error/api_error"
7
+
8
+ module ONEAccess
9
+ module API
10
+ class ApiBase
11
+ class << self
12
+ def send_get(method, params = {})
13
+ Http::HttpClient.get(api_url(method), params)
14
+ end
15
+
16
+ def send_post(method, body)
17
+ Http::HttpClient.post(api_url(method), body, content_type: :json)
18
+ end
19
+
20
+ def resource_api_path
21
+ const_get("RESOURCE_API_PATH")
22
+ rescue StandardError
23
+ nil
24
+ end
25
+
26
+ def api_url(method = nil)
27
+ url = "#{base_url}#{resource_api_path}"
28
+ return url if method.nil?
29
+ "#{url}/#{method}"
30
+ end
31
+
32
+ protected
33
+
34
+ def api_path(path)
35
+ raise "API path has already been set" if resource_api_path
36
+ self.resource_api_path = path
37
+ end
38
+
39
+ private
40
+
41
+ def base_url
42
+ raise "base_url must be implemented"
43
+ end
44
+
45
+ def resource_api_path=(path)
46
+ const_set("RESOURCE_API_PATH", path)
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../api_base"
4
+
5
+ module ONEAccess
6
+ module API
7
+ module V1_1 # rubocop:disable Style/ClassAndModuleCamelCase
8
+ class Base < ApiBase
9
+ class << self
10
+ private
11
+
12
+ def base_url
13
+ Configuration.base_v1_1_url
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+ require_relative "../../../../response/product_groups_response"
3
+
4
+ module ONEAccess
5
+ module API
6
+ module V1_1 # rubocop:disable Style/ClassAndModuleCamelCase
7
+ module Entitlement
8
+ module Organization
9
+ class ProductGroup < Base
10
+ api_path "/entitlement/organization/productgroup"
11
+
12
+ def self.get_list(contributor_org_id:, page_number: 0, page_size: 20, type: nil)
13
+ resp = send_get("getList", Query: {
14
+ PageNumber: page_number,
15
+ PageSize: page_size,
16
+ ContributorOrgId: contributor_org_id,
17
+ Type: type
18
+ }.to_json)
19
+ Response::ProductGroupsResponse.from_json(resp.body)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../../../response/user_requests_response"
4
+ require_relative "../../../../response/user_entitlement_requests_response"
5
+
6
+ module ONEAccess
7
+ module API
8
+ module V1_1 # rubocop:disable Style/ClassAndModuleCamelCase
9
+ module Entitlement
10
+ module Research
11
+ class UserRequests < Base
12
+ api_path "/entitlement/research/userRequests"
13
+
14
+ def self.create(user_id:, sell_side_org_id:, sales_contact_first_name: nil, sales_contact_last_name: nil,
15
+ sales_contact_email: nil)
16
+ response = send_post("create",
17
+ UserId: user_id,
18
+ SellSideOrgId: sell_side_org_id,
19
+ SalesContact: {
20
+ FirstName: sales_contact_first_name,
21
+ LastName: sales_contact_last_name,
22
+ Email: sales_contact_email
23
+ }.reject { |_, value| value.nil? })
24
+
25
+ Response::UserRequestsResponse.from_json(response.body)
26
+ end
27
+
28
+ def self.get_list( # rubocop:disable Metrics/ParameterLists, Metrics/MethodLength
29
+ user_ids: [],
30
+ page_number: 0,
31
+ page_size: 20,
32
+ sort_by: "UserEntitlementRequestId",
33
+ is_ascending: false,
34
+ create_date_from: nil,
35
+ create_date_to: nil,
36
+ sell_side_org_ids: nil,
37
+ entitlement_status: nil
38
+ )
39
+ query = {
40
+ UserIds: user_ids,
41
+ PageNumber: page_number,
42
+ PageSize: page_size,
43
+ SortBy: sort_by,
44
+ IsAscending: is_ascending,
45
+ CreateDateFrom: create_date_from,
46
+ CreateDateTo: create_date_to,
47
+ SellSideOrgIds: sell_side_org_ids,
48
+ EntitlementStatus: entitlement_status
49
+ }.reject { |_, value| value.nil? }
50
+
51
+ response = send_get("getListWithEntitlementsStatus", Query: query.to_json)
52
+
53
+ Response::UserEntitlementRequestsResponse.from_json(response.body)
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+ require_relative "../../../../response/product_groups_response"
3
+
4
+ module ONEAccess
5
+ module API
6
+ module V1_1 # rubocop:disable Style/ClassAndModuleCamelCase
7
+ module Entitlement
8
+ module User
9
+ class ProductGroup < Base
10
+ api_path "/entitlement/user/productgroup"
11
+
12
+ def self.get_list(user_id:, page_number: 0, page_size: 20, type: nil)
13
+ resp = send_get("getList", Query: {
14
+ PageNumber: page_number,
15
+ PageSize: page_size,
16
+ UserId: user_id,
17
+ Type: type
18
+ }.to_json)
19
+ Response::ProductGroupsResponse.from_json(resp.body)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../../response/subscribe_to_updates_response"
4
+ require_relative "../../../response/changed_users_response"
5
+
6
+ module ONEAccess
7
+ module API
8
+ module V1_1 # rubocop:disable Style/ClassAndModuleCamelCase
9
+ module Entitlement
10
+ class UserSubscription < Base
11
+ api_path "/entitlement/userSubscription"
12
+
13
+ def self.subscribe(user_ids:)
14
+ response = send_post("subscribeToUpdates", user_ids)
15
+
16
+ Response::SubscribeToUpdatesResponse.from_json(response.body)
17
+ end
18
+
19
+ def self.changed_users(from_date: nil)
20
+ params = { dateFrom: from_date }.reject { |_, v| v.nil? }
21
+ response = send_get("subscribeToUpdates/changedUsers/getList", params)
22
+
23
+ Response::ChangedUsersResponse.from_json(response.body)
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../response/organization_response"
4
+
5
+ module ONEAccess
6
+ module API
7
+ module V1_1 # rubocop:disable Style/ClassAndModuleCamelCase
8
+ class Organizations < Base
9
+ api_path "/organizations"
10
+
11
+ def self.get(id:)
12
+ resp = send_get("get/#{id}")
13
+ Response::OrganizationResponse.from_json(resp.body)
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../response/industries_response"
4
+ require_relative "../../response/countries_response"
5
+ require_relative "../../response/contributors_response"
6
+
7
+ module ONEAccess
8
+ module API
9
+ module V1_1 # rubocop:disable Style/ClassAndModuleCamelCase
10
+ class References < Base
11
+ api_path "/references"
12
+
13
+ class << self
14
+ def industries(sort_by: "Id", is_ascending: false, keyword: "", page_number: 0, page_size: 20)
15
+ query = build_query(sort_by, is_ascending, keyword, page_number, page_size)
16
+
17
+ resp = send_get("industries", Query: query.to_json)
18
+
19
+ Response::IndustriesResponse.from_json(resp.body)
20
+ end
21
+
22
+ def countries(sort_by: "Id", is_ascending: false, keyword: "", page_number: 0, page_size: 20)
23
+ query = build_query(sort_by, is_ascending, keyword, page_number, page_size)
24
+
25
+ resp = send_get("countries", Query: query.to_json)
26
+
27
+ Response::CountriesResponse.from_json(resp.body)
28
+ end
29
+
30
+ private
31
+
32
+ def build_query(sort_by, is_ascending, keyword, page_number, page_size)
33
+ {
34
+ SortBy: sort_by,
35
+ IsAscending: is_ascending,
36
+ Keyword: keyword,
37
+ PageNumber: page_number,
38
+ PageSize: page_size
39
+ }
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+ require_relative "../../response/research_document_response"
3
+
4
+ module ONEAccess
5
+ module API
6
+ module V1_1 # rubocop:disable Style/ClassAndModuleCamelCase
7
+ class Research < Base
8
+ api_path "/research"
9
+
10
+ def self.document(document_id:, first_name:, last_name:, email:)
11
+ resp = send_get("document", documentId: document_id, userFirstName: first_name,
12
+ userLastName: last_name, userEmail: email)
13
+ Response::ResearchDocumentResponse.from_json(resp.body)
14
+ end
15
+
16
+ def self.document_by_user_id(document_id:, user_id:)
17
+ resp = send_get("documentByUserId", documentId: document_id, userId: user_id)
18
+ Response::ResearchDocumentResponse.from_json(resp.body)
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../response/companies_response"
4
+ require_relative "../../response/company_response"
5
+
6
+ module ONEAccess
7
+ module API
8
+ module V1_1 # rubocop:disable Style/ClassAndModuleCamelCase
9
+ class Symbology < Base
10
+ api_path "/symbology"
11
+
12
+ def self.companies(is_private:, page_number: 0, page_size: 20)
13
+ resp = send_get("companies", Query: {
14
+ PageNumber: page_number,
15
+ PageSize: page_size,
16
+ IsPrivate: is_private
17
+ }.to_json)
18
+ Response::CompaniesResponse.from_json(resp.body)
19
+ end
20
+
21
+ def self.company(id:)
22
+ resp = send_get("companies/#{id}")
23
+ Response::CompanyResponse.from_json(resp.body)
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+ require_relative "../../response/user_response"
3
+
4
+ module ONEAccess
5
+ module API
6
+ module V1_1 # rubocop:disable Style/ClassAndModuleCamelCase
7
+ class User < Base
8
+ api_path "/user"
9
+
10
+ def self.get_by_email(first_name:, last_name:, email:)
11
+ resp = send_get("getbyemail", userFirstName: first_name, userLastName: last_name, userEmail: email)
12
+ Response::UserResponse.from_json(resp.body)
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../api_base"
4
+
5
+ module ONEAccess
6
+ module API
7
+ module V3_0 # rubocop:disable Style/ClassAndModuleCamelCase
8
+ class Base < ApiBase
9
+ class << self
10
+ private
11
+
12
+ def base_url
13
+ Configuration.base_v3_0_url
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../response/contributors_response"
4
+ require_relative "../../request/contributors_request_handler"
5
+
6
+ module ONEAccess
7
+ module API
8
+ module V3_0 # rubocop:disable Style/ClassAndModuleCamelCase
9
+ class References < Base
10
+ api_path "/references"
11
+
12
+ class << self
13
+ def contributors(contributor_names: nil, limit: 20, offset: 0)
14
+ params = {
15
+ contributor_names: contributor_names,
16
+ limit: limit,
17
+ offset: offset
18
+ }.reject { |_, v| v.nil? }
19
+
20
+ resp = send_get("contributors", params)
21
+
22
+ Response::ContributorsResponse.from_json(resp.body)
23
+ end
24
+
25
+ def contributors_list
26
+ Request::ContributorsRequestHandler.new(url: api_url("contributors"))
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -1,14 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
  module ONEAccess
3
3
  class Configuration
4
- DEFAULT_BASE_URL = "http://ws.oneaccess.io/v1.1"
4
+ DEFAULT_BASE_V1_1_URL = "http://ws.oneaccess.io/v1.1"
5
+ DEFAULT_BASE_V3_0_URL = "http://ws.oneaccess.io/v3.0"
5
6
 
6
7
  class << self
7
- attr_accessor :base_url
8
+ attr_accessor :base_v1_1_url
9
+ attr_accessor :base_v3_0_url
8
10
  attr_accessor :api_key
9
11
  attr_accessor :master_api_key
10
12
  end
11
13
 
12
- self.base_url = DEFAULT_BASE_URL
14
+ self.base_v1_1_url = DEFAULT_BASE_V1_1_URL
15
+ self.base_v3_0_url = DEFAULT_BASE_V3_0_URL
13
16
  end
14
17
  end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "./representer/contributor"
4
+
5
+ module ONEAccess
6
+ module DataObject
7
+ class Contributor
8
+ extend Serializable
9
+
10
+ represented_by Representer::Contributor
11
+
12
+ attr_accessor :contributor_id
13
+ attr_accessor :contributor_name
14
+ attr_accessor :contributor_shortname
15
+ attr_accessor :active
16
+
17
+ alias active? active
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+ require_relative "./representer/meta"
3
+
4
+ module ONEAccess
5
+ module DataObject
6
+ class Meta
7
+ extend Serializable
8
+
9
+ represented_by Representer::Meta
10
+
11
+ attr_accessor :total
12
+ attr_accessor :limit
13
+ attr_accessor :offset
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ONEAccess
4
+ module DataObject
5
+ module Representer
6
+ class Contributor < Representable::Decorator
7
+ include Representable::JSON
8
+
9
+ property :contributor_id, type: Integer
10
+ property :contributor_name, type: String
11
+ property :contributor_shortname, type: String
12
+ property :active
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ONEAccess
4
+ module DataObject
5
+ module Representer
6
+ class Meta < Representable::Decorator
7
+ include Representable::JSON
8
+
9
+ property :total, type: Integer
10
+ property :limit, type: Integer
11
+ property :offset, type: Integer
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ONEAccess
4
+ module Http
5
+ class HttpClient
6
+ class << self
7
+ def get(url, params = {})
8
+ RestClient.get(url, { params: params }.merge(auth_headers))
9
+ rescue RestClient::Exception => e
10
+ raise create_api_error(e)
11
+ end
12
+
13
+ def post(url, body, headers = {})
14
+ RestClient.post(url, body.to_json, headers.merge(auth_headers))
15
+ rescue RestClient::Exception => e
16
+ raise create_api_error(e)
17
+ end
18
+
19
+ private
20
+
21
+ def create_api_error(error)
22
+ api_error_data = Response::APIError.new
23
+ Response::Representer::APIError.new(api_error_data).from_json(error.http_body)
24
+ Error::APIError.new(error.http_code, api_error_data.api_status_code, api_error_data.api_status_message)
25
+ end
26
+
27
+ def auth_headers
28
+ {
29
+ "X-One-Access-Api-Key" => Configuration.api_key,
30
+ "Authorization" => "X-One-Access-Master-Api-Key #{Configuration.master_api_key}"
31
+ }
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../response/contributors_response"
4
+
5
+ module ONEAccess
6
+ module Request
7
+ class ContributorsRequestHandler
8
+ def initialize(url:, limit: PAGE_SIZE)
9
+ @url = url
10
+ @limit = limit
11
+ end
12
+
13
+ def each
14
+ offset = 0
15
+ loop do
16
+ http_response = Http::HttpClient.get(url, build_params(offset))
17
+ response = Response::ContributorsResponse.from_json(http_response.body)
18
+ response&.data&.each do |contributor|
19
+ yield contributor
20
+ end
21
+ break unless more_records?(response.meta)
22
+ offset += 1
23
+ end
24
+ end
25
+
26
+ private
27
+
28
+ PAGE_SIZE = 200
29
+
30
+ attr_reader :url
31
+ attr_reader :limit
32
+
33
+ def build_params(offset)
34
+ {
35
+ limit: limit,
36
+ offset: offset
37
+ }
38
+ end
39
+
40
+ def more_records?(meta)
41
+ meta.offset < (meta.total / meta.limit).ceil - 1
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "./base_response"
4
+ require_relative "./representer/contributors_response"
5
+
6
+ module ONEAccess
7
+ module Response
8
+ class ContributorsResponse
9
+ extend Serializable
10
+ represented_by Representer::ContributorsResponse
11
+
12
+ attr_accessor :meta
13
+ attr_accessor :data
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "./base_response"
4
+ require_relative "../../data_object/meta"
5
+ require_relative "../../data_object/contributor"
6
+
7
+ module ONEAccess
8
+ module Response
9
+ module Representer
10
+ class ContributorsResponse < Representable::Decorator
11
+ include Representable::JSON
12
+
13
+ property :meta, decorator: DataObject::Representer::Meta,
14
+ class: DataObject::Meta
15
+ collection :data, decorator: DataObject::Representer::Contributor,
16
+ class: DataObject::Contributor
17
+ end
18
+ end
19
+ end
20
+ end
data/oneaccess.gemspec CHANGED
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
  Gem::Specification.new do |s|
3
3
  s.name = "oneaccess"
4
- s.version = "0.1.9"
5
- s.date = "2018-01-29"
4
+ s.version = "0.2.0"
5
+ s.date = "2018-02-04"
6
6
  s.summary = "ONEAccess API wrapper"
7
7
  s.description = "Easily communicate with ONEAccess API"
8
8
  s.homepage = "https://github.com/AlphaExchange/rixml"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oneaccess
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Correia Santos
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-29 00:00:00.000000000 Z
11
+ date: 2018-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -186,24 +186,29 @@ files:
186
186
  - console
187
187
  - docker-compose.yml
188
188
  - lib/oneaccess.rb
189
- - lib/oneaccess/api/base.rb
190
- - lib/oneaccess/api/entitlement/organization/product_group.rb
191
- - lib/oneaccess/api/entitlement/research/user_requests.rb
192
- - lib/oneaccess/api/entitlement/user/product_group.rb
193
- - lib/oneaccess/api/entitlement/user_subscription.rb
194
- - lib/oneaccess/api/organizations.rb
195
- - lib/oneaccess/api/references.rb
196
- - lib/oneaccess/api/research.rb
197
- - lib/oneaccess/api/symbology.rb
198
- - lib/oneaccess/api/user.rb
189
+ - lib/oneaccess/api/api_base.rb
190
+ - lib/oneaccess/api/v1_1/base.rb
191
+ - lib/oneaccess/api/v1_1/entitlement/organization/product_group.rb
192
+ - lib/oneaccess/api/v1_1/entitlement/research/user_requests.rb
193
+ - lib/oneaccess/api/v1_1/entitlement/user/product_group.rb
194
+ - lib/oneaccess/api/v1_1/entitlement/user_subscription.rb
195
+ - lib/oneaccess/api/v1_1/organizations.rb
196
+ - lib/oneaccess/api/v1_1/references.rb
197
+ - lib/oneaccess/api/v1_1/research.rb
198
+ - lib/oneaccess/api/v1_1/symbology.rb
199
+ - lib/oneaccess/api/v1_1/user.rb
200
+ - lib/oneaccess/api/v3_0/base.rb
201
+ - lib/oneaccess/api/v3_0/references.rb
199
202
  - lib/oneaccess/configuration.rb
200
203
  - lib/oneaccess/data_object/address.rb
201
204
  - lib/oneaccess/data_object/city.rb
202
205
  - lib/oneaccess/data_object/company.rb
203
206
  - lib/oneaccess/data_object/company_light.rb
207
+ - lib/oneaccess/data_object/contributor.rb
204
208
  - lib/oneaccess/data_object/country.rb
205
209
  - lib/oneaccess/data_object/global_region.rb
206
210
  - lib/oneaccess/data_object/industry.rb
211
+ - lib/oneaccess/data_object/meta.rb
207
212
  - lib/oneaccess/data_object/organization.rb
208
213
  - lib/oneaccess/data_object/organization_light.rb
209
214
  - lib/oneaccess/data_object/product_group.rb
@@ -212,9 +217,11 @@ files:
212
217
  - lib/oneaccess/data_object/representer/city.rb
213
218
  - lib/oneaccess/data_object/representer/company.rb
214
219
  - lib/oneaccess/data_object/representer/company_light.rb
220
+ - lib/oneaccess/data_object/representer/contributor.rb
215
221
  - lib/oneaccess/data_object/representer/country.rb
216
222
  - lib/oneaccess/data_object/representer/global_region.rb
217
223
  - lib/oneaccess/data_object/representer/industry.rb
224
+ - lib/oneaccess/data_object/representer/meta.rb
218
225
  - lib/oneaccess/data_object/representer/organization.rb
219
226
  - lib/oneaccess/data_object/representer/organization_light.rb
220
227
  - lib/oneaccess/data_object/representer/product_group.rb
@@ -236,11 +243,14 @@ files:
236
243
  - lib/oneaccess/enum/product_group_status.rb
237
244
  - lib/oneaccess/enum/product_type.rb
238
245
  - lib/oneaccess/error/api_error.rb
246
+ - lib/oneaccess/http/http_client.rb
247
+ - lib/oneaccess/request/contributors_request_handler.rb
239
248
  - lib/oneaccess/response/api_error.rb
240
249
  - lib/oneaccess/response/base_response.rb
241
250
  - lib/oneaccess/response/changed_users_response.rb
242
251
  - lib/oneaccess/response/companies_response.rb
243
252
  - lib/oneaccess/response/company_response.rb
253
+ - lib/oneaccess/response/contributors_response.rb
244
254
  - lib/oneaccess/response/countries_response.rb
245
255
  - lib/oneaccess/response/industries_response.rb
246
256
  - lib/oneaccess/response/organization_response.rb
@@ -251,6 +261,7 @@ files:
251
261
  - lib/oneaccess/response/representer/changed_users_response.rb
252
262
  - lib/oneaccess/response/representer/companies_response.rb
253
263
  - lib/oneaccess/response/representer/company_response.rb
264
+ - lib/oneaccess/response/representer/contributors_response.rb
254
265
  - lib/oneaccess/response/representer/countries_response.rb
255
266
  - lib/oneaccess/response/representer/industries_response.rb
256
267
  - lib/oneaccess/response/representer/organization_response.rb
@@ -1,64 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "rest-client"
4
- require "json"
5
- require_relative "../response/api_error"
6
- require_relative "../error/api_error"
7
-
8
- module ONEAccess
9
- module API
10
- class Base
11
- class << self
12
- def send_get(method, params = {})
13
- RestClient.get(api_url(method), { params: params }.merge(auth_headers))
14
- rescue RestClient::Exception => e
15
- raise create_api_error(e)
16
- end
17
-
18
- def send_post(method, body)
19
- RestClient.post(api_url(method), body.to_json, { content_type: :json }.merge(auth_headers))
20
- rescue RestClient::Exception => e
21
- raise create_api_error(e)
22
- end
23
-
24
- def resource_api_path
25
- const_get("RESOURCE_API_PATH")
26
- rescue StandardError
27
- nil
28
- end
29
-
30
- def api_url(method = nil)
31
- url = "#{Configuration.base_url}#{resource_api_path}"
32
- return url if method.nil?
33
- "#{url}/#{method}"
34
- end
35
-
36
- protected
37
-
38
- def api_path(path)
39
- raise "API path has already been set" if resource_api_path
40
- self.resource_api_path = path
41
- end
42
-
43
- private
44
-
45
- def create_api_error(error)
46
- api_error_data = Response::APIError.new
47
- Response::Representer::APIError.new(api_error_data).from_json(error.http_body)
48
- Error::APIError.new(error.http_code, api_error_data.api_status_code, api_error_data.api_status_message)
49
- end
50
-
51
- def resource_api_path=(path)
52
- const_set("RESOURCE_API_PATH", path)
53
- end
54
-
55
- def auth_headers
56
- {
57
- "X-One-Access-Api-Key" => Configuration.api_key,
58
- "Authorization" => "X-One-Access-Master-Api-Key #{Configuration.master_api_key}"
59
- }
60
- end
61
- end
62
- end
63
- end
64
- end
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
- require_relative "../../../response/product_groups_response"
3
-
4
- module ONEAccess
5
- module API
6
- module Entitlement
7
- module Organization
8
- class ProductGroup < Base
9
- api_path "/entitlement/organization/productgroup"
10
-
11
- def self.get_list(contributor_org_id:, page_number: 0, page_size: 20, type: nil)
12
- resp = send_get("getList", Query: {
13
- PageNumber: page_number,
14
- PageSize: page_size,
15
- ContributorOrgId: contributor_org_id,
16
- Type: type
17
- }.to_json)
18
- Response::ProductGroupsResponse.from_json(resp.body)
19
- end
20
- end
21
- end
22
- end
23
- end
24
- end
@@ -1,58 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "../../../response/user_requests_response"
4
- require_relative "../../../response/user_entitlement_requests_response"
5
-
6
- module ONEAccess
7
- module API
8
- module Entitlement
9
- module Research
10
- class UserRequests < Base
11
- api_path "/entitlement/research/userRequests"
12
-
13
- def self.create(user_id:, sell_side_org_id:, sales_contact_first_name: nil, sales_contact_last_name: nil,
14
- sales_contact_email: nil)
15
- response = send_post("create",
16
- UserId: user_id,
17
- SellSideOrgId: sell_side_org_id,
18
- SalesContact: {
19
- FirstName: sales_contact_first_name,
20
- LastName: sales_contact_last_name,
21
- Email: sales_contact_email
22
- }.reject { |_, value| value.nil? })
23
-
24
- Response::UserRequestsResponse.from_json(response.body)
25
- end
26
-
27
- def self.get_list( # rubocop:disable Metrics/ParameterLists, Metrics/MethodLength
28
- user_ids: [],
29
- page_number: 0,
30
- page_size: 20,
31
- sort_by: "UserEntitlementRequestId",
32
- is_ascending: false,
33
- create_date_from: nil,
34
- create_date_to: nil,
35
- sell_side_org_ids: nil,
36
- entitlement_status: nil
37
- )
38
- query = {
39
- UserIds: user_ids,
40
- PageNumber: page_number,
41
- PageSize: page_size,
42
- SortBy: sort_by,
43
- IsAscending: is_ascending,
44
- CreateDateFrom: create_date_from,
45
- CreateDateTo: create_date_to,
46
- SellSideOrgIds: sell_side_org_ids,
47
- EntitlementStatus: entitlement_status
48
- }.reject { |_, value| value.nil? }
49
-
50
- response = send_get("getListWithEntitlementsStatus", Query: query.to_json)
51
-
52
- Response::UserEntitlementRequestsResponse.from_json(response.body)
53
- end
54
- end
55
- end
56
- end
57
- end
58
- end
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
- require_relative "../../../response/product_groups_response"
3
-
4
- module ONEAccess
5
- module API
6
- module Entitlement
7
- module User
8
- class ProductGroup < Base
9
- api_path "/entitlement/user/productgroup"
10
-
11
- def self.get_list(user_id:, page_number: 0, page_size: 20, type: nil)
12
- resp = send_get("getList", Query: {
13
- PageNumber: page_number,
14
- PageSize: page_size,
15
- UserId: user_id,
16
- Type: type
17
- }.to_json)
18
- Response::ProductGroupsResponse.from_json(resp.body)
19
- end
20
- end
21
- end
22
- end
23
- end
24
- end
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "../../response/subscribe_to_updates_response"
4
- require_relative "../../response/changed_users_response"
5
-
6
- module ONEAccess
7
- module API
8
- module Entitlement
9
- class UserSubscription < Base
10
- api_path "/entitlement/userSubscription"
11
-
12
- def self.subscribe(user_ids:)
13
- response = send_post("subscribeToUpdates", user_ids)
14
-
15
- Response::SubscribeToUpdatesResponse.from_json(response.body)
16
- end
17
-
18
- def self.changed_users(from_date: nil)
19
- params = { dateFrom: from_date }.reject { |_, v| v.nil? }
20
- response = send_get("subscribeToUpdates/changedUsers/getList", params)
21
-
22
- Response::ChangedUsersResponse.from_json(response.body)
23
- end
24
- end
25
- end
26
- end
27
- end
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "../response/organization_response"
4
-
5
- module ONEAccess
6
- module API
7
- class Organizations < Base
8
- api_path "/organizations"
9
-
10
- def self.get(id:)
11
- resp = send_get("get/#{id}")
12
- Response::OrganizationResponse.from_json(resp.body)
13
- end
14
- end
15
- end
16
- end
@@ -1,42 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "../response/industries_response"
4
- require_relative "../response/countries_response"
5
-
6
- module ONEAccess
7
- module API
8
- class References < Base
9
- api_path "/references"
10
-
11
- class << self
12
- def industries(sort_by: "Id", is_ascending: false, keyword: "", page_number: 0, page_size: 20)
13
- query = build_query(sort_by, is_ascending, keyword, page_number, page_size)
14
-
15
- resp = send_get("industries", Query: query.to_json)
16
-
17
- Response::IndustriesResponse.from_json(resp.body)
18
- end
19
-
20
- def countries(sort_by: "Id", is_ascending: false, keyword: "", page_number: 0, page_size: 20)
21
- query = build_query(sort_by, is_ascending, keyword, page_number, page_size)
22
-
23
- resp = send_get("countries", Query: query.to_json)
24
-
25
- Response::CountriesResponse.from_json(resp.body)
26
- end
27
-
28
- private
29
-
30
- def build_query(sort_by, is_ascending, keyword, page_number, page_size)
31
- {
32
- SortBy: sort_by,
33
- IsAscending: is_ascending,
34
- Keyword: keyword,
35
- PageNumber: page_number,
36
- PageSize: page_size
37
- }
38
- end
39
- end
40
- end
41
- end
42
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
- require_relative "../response/research_document_response"
3
-
4
- module ONEAccess
5
- module API
6
- class Research < Base
7
- api_path "/research"
8
-
9
- def self.document(document_id:, first_name:, last_name:, email:)
10
- resp = send_get("document", documentId: document_id, userFirstName: first_name,
11
- userLastName: last_name, userEmail: email)
12
- Response::ResearchDocumentResponse.from_json(resp.body)
13
- end
14
-
15
- def self.document_by_user_id(document_id:, user_id:)
16
- resp = send_get("documentByUserId", documentId: document_id, userId: user_id)
17
- Response::ResearchDocumentResponse.from_json(resp.body)
18
- end
19
- end
20
- end
21
- end
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "../response/companies_response"
4
- require_relative "../response/company_response"
5
-
6
- module ONEAccess
7
- module API
8
- class Symbology < Base
9
- api_path "/symbology"
10
-
11
- def self.companies(is_private:, page_number: 0, page_size: 20)
12
- resp = send_get("companies", Query: {
13
- PageNumber: page_number,
14
- PageSize: page_size,
15
- IsPrivate: is_private
16
- }.to_json)
17
- Response::CompaniesResponse.from_json(resp.body)
18
- end
19
-
20
- def self.company(id:)
21
- resp = send_get("companies/#{id}")
22
- Response::CompanyResponse.from_json(resp.body)
23
- end
24
- end
25
- end
26
- end
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
- require_relative "../response/user_response"
3
-
4
- module ONEAccess
5
- module API
6
- class User < Base
7
- api_path "/user"
8
-
9
- def self.get_by_email(first_name:, last_name:, email:)
10
- resp = send_get("getbyemail", userFirstName: first_name, userLastName: last_name, userEmail: email)
11
- Response::UserResponse.from_json(resp.body)
12
- end
13
- end
14
- end
15
- end