oneaccess 0.1.7 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e961f9529c6796c037eff64b226f0db1e78763ed
4
- data.tar.gz: 45cad12764af3ceb1267acb38620c79ba82c3126
3
+ metadata.gz: c33c036b76dd4e04030e1fbddeab3e1712b3310d
4
+ data.tar.gz: 3536eb9fd5be517e69b1babc00e9a5242ec34f84
5
5
  SHA512:
6
- metadata.gz: 1407474d5289150000ba88aa0e6bb5bc842c7a83187ba945a5ad22dab1b0a1bf61730432c55be0945a6fd5743ca7c68b6e2f6ef82a135bc64e21c85ed53b327a
7
- data.tar.gz: ab59f14656af75386669744314147a0ce4805a803b3a64a4b3d8d06e6a0add59be3f3dc39e0df471cbb7b13b4f8d1826562ec54e7409e768109a94a4407d146c
6
+ metadata.gz: 5db803a6ca78402d935b9916fb4ab8996bc7e1e7507cf5f768978155b1e51fff84356f7a775749766d70475c18d668414f66679d44822763a3a0a3f628e8d09e
7
+ data.tar.gz: de218538bf247fe54e6beea9aeee31b3479b18dfc3729f58a7a9c828c93f395a2ecfe8df446c69692bac14a6e850ecafaeae7ca4549afbe9c27351443896462c
@@ -1,16 +1,22 @@
1
1
  Style/Documentation:
2
2
  Enabled: false
3
+
3
4
  Style/StringLiterals:
4
5
  EnforcedStyle: double_quotes
6
+
5
7
  Style/AlignHash:
6
8
  EnforcedHashRocketStyle: table
7
9
  EnforcedColonStyle: table
10
+
8
11
  Metrics/ClassLength:
9
12
  Max: 120
13
+
10
14
  Metrics/LineLength:
11
15
  Max: 120
16
+
12
17
  Metrics/AbcSize:
13
18
  Max: 18
19
+
14
20
  AllCops:
15
21
  TargetRubyVersion: 2.3
16
22
  DisplayCopNames: true
@@ -19,3 +25,4 @@ AllCops:
19
25
  - 'spec/**/*'
20
26
  - 'test/**/*'
21
27
  - 'vendor/**/*'
28
+ - 'bin/**/*'
@@ -0,0 +1,10 @@
1
+ FROM ruby:2.3.4
2
+
3
+ ENV APP_HOME oneaccess-rb
4
+ ENV PATH=$APP_HOME/bin:$PATH
5
+
6
+ RUN gem install bundler
7
+ ENV BUNDLE_JOBS=4
8
+
9
+ ADD . $APP_HOME
10
+ WORKDIR $APP_HOME
data/README.md CHANGED
@@ -40,6 +40,7 @@ Not all the methods in the API are currently supported, here's a list of all sup
40
40
  - Organization's Product Groups: _/entitlement/organization/productgroup/getList_
41
41
  - Organization: _/organizations/id_
42
42
  - User's Product Groups: _/entitlement/user/productgroup/getList_
43
+ - User Entitlement Requests: _/entitlement/research/userRequests/getListWithEntitlementsStatus_
43
44
 
44
45
  ### User by Email _(/user/getByEmail)_
45
46
  Official Documentation: http://apidocs.oneaccess.io/docs/usergetorcreate
@@ -155,7 +156,7 @@ resp.data.addresses #=> Array of instances of ONEAccess::DataObject::Address
155
156
 
156
157
  ### Research Entitlement
157
158
 
158
- ### Create an Research Entitlement request
159
+ ### Create a Research Entitlement request
159
160
 
160
161
  Official documentation: http://apidocs.oneaccess.io/docs/entitlmentresearchuserrequestscreate
161
162
 
@@ -172,3 +173,19 @@ rescue ONEAccess::Error::APIError => e
172
173
  puts "Error creating the Research Entitlement Request: #{e}"
173
174
  end
