oneaccess 0.1.0 → 0.1.1

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: 30dd9ac3513fca2659dc828b8c4a85d2f54aa629
4
- data.tar.gz: ab06c8eb41a0e7de85f8821fbe152d40ba96633a
3
+ metadata.gz: a4da0375fca05ed2c1fad532b8f93db78dabd41e
4
+ data.tar.gz: bca80f5344d83c88969a2378403c7408a6d2d3aa
5
5
  SHA512:
6
- metadata.gz: ea9db92248596b40291813288865189fa8a500f9febcbc1fde81d301c77981d1d7066d8ed7078bd0da5f6818c768df177dca292fd19a6d1885c5a8e3f44c6af7
7
- data.tar.gz: 237723faf8bafff4e210b7d2a01f1e1f13f4c20310db148b954e574ca1734263d22cda2e1375ebd91f6c07c2cfbbca895b2342a40167488d1092899d86feb63c
6
+ metadata.gz: fcc9482c9322264571ac5eb56d47de07bbf698fb460fcd5355a08dc79140b4f13259a949a56e53d48c1e33f8cd9423212b95cb18d76cd41ef39d26b55db976d3
7
+ data.tar.gz: a91d3031db34bc0f27037f6248786d5998d04c7caba221c843dfe577c793e9bdf3af68d4368286c8ed95c9df6395bd680c978503330ffbd592ab9ff87078f416
data/README.md CHANGED
@@ -38,6 +38,7 @@ Not all the methods in the API are currently supported, here's a list of all sup
38
38
  - Research Document: _/research/document_
39
39
  - Research Document by User ID: _/research/documentByUserId_
40
40
  - Organization's Product Groups: _/entitlement/organization/productgroup/getList_
41
+ - Organization: _/organizations/id_
41
42
  - User's Product Groups: _/entitlement/user/productgroup/getList_
42
43
 
43
44
  ### User by Email _(/user/getByEmail)_
@@ -103,3 +104,21 @@ rescue ONEAccess::Error::APIError => e
103
104
  end
