oneaccess 0.4.5 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8a04af112ed6e47d0c4f118cd95d356f7342a1c1
4
- data.tar.gz: e89480e74840ed6d2649f7c85f41906a25834244
3
+ metadata.gz: bebd929f809465f9ab5a529dc6ac4192016f59c5
4
+ data.tar.gz: 129cc7733676fc2e395ee8b55d6e9c1609d60b5f
5
5
  SHA512:
6
- metadata.gz: dc82b3f2c18cabaa72cef280fd79cea24b60d463c9ac0fa5ea1ace1a16e2b4c92c2cd747223fa2dd8ba6349c9595a43398aee754858083852aeab77661e32204
7
- data.tar.gz: 15750546f7085327cc303bdbe8a5897c6ee9c138d87cb0626136dde89a85628fbc362f4e0534087f6d4ae17d338218ade674b26b02ef60b9fc941c9c80df4fa3
6
+ metadata.gz: a7917796d561f384e34cdf4b62c17da2e651ba856563dff9983d6ad055b1bad485dd0e5999f6d69e3caf0bb0f6dfbf40af2b2defaf63e5960bc5dcc85416c8d2
7
+ data.tar.gz: bb5f64a8d3834ce5d74f2a5cfad290a5d8341180889b994329fda2d9e2182b32eab101fa34313d7d9500f4344e72f093986d43285f3b1cef454764691c6703a1
data/.rubocop.yml CHANGED
@@ -20,6 +20,10 @@ Metrics/LineLength:
20
20
  Metrics/AbcSize:
21
21
  Max: 18
22
22
 
23
+ Metrics/ParameterLists:
24
+ Max: 5
25
+ CountKeywordArgs: false
26
+
23
27
  AllCops:
24
28
  TargetRubyVersion: 2.3
25
29
  DisplayCopNames: true
data/README.md CHANGED
@@ -261,3 +261,17 @@ rescue ONEAccess::Error::APIError => e
261
261
  puts "Error creating the inducement"
262
262
  end