174
175
  ```
176
+
177
+ ### User Entitlement Requests _(/entitlement/research/userRequests/getListWithEntitlementsStatus)_
178
+ Official Documentation: http://apidocs.oneaccess.io/docs/entitlementresearchuserrequests
179
+
180
+ This method returns a list of user entitlement requests based on the specified `UserIds`, `PageNumber`, `PageSize`, `SortBy`, `IsAscending`, `CreateDateFrom`, `CreateDateTo`, `SellSideOrgIds` and `EntitlementStatus` parameter values.
181
+
182
+ #### How to use:
183
+ ```ruby
184
+ begin
185
+ resp = ONEAccess::API::Entitlement::Research::UserRequests.get_list
186
+
187
+ resp.data #=> Array of instances of ONEAcess::DataObject::UserEntitlementRequest
188
+ rescue ONEAccess::Error::APIError => e
189
+ puts "Error listing the available user entitlement requests"
190
+ end
191
+ ```
@@ -0,0 +1,105 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'bundle' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "rubygems"
12
+
13
+ m = Module.new do
14
+ module_function
15
+
16
+ def invoked_as_script?
17
+ File.expand_path($0) == File.expand_path(__FILE__)
18
+ end
19
+
20
+ def env_var_version
21
+ ENV["BUNDLER_VERSION"]
22
+ end
23
+
24
+ def cli_arg_version
25
+ return unless invoked_as_script? # don't want to hijack other binstubs
26
+ return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
27
+ bundler_version = nil
28
+ update_index = nil
29
+ ARGV.each_with_index do |a, i|
30
+ if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
31
+ bundler_version = a
32
+ end
33
+ next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
34
+ bundler_version = $1 || ">= 0.a"
35
+ update_index = i
36
+ end
37
+ bundler_version
38
+ end
39
+
40
+ def gemfile
41
+ gemfile = ENV["BUNDLE_GEMFILE"]
42
+ return gemfile if gemfile && !gemfile.empty?
43
+
44
+ File.expand_path("../../Gemfile", __FILE__)
45
+ end
46
+
47
+ def lockfile
48
+ lockfile =
49
+ case File.basename(gemfile)
50
+ when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
51
+ else "#{gemfile}.lock"
52
+ end
53
+ File.expand_path(lockfile)
54
+ end
55
+
56
+ def lockfile_version
57
+ return unless File.file?(lockfile)
58
+ lockfile_contents = File.read(lockfile)
59
+ return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
60
+ Regexp.last_match(1)
61
+ end
62
+
63
+ def bundler_version
64
+ @bundler_version ||= begin
65
+ env_var_version || cli_arg_version ||
66
+ lockfile_version || "#{Gem::Requirement.default}.a"
67
+ end
68
+ end
69
+
70
+ def load_bundler!
71
+ ENV["BUNDLE_GEMFILE"] ||= gemfile
72
+
73
+ # must dup string for RG < 1.8 compatibility
74
+ activate_bundler(bundler_version.dup)
75
+ end
76
+
77
+ def activate_bundler(bundler_version)
78
+ if Gem::Version.correct?(bundler_version) && Gem::Version.new(bundler_version).release < Gem::Version.new("2.0")
79
+ bundler_version = "< 2"
80
+ end
81
+ gem_error = activation_error_handling do
82
+ gem "bundler", bundler_version
83
+ end
84
+ return if gem_error.nil?
85
+ require_error = activation_error_handling do
86
+ require "bundler/version"
87
+ end
88
+ return if require_error.nil? && Gem::Requirement.new(bundler_version).satisfied_by?(Gem::Version.new(Bundler::VERSION))
89
+ warn "Activating bundler (#{bundler_version}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_version}'`"
90
+ exit 42
91
+ end
92
+
93
+ def activation_error_handling
94
+ yield
95
+ nil
96
+ rescue StandardError, LoadError => e
97
+ e
98
+ end
99
+ end
100
+
101
+ m.load_bundler!
102
+
103
+ if m.invoked_as_script?
104
+ load Gem.bin_path("bundler", "bundle")
105
+ end
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rspec' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
12
+ load(bundle_binstub) if File.file?(bundle_binstub)
13
+
14
+ require "pathname"
15
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
16
+ Pathname.new(__FILE__).realpath)
17
+
18
+ require "rubygems"
19
+ require "bundler/setup"
20
+
21
+ load Gem.bin_path("rspec-core", "rspec")
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rubocop' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
12
+ load(bundle_binstub) if File.file?(bundle_binstub)
13
+
14
+ require "pathname"
15
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
16
+ Pathname.new(__FILE__).realpath)
17
+
18
+ require "rubygems"
19
+ require "bundler/setup"
20
+
21
+ load Gem.bin_path("rubocop", "rubocop")
@@ -0,0 +1,12 @@
1
+ version: '3'
2
+
3
+ services:
4
+ test:
5
+ build: .
6
+ command: bash -c 'rubocop && rspec'
7
+ volumes:
8
+ - .:/oneaccess-rb
9
+ - bundler-cache:/usr/local/bundle
10
+
11
+ volumes:
12
+ bundler-cache:
@@ -8,6 +8,7 @@ require_relative "./oneaccess/serializable"
8
8
  require_relative "./oneaccess/enum/api_status_code"
