oneaccess 1.0.1 → 1.1.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: 839afdde8249236a6efc2785eea68230f972507b
4
- data.tar.gz: c178bab91d1fa090d03220d14c0370a26191e72f
3
+ metadata.gz: f9bf8a4f7ec45050532078a73f815abc1a2649f3
4
+ data.tar.gz: d5906200a77db100de8d206d1ac1c6872c70ce52
5
5
  SHA512:
6
- metadata.gz: 740bfae1d5e4545efba40f1a9406ac0451de90bb272ed2dc3c3d3bd2ff9581d744b5126503f953fcc445fddf4d4a4fcf051c87c2e3469ee9df0aa79d1ebc909b
7
- data.tar.gz: 23a0a0f6e43fa55e59ce5dc30b4ef81b389a3070ae28a3b98c020710a7a7013f3656f15dbe9288cde3e1ca3d238ae83912852c2cfe07ab115bc27bbc9d4c985c
6
+ metadata.gz: adfb7fab327abaeee14fa4dd54851319abae5f79a17da4c7125b7d28e1e2cdf1ca203a7e326f4fb87821654a7ddbbe2ef9b91b9b3f41045f3a7254e447a5f6ac
7
+ data.tar.gz: c831f84f10a65d5b7624631c6e470a607c05ef67b83f854bb177efe84368dcfc4493a8e12114bec8a2b2d865643b439958fcb311b459ebdcd26c15609d40f688
data/.rubocop.yml CHANGED
@@ -12,18 +12,18 @@ Layout/AlignHash:
12
12
  EnforcedColonStyle: table
13
13
 
14
14
  Metrics/ClassLength:
15
- Max: 120
16
-
17
- Metrics/LineLength:
18
15
  Max: 120
19
16
 
20
17
  Metrics/AbcSize:
21
18
  Max: 18
22
19
 
23
20
  Metrics/ParameterLists:
24
- Max: 5
21
+ Max: 7
25
22
  CountKeywordArgs: false
26
23
 
24
+ Metrics/LineLength:
25
+ Max: 120
26
+
27
27
  AllCops:
28
28
  TargetRubyVersion: 2.4
29
29
  DisplayCopNames: true
data/Gemfile.lock CHANGED
@@ -47,6 +47,9 @@ GEM
47
47
  rspec-expectations (3.7.0)
48
48
  diff-lcs (>= 1.2.0, < 2.0)
49
49
  rspec-support (~> 3.7.0)
50
+ rspec-its (1.2.0)
51
+ rspec-core (>= 3.0.0)
52
+ rspec-expectations (>= 3.0.0)
50
53
  rspec-mocks (3.7.0)
51
54
  diff-lcs (>= 1.2.0, < 2.0)
52
55
  rspec-support (~> 3.7.0)
@@ -85,10 +88,11 @@ DEPENDENCIES
85
88
  oneaccess!
86
89
  rake (~> 11.3)
87
90
  rspec (~> 3.6)
91
+ rspec-its (~> 1.2)
88
92
  rubocop (~> 0.55.0)
89
93
  simplecov
90
94
  simplecov-console
91
95
  webmock (~> 3.0.1)
92
96
 
93
97
  BUNDLED WITH
94
- 1.16.1
98
+ 1.16.2
data/README.md CHANGED
@@ -275,3 +275,28 @@ rescue ONEAccess::Error::APIError => e
275
275
  puts "Error getting providers users details"
276
276
  end