104
105
  ```
105
106
 
107
+ ### Get Organization by ID _(/organizations/id)_
108
+ Official Documentation: http://apidocs.oneaccess.io/docs/organization-2
109
+
110
+ This method returns an Organization by providing the Organization ID.
111
+
112
+ #### How to use:
113
+ ```ruby
114
+ resp = ONEAccess::API::Organizations.get_organization(id: 123)
115
+
116
+ resp.data #=> instance of ONEAcess::DataObject::Organization
117
+ resp.data.id #=> id of the Organization
118
+ resp.data.name #=> name of the Organization
119
+ resp.data.short_name #=> Short Name of the Organization
120
+ resp.data.active #=> Boolean meaning if the Organization is Active or not
121
+ resp.data.type #=> type of the Organization (Unspecified = 0, Buyside = 1, Sellside = 2, Advisory = 3, Other = 4, Vendor = 5, Internal = 6)
122
+ resp.data.main_address #=> instance of ONEAccess::DataObject::Address
123
+ resp.data.addresses #=> Array of instances of ONEAccess::DataObject::Address
124
+ ```
@@ -11,6 +11,7 @@ require_relative "./oneaccess/enum/product_group_status"
11
11
  require_relative "./oneaccess/api/base"
12
12
  require_relative "./oneaccess/api/user"
13
13
  require_relative "./oneaccess/api/research"
14
+ require_relative "./oneaccess/api/organizations"
14
15
  require_relative "./oneaccess/api/entitlement/organization/product_group"
15
16
  require_relative "./oneaccess/api/entitlement/user/product_group"
16
17
 
@@ -8,7 +8,7 @@ module ONEAccess
8
8
  module API
9
9
  class Base
10
10
  class << self
11
- def get(method, params = {})
11
+ def send_get(method, params = {})
12
12
  RestClient.get(api_url(method), { params: params }.merge(auth_headers))
13
13
  rescue RestClient::Exception => e
14
14
  raise create_api_error(e)
@@ -9,7 +9,7 @@ module ONEAccess
9
9
  api_path "/entitlement/organization/productgroup"
10
10
 
11
11
  def self.get_list(contributor_org_id:, page_number: 0, page_size: 20, type: nil)
12
- resp = get("getList", Query: {
12
+ resp = send_get("getList", Query: {
13
13
  PageNumber: page_number,
14
14
  PageSize: page_size,
15
15
  ContributorOrgId: contributor_org_id,
@@ -9,7 +9,7 @@ module ONEAccess
9
9
  api_path "/entitlement/user/productgroup"
10
10
 
11
11
  def self.get_list(user_id:, page_number: 0, page_size: 20, type: nil)
12
- resp = get("getList", Query: {
12
+ resp = send_get("getList", Query: {
13
13
  PageNumber: page_number,
14
14
  PageSize: page_size,
15
15
  UserId: user_id,
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../response/organizations_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::OrganizationsResponse.from_json(resp.body)
13
+ end
14
+ end
15
+ end
16
+ end
@@ -7,13 +7,13 @@ module ONEAccess
7
7
  api_path "/research"
8
8
 
9
9
  def self.document(document_id:, first_name:, last_name:, email:)
10
- resp = get("document", documentId: document_id, userFirstName: first_name,
10
+ resp = send_get("document", documentId: document_id, userFirstName: first_name,
11
11
  userLastName: last_name, userEmail: email)
12
12
  Response::ResearchDocumentResponse.from_json(resp.body)
13
13
  end
14
14
 
15
15
  def self.document_by_user_id(document_id:, user_id:)
16
- resp = get("documentByUserId", documentId: document_id, userId: user_id)
16
+ resp = send_get("documentByUserId", documentId: document_id, userId: user_id)
17
17
  Response::ResearchDocumentResponse.from_json(resp.body)
18
18
  end
19
19
  end
@@ -7,7 +7,7 @@ module ONEAccess
7
7
  api_path "/user"
8
8
 
9
9
  def self.get_by_email(first_name:, last_name:, email:)
10
- resp = get("getbyemail", userFirstName: first_name, userLastName: last_name, userEmail: email)
10
+ resp = send_get("getbyemail", userFirstName: first_name, userLastName: last_name, userEmail: email)
11
11
  Response::UserResponse.from_json(resp.body)
12
12
  end
13
13
  end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+ require_relative "./representer/organization"
3
+
4
+ module ONEAccess
5
+ module DataObject
6
+ class Organization
7
+ attr_accessor :id
8
+ attr_accessor :name
9
+ attr_accessor :active
10
+ attr_accessor :short_name
11
+ attr_accessor :type
12
+ attr_accessor :addresses
13
+ attr_accessor :main_address
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ONEAccess
4
+ module DataObject
5
+ module Representer
6
+ class Organization < Representable::Decorator
7
+ include Representable::JSON
8
+
9
+ property :id, as: :Id, type: Integer
10
+ property :name, as: :Name, type: String
11
+ property :active, as: :Active
12
+ property :short_name, as: :ShortName, type: String
13
+ property :type, as: :Type, type: Integer
14
+ property :main_address, as: :MainAddress, decorator: Representer::Address, class: DataObject::Address
15
+ collection :addresses, as: :Addresses, decorator: Representer::Address, class: DataObject::Address
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "./representer/organizations_response"
4
+
5
+ module ONEAccess
6
+ module Response
7
+ class OrganizationsResponse
8
+ extend Serializable
9
+
10
+ represented_by Representer::OrganizationsResponse
11
+
12
+ attr_accessor :api_status_code
13
+ attr_accessor :data
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../data_object/organization"
4
+
5
+ module ONEAccess
6
+ module Response
7
+ module Representer
8
+ class OrganizationsResponse < Representable::Decorator
9
+ include Representable::JSON
10
+
11
+ property :api_status_code, as: :ApiStatusCode
12
+ property :data, as: :Data, decorator: DataObject::Representer::Organization, class: DataObject::Organization
13
+ end
14
+ end
15
+ end
16
+ 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.0"
5
- s.date = "2017-11-01"
4
+ s.version = "0.1.1"
5
+ s.date = "2017-11-29"
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.0
4
+ version: 0.1.1
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-11-01 00:00:00.000000000 Z
11
+ date: 2017-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -184,6 +184,7 @@ files:
184
184
  - lib/oneaccess/api/base.rb
185
185
  - lib/oneaccess/api/entitlement/organization/product_group.rb
186
186
  - lib/oneaccess/api/entitlement/user/product_group.rb
187
+ - lib/oneaccess/api/organizations.rb
187
188
  - lib/oneaccess/api/research.rb
188
189
  - lib/oneaccess/api/user.rb
189
190
  - lib/oneaccess/configuration.rb
@@ -191,6 +192,7 @@ files:
191
192
  - lib/oneaccess/data_object/city.rb
192
193
  - lib/oneaccess/data_object/country.rb
193
194
  - lib/oneaccess/data_object/global_region.rb
195
+ - lib/oneaccess/data_object/organization.rb
194
196
  - lib/oneaccess/data_object/organization_light.rb
195
197
  - lib/oneaccess/data_object/product_group.rb
196
198
  - lib/oneaccess/data_object/region.rb
@@ -198,6 +200,7 @@ files:
198
200
  - lib/oneaccess/data_object/representer/city.rb
199
201
  - lib/oneaccess/data_object/representer/country.rb
200
202
  - lib/oneaccess/data_object/representer/global_region.rb
203
+ - lib/oneaccess/data_object/representer/organization.rb
201
204
  - lib/oneaccess/data_object/representer/organization_light.rb
202
205
  - lib/oneaccess/data_object/representer/product_group.rb
203
206
  - lib/oneaccess/data_object/representer/region.rb
@@ -212,8 +215,10 @@ files:
212
215
  - lib/oneaccess/enum/product_type.rb
213
216
  - lib/oneaccess/error/api_error.rb
214
217
  - lib/oneaccess/response/api_error.rb
218
+ - lib/oneaccess/response/organizations_response.rb
215
219
  - lib/oneaccess/response/product_groups_response.rb
216
220
  - lib/oneaccess/response/representer/api_error.rb
221
+ - lib/oneaccess/response/representer/organizations_response.rb
217
222
  - lib/oneaccess/response/representer/product_groups_response.rb
218
223
  - lib/oneaccess/response/representer/research_document_response.rb
219
224
  - lib/oneaccess/response/representer/user_response.rb