oneaccess 0.1.6 → 0.1.7

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: d657bb9731b41f7625cf3ed92db9009bf45f6f33
4
- data.tar.gz: 622d61ef1814a946a2c38cf8bc9a2bf3ca062687
3
+ metadata.gz: e961f9529c6796c037eff64b226f0db1e78763ed
4
+ data.tar.gz: 45cad12764af3ceb1267acb38620c79ba82c3126
5
5
  SHA512:
6
- metadata.gz: 30b02dadfe38853caccf2cf64196eb7595f5963491351aa93bb4deb5fd2d756d13f5d3ba884c8c317c0b9673880491db123022fefe0722795e12260f670e4aa6
7
- data.tar.gz: bceba0f4b8d44bc972cf9c7e273ab43706e49d56d5d12fe47a3695a67fd0385dd6eb116aea0bd0e8df7b74e839f9e77ad22ae7641ca6fea28c80ddabaefe350d
6
+ metadata.gz: 1407474d5289150000ba88aa0e6bb5bc842c7a83187ba945a5ad22dab1b0a1bf61730432c55be0945a6fd5743ca7c68b6e2f6ef82a135bc64e21c85ed53b327a
7
+ data.tar.gz: ab59f14656af75386669744314147a0ce4805a803b3a64a4b3d8d06e6a0add59be3f3dc39e0df471cbb7b13b4f8d1826562ec54e7409e768109a94a4407d146c
data/README.md CHANGED
@@ -152,3 +152,23 @@ resp.data.type #=> type of the Organization (Unspecified = 0, Buyside = 1, Sells
152
152
  resp.data.main_address #=> instance of ONEAccess::DataObject::Address
153
153
  resp.data.addresses #=> Array of instances of ONEAccess::DataObject::Address
154
154
  ```
155
+
156
+ ### Research Entitlement
157
+
158
+ ### Create an Research Entitlement request
159
+
160
+ Official documentation: http://apidocs.oneaccess.io/docs/entitlmentresearchuserrequestscreate
161
+
162
+ Creates a new Research Entitlement Request for the given User.
163
+
164
+ #### How to use
165
+ ```ruby
166
+ begin
167
+ resp = ONEAccess::API::Entitlement::Research::UserRequests.create(user_id:'123', sell_side_org_id:'456',
168
+ sales_contact_first_name:'John', sales_contact_last_name:'Doe', sales_contact_email:'john.doe@example.com')
169
+
170
+ resp.data #=> ID of the new Request
171
+ rescue ONEAccess::Error::APIError => e
172
+ puts "Error creating the Research Entitlement Request: #{e}"
173
+ end
174
+ ```
data/lib/oneaccess.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require "representable"
3
4
 
4
5
  require_relative "./oneaccess/configuration"
@@ -16,6 +17,7 @@ require_relative "./oneaccess/api/symbology"
16
17
  require_relative "./oneaccess/api/references"
17
18
  require_relative "./oneaccess/api/entitlement/organization/product_group"
18
19
  require_relative "./oneaccess/api/entitlement/user/product_group"
20
+ require_relative "./oneaccess/api/entitlement/research/user_requests"
19
21
 
20
22
  module ONEAccess
21
23
  def self.configure
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require "rest-client"
3
4
  require "json"
4
5
  require_relative "../response/api_error"
@@ -14,9 +15,15 @@ module ONEAccess
14
15
  raise create_api_error(e)
15
16
  end
16
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
+
17
24
  def resource_api_path
18
25
  const_get("RESOURCE_API_PATH")
19
- rescue
26
+ rescue StandardError
20
27
  nil
21
28
  end
22
29
 
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../../response/user_requests_response"
4
+
5
+ module ONEAccess
6
+ module API
7
+ module Entitlement
8
+ module Research
9
+ class UserRequests < Base
10
+ api_path "/entitlement/research/userRequests"
11
+
12
+ def self.create(user_id:, sell_side_org_id:, sales_contact_first_name: nil, sales_contact_last_name: nil,
13
+ sales_contact_email: nil)
14
+ response = send_post("create",
15
+ UserId: user_id,
16
+ SellSideOrgId: sell_side_org_id,
17
+ SalesContact: {
18
+ FirstName: sales_contact_first_name,
19
+ LastName: sales_contact_last_name,
20
+ Email: sales_contact_email
21
+ }.reject { |_, value| value.nil? })
22
+ Response::UserRequestsResponse.from_json(response.body)
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "./base_response"
4
+
5
+ module ONEAccess
6
+ module Response
7
+ module Representer
8
+ class UserRequestsResponse < BaseResponse
9
+ property :data, as: :Data
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "./base_response"
4
+ require_relative "./representer/user_requests_response"
5
+
6
+ module ONEAccess
7
+ module Response
8
+ class UserRequestsResponse < BaseResponse
9
+ represented_by Representer::UserRequestsResponse
10
+ end
11
+ end
12
+ 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.6"
5
- s.date = "2017-12-15"
4
+ s.version = "0.1.7"
5
+ s.date = "2018-01-08"
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.6
4
+ version: 0.1.7
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: 2017-12-15 00:00:00.000000000 Z
11
+ date: 2018-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -183,6 +183,7 @@ files:
183
183
  - lib/oneaccess.rb
184
184
  - lib/oneaccess/api/base.rb
185
185
  - lib/oneaccess/api/entitlement/organization/product_group.rb
186
+ - lib/oneaccess/api/entitlement/research/user_requests.rb
186
187
  - lib/oneaccess/api/entitlement/user/product_group.rb
187
188
  - lib/oneaccess/api/organizations.rb
188
189
  - lib/oneaccess/api/references.rb
@@ -241,8 +242,10 @@ files:
241
242
  - lib/oneaccess/response/representer/paginated_response.rb
242
243
  - lib/oneaccess/response/representer/product_groups_response.rb
243
244
  - lib/oneaccess/response/representer/research_document_response.rb
245
+ - lib/oneaccess/response/representer/user_requests_response.rb
244
246
  - lib/oneaccess/response/representer/user_response.rb
245
247
  - lib/oneaccess/response/research_document_response.rb
248
+ - lib/oneaccess/response/user_requests_response.rb
246
249
  - lib/oneaccess/response/user_response.rb
247
250
  - lib/oneaccess/serializable.rb
248
251
  - oneaccess.gemspec