277
277
  ```
278
+
279
+ ### Create Buy Side Interaction _(/interactions/BuySideInteractions)_
280
+
281
+ Reference endpoint to get providers users details information.
282
+
283
+ Use UTC time zone for start_date and end_date parameter.
284
+
285
+ #### How to use:
286
+ ```ruby
287
+ begin
288
+ resp = ONEAccess::API::V3_0::Interactions.buy_side_interactions(
289
+ type: ONEAccess::API::V3_0::Interactions::Types::RESEARCH_READERSHIP,
290
+ start_date: "2019-05-30 08:00",
291
+ end_date: "2019-05-30 08:30",
292
+ user_id: "3264",
293
+ broker: "UBS",
294
+ company_name: "Aravt Global",
295
+ email: "test@aravtglobal.com"
296
+ )
297
+
298
+ resp #=> instance of ONEAccess::Response::BuySideInteractionsResponse
299
+ rescue ONEAccess::Error::APIError => e
300
+ puts "Error creating buysideinteraction"
301
+ end
302
+ ```
data/lib/oneaccess.rb CHANGED
@@ -28,6 +28,7 @@ require_relative "./oneaccess/api/v1_1/entitlement/research/user_requests"
28
28
  require_relative "./oneaccess/api/v3_0/base"
29
29
  require_relative "./oneaccess/api/v3_0/references"
30
30
  require_relative "./oneaccess/api/v3_0/providers"
31
+ require_relative "./oneaccess/api/v3_0/interactions"
31
32
 
32
33
  module ONEAccess
33
34
  def self.configure
@@ -0,0 +1,80 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "date"
4
+
5
+ require_relative "../../response/buy_side_interactions_response"
6
+
7
+ module ONEAccess
8
+ module API
9
+ module V3_0
10
+ class Interactions < Base
11
+ module Types
12
+ RESEARCH_READERSHIP = "Research Readership"
13
+ end
14
+
15
+ DATE_FORMAT = "%Y-%m-%d %H:%M"
16
+ DATE_FORMAT_REGEX = /\d{4}-\d{2}-\d{2} \d{2}:\d{2}/
17
+ private_constant :DATE_FORMAT
18
+ private_constant :DATE_FORMAT_REGEX
19
+
20
+ api_path "/interactions"
21
+
22
+ class << self
23
+ def buy_side_interactions(
24
+ type:,
25
+ start_date:,
26
+ end_date:,
27
+ user_id:,
28
+ broker:,
29
+ company_name:,
30
+ email:
31
+ )
32
+
33
+ validate_date(start_date)
34
+ validate_date(end_date)
35
+
36
+ response = send_post(
37
+ "buysideinteractions",
38
+ payload(type, start_date, end_date, user_id, broker, company_name, email)
39
+ )
40
+
41
+ Response::BuySideInteractionsResponse.from_json(response.body)
42
+ end
43
+
44
+ private
45
+
46
+ def validate_date(date_str)
47
+ raise "Invalid format, must be: yyyy-mm-dd hh:mm, was: #{date_str}" unless valid_date_format?(date_str)
48
+ raise "Invalid date: #{date_str}" unless valid_date?(date_str)
49
+
50
+ nil
51
+ end
52
+
53
+ def valid_date?(date_str, format = DATE_FORMAT)
54
+ Date.strptime(date_str, format)
55
+
56
+ true
57
+ rescue StandardError
58
+ false
59
+ end
60
+
61
+ def valid_date_format?(date_str)
62
+ date_str.match?(DATE_FORMAT_REGEX)
63
+ end
64
+
65
+ def payload(type, start_date, end_date, user_id, broker, company_name, email)
66
+ {
67
+ start_date: start_date,
68
+ end_date: end_date,
69
+ user_id: user_id.to_s,
70
+ interaction_type: type,
71
+ broker: broker.to_s,
72
+ investor: company_name.to_s,
73
+ investor_attendees: [{ email: email }]
74
+ }
75
+ end
76
+ end
77
+ end
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "./base_response"
4
+ require_relative "./representer/buy_side_interactions_response"
5
+
6
+ module ONEAccess
7
+ module Response
8
+ class BuySideInteractionsResponse < BaseResponse
9
+ extend Serializable
10
+
11
+ attr_accessor :event_id
12
+
13
+ represented_by Representer::BuySideInteractionsResponse
14
+ end
15
+ end
16
+ 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 BuySideInteractionsResponse < BaseResponse
9
+ property :event_id, as: :EventId
10
+ end
11
+ end
12
+ end
13
+ 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 = "1.0.1"
6
- s.date = "2018-05-07"
5
+ s.version = "1.1.0"
6
+ s.date = "2018-06-26"
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"
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.add_development_dependency "byebug"
20
20
  s.add_development_dependency "rake", "~> 11.3"
21
21
  s.add_development_dependency "rspec", "~> 3.6"
22
+ s.add_development_dependency "rspec-its", "~> 1.2"
22
23
  s.add_development_dependency "rubocop", "~> 0.55.0"
23
24
  s.add_development_dependency "simplecov"
24
25
  s.add_development_dependency "simplecov-console"
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: 1.0.1
4
+ version: 1.1.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-05-07 00:00:00.000000000 Z
11
+ date: 2018-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3.6'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec-its
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.2'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.2'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: rubocop
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -198,6 +212,7 @@ files:
198
212
  - lib/oneaccess/api/v1_1/symbology.rb
199
213
  - lib/oneaccess/api/v1_1/user.rb
200
214
  - lib/oneaccess/api/v3_0/base.rb
215
+ - lib/oneaccess/api/v3_0/interactions.rb
201
216
  - lib/oneaccess/api/v3_0/providers.rb
202
217
  - lib/oneaccess/api/v3_0/references.rb
203
218
  - lib/oneaccess/configuration.rb
@@ -259,6 +274,7 @@ files:
259
274
  - lib/oneaccess/request/investors_request_handler.rb
260
275
  - lib/oneaccess/response/api_error.rb
261
276
  - lib/oneaccess/response/base_response.rb
277
+ - lib/oneaccess/response/buy_side_interactions_response.rb
262
278
  - lib/oneaccess/response/changed_users_response.rb
263
279
  - lib/oneaccess/response/collection_response.rb
264
280
  - lib/oneaccess/response/companies_response.rb
@@ -274,6 +290,7 @@ files:
274
290
  - lib/oneaccess/response/providers_users_details_response.rb
275
291
  - lib/oneaccess/response/representer/api_error.rb
276
292
  - lib/oneaccess/response/representer/base_response.rb
293
+ - lib/oneaccess/response/representer/buy_side_interactions_response.rb
277
294
  - lib/oneaccess/response/representer/changed_users_response.rb
278
295
  - lib/oneaccess/response/representer/collection_response.rb
279
296
  - lib/oneaccess/response/representer/companies_response.rb