9
9
  require_relative "./oneaccess/enum/product_type"
10
10
  require_relative "./oneaccess/enum/product_group_status"
11
+ require_relative "./oneaccess/enum/entitlement_status"
11
12
 
12
13
  require_relative "./oneaccess/api/base"
13
14
  require_relative "./oneaccess/api/user"
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "../../../response/user_requests_response"
4
+ require_relative "../../../response/user_entitlement_requests_response"
4
5
 
5
6
  module ONEAccess
6
7
  module API
@@ -19,8 +20,37 @@ module ONEAccess
19
20
  LastName: sales_contact_last_name,
20
21
  Email: sales_contact_email
21
22
  }.reject { |_, value| value.nil? })
23
+
22
24
  Response::UserRequestsResponse.from_json(response.body)
23
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
24
54
  end
25
55
  end
26
56
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require_relative "./representer/organization_light"
3
4
 
4
5
  module ONEAccess
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module ONEAccess
3
4
  module DataObject
4
5
  module Representer
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ONEAccess
4
+ module DataObject
5
+ module Representer
6
+ class SellSideUserGroupEntitlement < Representable::Decorator
7
+ include Representable::JSON
8
+
9
+ property :id, as: :Id, type: Integer
10
+ property :name, as: :Name, type: String
11
+ property :is_approved, as: :IsApproved
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../user_light"
4
+ require_relative "../organization_light"
5
+ require_relative "../sell_side_user_group_entitlement"
6
+
7
+ module ONEAccess
8
+ module DataObject
9
+ module Representer
10
+ class UserEntitlementRequest < Representable::Decorator
11
+ include Representable::JSON
12
+
13
+ property :id, as: :Id, type: Integer
14
+ property :create_date, as: :CreateDate, parse_filter: ->(value, _) { Time.parse(value) }
15
+ property :update_date, as: :UpdateDate, parse_filter: ->(value, _) { Time.parse(value) }
16
+ property :notes, as: :Notes, type: String
17
+ property :status, as: :Status, type: Integer
18
+ property :user, as: :User,
19
+ decorator: Representer::UserLight, class: DataObject::UserLight
20
+ property :buy_side_org, as: :BuySideOrg,
21
+ decorator: Representer::OrganizationLight, class: DataObject::OrganizationLight
22
+ property :sell_side_org, as: :SellSideOrg,
23
+ decorator: Representer::OrganizationLight, class: DataObject::OrganizationLight
24
+ collection :sell_side_user_groups, as: :SellSideUserGroups,
25
+ decorator: Representer::SellSideUserGroupEntitlement, class: DataObject::SellSideUserGroupEntitlement
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ONEAccess
4
+ module DataObject
5
+ module Representer
6
+ class UserLight < Representable::Decorator
7
+ include Representable::JSON
8
+
9
+ property :id, as: :Id, type: Integer
10
+ property :first_name, as: :FirstName, type: String
11
+ property :last_name, as: :LastName, type: String
12
+ property :email, as: :Email, type: String
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "./representer/sell_side_user_group_entitlement"
4
+
5
+ module ONEAccess
6
+ module DataObject
7
+ class SellSideUserGroupEntitlement
8
+ extend Serializable
9
+
10
+ represented_by Representer::SellSideUserGroupEntitlement
11
+
12
+ attr_accessor :id
13
+ attr_accessor :name
14
+ attr_accessor :is_approved
15
+
16
+ alias approved? is_approved
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "./representer/user_entitlement_request"
4
+
5
+ module ONEAccess
6
+ module DataObject
7
+ class UserEntitlementRequest
8
+ extend Serializable
9
+
10
+ represented_by Representer::UserEntitlementRequest
11
+
12
+ attr_accessor :id
13
+ attr_accessor :create_date
14
+ attr_accessor :update_date
15
+ attr_accessor :notes
16
+ attr_accessor :status
17
+ attr_accessor :user
18
+ attr_accessor :buy_side_org
19
+ attr_accessor :sell_side_org
20
+ attr_accessor :sell_side_user_groups
21
+
22
+ def pending?
23
+ status == EntitlementStatus::NONE
24
+ end
25
+
26
+ def approved?
27
+ status == EntitlementStatus::APPROVED
28
+ end
29
+
30
+ def rejected?
31
+ status == EntitlementStatus::REJECTED
32
+ end
33
+
34
+ def provisional?
35
+ status == EntitlementStatus::PROVISIONAL
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "./representer/user_light"
4
+
5
+ module ONEAccess
6
+ module DataObject
7
+ class UserLight
8
+ extend Serializable
9
+
10
+ represented_by Representer::UserLight
11
+
12
+ attr_accessor :id
13
+ attr_accessor :first_name
14
+ attr_accessor :last_name
15
+ attr_accessor :email
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ONEAccess
4
+ module EntitlementStatus
5
+ NONE = 1
6
+ APPROVED = 2
7
+ REJECTED = 3
8
+ PROVISIONAL = 4
9
+ end
10
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "./paginated_response"
4
+ require_relative "../../data_object/user_entitlement_request"
5
+
6
+ module ONEAccess
7
+ module Response
8
+ module Representer
9
+ class UserEntitlementRequestsResponse < PaginatedResponse
10
+ collection :data, as: :Data,
11
+ decorator: DataObject::Representer::UserEntitlementRequest,
12
+ class: DataObject::UserEntitlementRequest
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "./paginated_response"
4
+ require_relative "./representer/user_entitlement_requests_response"
5
+
6
+ module ONEAccess
7
+ module Response
8
+ class UserEntitlementRequestsResponse < PaginatedResponse
9
+ represented_by Representer::UserEntitlementRequestsResponse
10
+ end
11
+ end
12
+ end
@@ -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.7"
5
- s.date = "2018-01-08"
4
+ s.version = "0.1.8"
5
+ s.date = "2018-01-10"
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.7
4
+ version: 0.1.8
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-08 00:00:00.000000000 Z
11
+ date: 2018-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -174,12 +174,17 @@ files:
174
174
  - ".gitignore"