263
263
  ```
264
+
265
+ ### Get Providers Users Details _(/providers/GetProviderUserDetails)_
266
+
267
+ Reference endpoint to get providers users details information.
268
+
269
+ #### How to use:
270
+ ```ruby
271
+ begin
272
+ resp = ONEAccess::API::V3_0::Providers.users_details(buy_side_org_id: 1, provider_id: 1, contract_status_id: 1, user_id: 1, user_email: 'hello@example.com', user_reverse_entitlement_status: 1, vendor_id: 1, reverse_entitlement_status: 1)
273
+ resp #=> instance of Array containing ONEAccess::DataObject::ProvidersUsersDetails
274
+ rescue ONEAccess::Error::APIError => e
275
+ puts "Error getting providers users details"
276
+ end
277
+ ```
@@ -25,7 +25,7 @@ module ONEAccess
25
25
  Response::UserRequestsResponse.from_json(response.body)
26
26
  end
27
27
 
28
- def self.get_list( # rubocop:disable Metrics/ParameterLists, Metrics/MethodLength
28
+ def self.get_list( # rubocop:disable Metrics/MethodLength
29
29
  user_ids: [],
30
30
  page_number: 0,
31
31
  page_size: 20,
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "../../response/inducement_response"
4
+ require_relative "../../response/providers_users_details_response"
4
5
 
5
6
  module ONEAccess
6
7
  module API
@@ -22,6 +23,52 @@ module ONEAccess
22
23
 
23
24
  Response::InducementResponse.from_json(resp.body)
24
25
  end
26
+
27
+ def users_details( # rubocop:disable Metrics/MethodLength
28
+ buy_side_org_id:,
29
+ provider_id:,
30
+ contract_status_id: nil,
31
+ user_id: nil,
32
+ user_email: nil,
33
+ user_reverse_entitlement_status: nil,
34
+ vendor_id: nil,
35
+ reverse_entitlement_status: nil
36
+ )
37
+
38
+ provider_id = comma_separated_values(provider_id)
39
+
40
+ params = {
41
+ buysideorgid: buy_side_org_id,
42
+ contractstatusid: contract_status_id,
43
+ userid: user_id,
44
+ useremail: user_email,
45
+ userreverseentitlementstatus: user_reverse_entitlement_status,
46
+ vendorid: vendor_id,
47
+ reverseentitlementstatus: reverse_entitlement_status
48
+ }.reject { |_, value| value.nil? }
49
+
50
+ resp = send_get("GetProviderUserDetails?providerid=#{provider_id}", params)
51
+
52
+ Response::ProvidersUsersDetailsResponse.from_json(resp.body)
53
+ end
54
+
55
+ private
56
+
57
+ # We need to diffently handle comma separated values since the RestClient,
58
+ # gem URI encode the commas and this is not supported by the API.
59
+ #
60
+ # Examples:
61
+ # [1,2$,3] => '1,2%24,3'
62
+ # '1,2$,3' => '1,2%24,3'
63
+ def comma_separated_values(values)
64
+ values = values.split(",") if values.is_a?(String)
65
+ if values.is_a?(Array)
66
+ values = values.map do |value|
67
+ URI.encode_www_form_component(value)
68
+ end.join(",")
69
+ end
70
+ values
71
+ end
25
72
  end
26
73
  end
27
74
  end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "./representer/providers_user_details"
4
+
5
+ module ONEAccess
6
+ module DataObject
7
+ class ProvidersUserDetails
8
+ extend Serializable
9
+
10
+ represented_by Representer::ProvidersUserDetails
11
+
12
+ attr_accessor :id
13
+ attr_accessor :user_rev_ent_status
14
+ attr_accessor :first_name
15
+ attr_accessor :last_name
16
+ attr_accessor :email
17
+ attr_accessor :vendors_count
18
+ attr_accessor :vendors
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "./representer/providers_user_details_vendor"
4
+
5
+ module ONEAccess
6
+ module DataObject
7
+ class ProvidersUserDetailsVendor
8
+ extend Serializable
9
+
10
+ represented_by Representer::ProvidersUserDetailsVendor
11
+
12
+ attr_accessor :id
13
+ attr_accessor :rev_ent_status
14
+ attr_accessor :name
15
+ attr_accessor :short_name
16
+ attr_accessor :ent_level
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "./representer/providers_users_details"
4
+
5
+ module ONEAccess
6
+ module DataObject
7
+ class ProvidersUsersDetails
8
+ extend Serializable
9
+
10
+ represented_by Representer::ProvidersUsersDetails
11
+
12
+ attr_accessor :provider_id
13
+ attr_accessor :buy_side_org_id
14
+ attr_accessor :provider_name
15
+ attr_accessor :contract_status
16
+ attr_accessor :contract_status_id
17
+ attr_accessor :buy_side_org_name
18
+ attr_accessor :users_count
19
+ attr_accessor :users
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../providers_user_details_vendor"
4
+
5
+ module ONEAccess
6
+ module DataObject
7
+ module Representer
8
+ class ProvidersUserDetails < Representable::Decorator
9
+ include Representable::JSON
10
+
11
+ property :id, type: Integer
12
+ property :user_rev_ent_status, as: :userreventstatus, type: String
13
+ property :first_name, as: :firstname, type: String
14
+ property :last_name, as: :lastname, type: String
15
+ property :email, type: String
16
+ property :vendors_count, as: :vendorscount, type: Integer
17
+ collection :vendors, decorator: Representer::ProvidersUserDetailsVendor,
18
+ class: DataObject::ProvidersUserDetailsVendor
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ONEAccess
4
+ module DataObject
5
+ module Representer
6
+ class ProvidersUserDetailsVendor < Representable::Decorator
7
+ include Representable::JSON
8
+
9
+ property :id, type: Integer
10
+ property :rev_ent_status, as: :reventstatus, type: String
11
+ property :name, type: String
12
+ property :short_name, as: :shortname, type: String
13
+ property :ent_level, as: :entlevel, type: String
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../providers_user_details"
4
+
5
+ module ONEAccess
6
+ module DataObject
7
+ module Representer
8
+ class ProvidersUsersDetails < Representable::Decorator
9
+ include Representable::JSON
10
+
11
+ property :provider_id, as: :providerid, type: Integer
12
+ property :buy_side_org_id, as: :buysideorgid, type: Integer
13
+ property :provider_name, as: :providername, type: String
14
+ property :contract_status, as: :contractstatus, type: String
15
+ property :contract_status_id, as: :contractstatusid, type: String
16
+ property :buy_side_org_name, as: :buysideorgname, type: String
17
+ property :users_count, as: :userscount, type: Integer
18
+ collection :users, decorator: Representer::ProvidersUserDetails,
19
+ class: DataObject::ProvidersUserDetails
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ONEAccess
4
+ module Response
5
+ class CollectionResponse
6
+ extend Serializable
7
+
8
+ class << self
9
+ private
10
+
11
+ def collection?
12
+ true
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "./collection_response"
4
+ require_relative "./representer/providers_users_details_response"
5
+
6
+ module ONEAccess
7
+ module Response
8
+ class ProvidersUsersDetailsResponse < CollectionResponse
9
+ represented_by Representer::ProvidersUsersDetailsResponse
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ONEAccess
4
+ module Response
5
+ module Representer
6
+ class CollectionResponse < Representable::Decorator
7
+ include Representable::JSON::Collection
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "./collection_response"
4
+ require_relative "../../data_object/providers_users_details"
5
+
6
+ module ONEAccess
7
+ module Response
8
+ module Representer
9
+ class ProvidersUsersDetailsResponse < CollectionResponse
10
+ items decorator: DataObject::Representer::ProvidersUsersDetails,
11
+ class: DataObject::ProvidersUsersDetails
12
+ end
13
+ end
14
+ end
15
+ end
@@ -7,9 +7,21 @@ module ONEAccess
7
7
  end
8
8
 
9
9
  def from_json(json)
10
- obj = new
11
- @representer_class.new(obj).from_json(json)
12
- obj
10
+ if collection?
11
+ collection = []
12
+ @representer_class.new(collection).from_json(json)
13
+ collection
14
+ else
15
+ obj = new
16
+ @representer_class.new(obj).from_json(json)
17
+ obj
18
+ end
19
+ end
20
+
21
+ private
22
+
23
+ def collection?
24
+ false
13
25
  end
14
26
  end
15
27
  end
data/oneaccess.gemspec CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "oneaccess"
5
- s.version = "0.4.5"
6
- s.date = "2018-03-17"
5
+ s.version = "0.5.0"
6
+ s.date = "2018-04-18"
7
7
  s.summary = "ONEAccess API wrapper"
8
8
  s.description = "Easily communicate with ONEAccess API"
9
9
  s.homepage = "https://github.com/AlphaExchange/oneaccess-rb"
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.4.5
4
+ version: 0.5.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-03-17 00:00:00.000000000 Z
11
+ date: 2018-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -215,6 +215,9 @@ files:
215
215
  - lib/oneaccess/data_object/organization.rb
216
216
  - lib/oneaccess/data_object/organization_light.rb
217
217
  - lib/oneaccess/data_object/product_group.rb
218
+ - lib/oneaccess/data_object/providers_user_details.rb
219
+ - lib/oneaccess/data_object/providers_user_details_vendor.rb
220
+ - lib/oneaccess/data_object/providers_users_details.rb
218
221
  - lib/oneaccess/data_object/region.rb
219
222
  - lib/oneaccess/data_object/representer/address.rb
220
223
  - lib/oneaccess/data_object/representer/city.rb
@@ -230,6 +233,9 @@ files:
230
233
  - lib/oneaccess/data_object/representer/organization.rb
231
234
  - lib/oneaccess/data_object/representer/organization_light.rb
232
235
  - lib/oneaccess/data_object/representer/product_group.rb
236
+ - lib/oneaccess/data_object/representer/providers_user_details.rb
237
+ - lib/oneaccess/data_object/representer/providers_user_details_vendor.rb
238
+ - lib/oneaccess/data_object/representer/providers_users_details.rb
233
239
  - lib/oneaccess/data_object/representer/region.rb
234
240
  - lib/oneaccess/data_object/representer/research_document_info.rb
235
241
  - lib/oneaccess/data_object/representer/saml_info.rb
@@ -254,6 +260,7 @@ files:
254
260
  - lib/oneaccess/response/api_error.rb
255
261
  - lib/oneaccess/response/base_response.rb
256
262
  - lib/oneaccess/response/changed_users_response.rb
263
+ - lib/oneaccess/response/collection_response.rb
257
264
  - lib/oneaccess/response/companies_response.rb
258
265
  - lib/oneaccess/response/company_response.rb
259
266
  - lib/oneaccess/response/contributors_response.rb
@@ -264,9 +271,11 @@ files:
264
271
  - lib/oneaccess/response/organization_response.rb
265
272
  - lib/oneaccess/response/paginated_response.rb
266
273
  - lib/oneaccess/response/product_groups_response.rb
274
+ - lib/oneaccess/response/providers_users_details_response.rb
267
275
  - lib/oneaccess/response/representer/api_error.rb
268
276
  - lib/oneaccess/response/representer/base_response.rb
269
277
  - lib/oneaccess/response/representer/changed_users_response.rb
278
+ - lib/oneaccess/response/representer/collection_response.rb
270
279
  - lib/oneaccess/response/representer/companies_response.rb
271
280
  - lib/oneaccess/response/representer/company_response.rb
272
281
  - lib/oneaccess/response/representer/contributors_response.rb
@@ -277,6 +286,7 @@ files:
277
286
  - lib/oneaccess/response/representer/organization_response.rb
278
287
  - lib/oneaccess/response/representer/paginated_response.rb
279
288
  - lib/oneaccess/response/representer/product_groups_response.rb
289
+ - lib/oneaccess/response/representer/providers_users_details_response.rb
280
290
  - lib/oneaccess/response/representer/research_document_response.rb
281
291
  - lib/oneaccess/response/representer/subscribe_to_updates_response.rb
282
292
  - lib/oneaccess/response/representer/user_entitlement_requests_response.rb