175
175
  - ".rspec"
176
176
  - ".rubocop.yml"
177
+ - Dockerfile
177
178
  - Gemfile
178
179
  - Gemfile.lock
179
180
  - README.md
180
181
  - Rakefile
182
+ - bin/bundle
183
+ - bin/rspec
184
+ - bin/rubocop
181
185
  - circle.yml
182
186
  - console
187
+ - docker-compose.yml
183
188
  - lib/oneaccess.rb
184
189
  - lib/oneaccess/api/base.rb
185
190
  - lib/oneaccess/api/entitlement/organization/product_group.rb
@@ -215,11 +220,18 @@ files:
215
220
  - lib/oneaccess/data_object/representer/region.rb
216
221
  - lib/oneaccess/data_object/representer/research_document_info.rb
217
222
  - lib/oneaccess/data_object/representer/saml_info.rb
223
+ - lib/oneaccess/data_object/representer/sell_side_user_group_entitlement.rb
218
224
  - lib/oneaccess/data_object/representer/user.rb
225
+ - lib/oneaccess/data_object/representer/user_entitlement_request.rb
226
+ - lib/oneaccess/data_object/representer/user_light.rb
219
227
  - lib/oneaccess/data_object/research_document_info.rb
220
228
  - lib/oneaccess/data_object/saml_info.rb
229
+ - lib/oneaccess/data_object/sell_side_user_group_entitlement.rb
221
230
  - lib/oneaccess/data_object/user.rb
231
+ - lib/oneaccess/data_object/user_entitlement_request.rb
232
+ - lib/oneaccess/data_object/user_light.rb
222
233
  - lib/oneaccess/enum/api_status_code.rb
234
+ - lib/oneaccess/enum/entitlement_status.rb
223
235
  - lib/oneaccess/enum/product_group_status.rb
224
236
  - lib/oneaccess/enum/product_type.rb
225
237
  - lib/oneaccess/error/api_error.rb
@@ -242,9 +254,11 @@ files:
242
254
  - lib/oneaccess/response/representer/paginated_response.rb
243
255
  - lib/oneaccess/response/representer/product_groups_response.rb
244
256
  - lib/oneaccess/response/representer/research_document_response.rb
257
+ - lib/oneaccess/response/representer/user_entitlement_requests_response.rb
245
258
  - lib/oneaccess/response/representer/user_requests_response.rb
246
259
  - lib/oneaccess/response/representer/user_response.rb
247
260
  - lib/oneaccess/response/research_document_response.rb
261
+ - lib/oneaccess/response/user_entitlement_requests_response.rb
248
262
  - lib/oneaccess/response/user_requests_response.rb
249
263
  - lib/oneaccess/response/user_response.rb
250
264
  - lib/oneaccess/serializable.rb