belvo 0.18.0 → 0.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +1 -2
- data/.github/CODEOWNERS +1 -0
- data/.github/workflows/generate-docs.yml +26 -0
- data/.rubocop.yml +3 -0
- data/Gemfile +0 -11
- data/Gemfile.lock +60 -42
- data/lib/belvo/http.rb +5 -5
- data/lib/belvo/options.rb +19 -0
- data/lib/belvo/resources.rb +74 -18
- data/lib/belvo/version.rb +1 -1
- data/lib/belvo.rb +12 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05a03ab57113f17e822b4f48dd813edf5206bacfb79a757332fce693a60db786
|
4
|
+
data.tar.gz: 2676ef16eabab4fcbd553ec28cf7378539eb468387954a2754b62d1c6642fe6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 522bc53deacef6bc63010a44d837acc100560bd9cb5a3721eea94cde3b37abb3090c385c9c0c2d411ebfd39fe9c1c88fc905ba03dc6bf70cb2ed58899af0f1c8
|
7
|
+
data.tar.gz: 4bcee96d178f49fc23bac577725560f279f21e8a96670694b5d0f2918871e0ea5e332ba09b421769e24740217402e45c55f6e2bdfaaeda0c04caba00d0d92411
|
data/.circleci/config.yml
CHANGED
data/.github/CODEOWNERS
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
* @belvo-finance/ruby @belvo-finance/opensource
|
@@ -0,0 +1,26 @@
|
|
1
|
+
name: Build & deploy Ruby SDK documentation
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
branches:
|
5
|
+
- master
|
6
|
+
jobs:
|
7
|
+
build:
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
name: Update gh-pages with docs
|
10
|
+
steps:
|
11
|
+
- name: Checkout Belvo Ruby SDK repo
|
12
|
+
uses: actions/checkout@v2
|
13
|
+
- name: Set up Ruby
|
14
|
+
uses: actions/setup-ruby@v1
|
15
|
+
with:
|
16
|
+
ruby-version: "2.7"
|
17
|
+
- name: Install required gem dependencies
|
18
|
+
run: gem install yard --no-document
|
19
|
+
- name: Build RUBY SDK docs with YARD
|
20
|
+
run: yardoc --output-dir docs
|
21
|
+
- name: Deploy docs to gh-pages branch
|
22
|
+
uses: peaceiris/actions-gh-pages@v3
|
23
|
+
with:
|
24
|
+
github_token: ${{ secrets.GITHUB_TOKEN }}
|
25
|
+
publish_dir: ./docs
|
26
|
+
publish_branch: gh-pages
|
data/.rubocop.yml
CHANGED
data/Gemfile
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# rubocop:disable all
|
2
1
|
# frozen_string_literal: true
|
3
2
|
|
4
3
|
source 'https://rubygems.org'
|
@@ -6,14 +5,4 @@ source 'https://rubygems.org'
|
|
6
5
|
# Specify your gem's dependencies in belvo.gemspec
|
7
6
|
gemspec
|
8
7
|
|
9
|
-
gem 'coveralls_reborn', require: false
|
10
|
-
gem 'faraday'
|
11
|
-
gem 'faraday_middleware'
|
12
|
-
gem 'rake', '~> 12.0'
|
13
|
-
gem 'rspec', '~> 3.0'
|
14
|
-
gem 'rubocop', '~> 0.81.0', require: false
|
15
|
-
gem 'rubocop-rspec', require: false
|
16
|
-
gem 'typhoeus'
|
17
8
|
gem 'danger', '8.2.1'
|
18
|
-
gem 'webmock'
|
19
|
-
# rubocop:enable all
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
belvo (0.
|
4
|
+
belvo (0.20.0)
|
5
5
|
faraday
|
6
6
|
faraday_middleware
|
7
7
|
typhoeus
|
@@ -11,8 +11,8 @@ GEM
|
|
11
11
|
specs:
|
12
12
|
addressable (2.8.0)
|
13
13
|
public_suffix (>= 2.0.2, < 5.0)
|
14
|
-
ast (2.4.
|
15
|
-
claide (1.0
|
14
|
+
ast (2.4.2)
|
15
|
+
claide (1.1.0)
|
16
16
|
claide-plugins (0.9.2)
|
17
17
|
cork
|
18
18
|
nap
|
@@ -20,12 +20,13 @@ GEM
|
|
20
20
|
colored2 (3.1.2)
|
21
21
|
cork (0.3.0)
|
22
22
|
colored2 (~> 3.1)
|
23
|
-
coveralls_reborn (0.
|
23
|
+
coveralls_reborn (0.24.0)
|
24
24
|
simplecov (>= 0.18.1, < 0.22.0)
|
25
25
|
term-ansicolor (~> 1.6)
|
26
26
|
thor (>= 0.20.3, < 2.0)
|
27
27
|
tins (~> 1.16)
|
28
|
-
crack (0.4.
|
28
|
+
crack (0.4.5)
|
29
|
+
rexml
|
29
30
|
danger (8.2.1)
|
30
31
|
claide (~> 1.0)
|
31
32
|
claide-plugins (>= 0.9.2)
|
@@ -39,54 +40,74 @@ GEM
|
|
39
40
|
no_proxy_fix
|
40
41
|
octokit (~> 4.7)
|
41
42
|
terminal-table (~> 1)
|
42
|
-
diff-lcs (1.
|
43
|
+
diff-lcs (1.5.0)
|
43
44
|
docile (1.4.0)
|
44
|
-
ethon (0.
|
45
|
-
ffi (>= 1.
|
46
|
-
faraday (1.
|
47
|
-
|
48
|
-
|
45
|
+
ethon (0.15.0)
|
46
|
+
ffi (>= 1.15.0)
|
47
|
+
faraday (1.10.0)
|
48
|
+
faraday-em_http (~> 1.0)
|
49
|
+
faraday-em_synchrony (~> 1.0)
|
50
|
+
faraday-excon (~> 1.1)
|
51
|
+
faraday-httpclient (~> 1.0)
|
52
|
+
faraday-multipart (~> 1.0)
|
53
|
+
faraday-net_http (~> 1.0)
|
54
|
+
faraday-net_http_persistent (~> 1.0)
|
55
|
+
faraday-patron (~> 1.0)
|
56
|
+
faraday-rack (~> 1.0)
|
57
|
+
faraday-retry (~> 1.0)
|
58
|
+
ruby2_keywords (>= 0.0.4)
|
59
|
+
faraday-em_http (1.0.0)
|
60
|
+
faraday-em_synchrony (1.0.0)
|
61
|
+
faraday-excon (1.1.0)
|
49
62
|
faraday-http-cache (2.2.0)
|
50
63
|
faraday (>= 0.8)
|
51
|
-
|
64
|
+
faraday-httpclient (1.0.1)
|
65
|
+
faraday-multipart (1.0.3)
|
66
|
+
multipart-post (>= 1.2, < 3)
|
67
|
+
faraday-net_http (1.0.1)
|
68
|
+
faraday-net_http_persistent (1.2.0)
|
69
|
+
faraday-patron (1.0.0)
|
70
|
+
faraday-rack (1.0.0)
|
71
|
+
faraday-retry (1.0.3)
|
72
|
+
faraday_middleware (1.2.0)
|
52
73
|
faraday (~> 1.0)
|
53
|
-
ffi (1.
|
54
|
-
git (1.
|
74
|
+
ffi (1.15.5)
|
75
|
+
git (1.11.0)
|
55
76
|
rchardet (~> 1.8)
|
56
77
|
hashdiff (1.0.1)
|
57
78
|
jaro_winkler (1.5.4)
|
58
|
-
kramdown (2.
|
79
|
+
kramdown (2.4.0)
|
59
80
|
rexml
|
60
81
|
kramdown-parser-gfm (1.1.0)
|
61
82
|
kramdown (~> 2.0)
|
62
83
|
multipart-post (2.1.1)
|
63
84
|
nap (1.1.0)
|
64
85
|
no_proxy_fix (0.1.2)
|
65
|
-
octokit (4.
|
86
|
+
octokit (4.22.0)
|
66
87
|
faraday (>= 0.9)
|
67
88
|
sawyer (~> 0.8.0, >= 0.5.3)
|
68
89
|
open4 (1.3.4)
|
69
|
-
parallel (1.
|
70
|
-
parser (
|
90
|
+
parallel (1.22.1)
|
91
|
+
parser (3.1.2.0)
|
71
92
|
ast (~> 2.4.1)
|
72
|
-
public_suffix (4.0.
|
73
|
-
rainbow (3.
|
93
|
+
public_suffix (4.0.7)
|
94
|
+
rainbow (3.1.1)
|
74
95
|
rake (12.3.3)
|
75
96
|
rchardet (1.8.0)
|
76
97
|
rexml (3.2.5)
|
77
|
-
rspec (3.
|
78
|
-
rspec-core (~> 3.
|
79
|
-
rspec-expectations (~> 3.
|
80
|
-
rspec-mocks (~> 3.
|
81
|
-
rspec-core (3.
|
82
|
-
rspec-support (~> 3.
|
83
|
-
rspec-expectations (3.
|
98
|
+
rspec (3.11.0)
|
99
|
+
rspec-core (~> 3.11.0)
|
100
|
+
rspec-expectations (~> 3.11.0)
|
101
|
+
rspec-mocks (~> 3.11.0)
|
102
|
+
rspec-core (3.11.0)
|
103
|
+
rspec-support (~> 3.11.0)
|
104
|
+
rspec-expectations (3.11.0)
|
84
105
|
diff-lcs (>= 1.2.0, < 2.0)
|
85
|
-
rspec-support (~> 3.
|
86
|
-
rspec-mocks (3.
|
106
|
+
rspec-support (~> 3.11.0)
|
107
|
+
rspec-mocks (3.11.1)
|
87
108
|
diff-lcs (>= 1.2.0, < 2.0)
|
88
|
-
rspec-support (~> 3.
|
89
|
-
rspec-support (3.
|
109
|
+
rspec-support (~> 3.11.0)
|
110
|
+
rspec-support (3.11.0)
|
90
111
|
rubocop (0.81.0)
|
91
112
|
jaro_winkler (~> 1.5.1)
|
92
113
|
parallel (~> 1.10)
|
@@ -97,8 +118,8 @@ GEM
|
|
97
118
|
unicode-display_width (>= 1.4.0, < 2.0)
|
98
119
|
rubocop-rspec (1.41.0)
|
99
120
|
rubocop (>= 0.68.1)
|
100
|
-
ruby-progressbar (1.
|
101
|
-
ruby2_keywords (0.0.
|
121
|
+
ruby-progressbar (1.11.0)
|
122
|
+
ruby2_keywords (0.0.5)
|
102
123
|
sawyer (0.8.2)
|
103
124
|
addressable (>= 2.3.5)
|
104
125
|
faraday (> 0.8, < 2.0)
|
@@ -107,20 +128,20 @@ GEM
|
|
107
128
|
simplecov-html (~> 0.11)
|
108
129
|
simplecov_json_formatter (~> 0.1)
|
109
130
|
simplecov-html (0.12.3)
|
110
|
-
simplecov_json_formatter (0.1.
|
131
|
+
simplecov_json_formatter (0.1.4)
|
111
132
|
sync (0.5.0)
|
112
133
|
term-ansicolor (1.7.1)
|
113
134
|
tins (~> 1.0)
|
114
135
|
terminal-table (1.8.0)
|
115
136
|
unicode-display_width (~> 1.1, >= 1.1.1)
|
116
|
-
thor (1.1
|
117
|
-
tins (1.
|
137
|
+
thor (1.2.1)
|
138
|
+
tins (1.31.0)
|
118
139
|
sync
|
119
140
|
typhoeus (1.4.0)
|
120
141
|
ethon (>= 0.9.0)
|
121
|
-
unicode-display_width (1.
|
122
|
-
webmock (3.
|
123
|
-
addressable (>= 2.
|
142
|
+
unicode-display_width (1.8.0)
|
143
|
+
webmock (3.14.0)
|
144
|
+
addressable (>= 2.8.0)
|
124
145
|
crack (>= 0.3.2)
|
125
146
|
hashdiff (>= 0.4.0, < 2.0.0)
|
126
147
|
|
@@ -131,13 +152,10 @@ DEPENDENCIES
|
|
131
152
|
belvo!
|
132
153
|
coveralls_reborn
|
133
154
|
danger (= 8.2.1)
|
134
|
-
faraday
|
135
|
-
faraday_middleware
|
136
155
|
rake (~> 12.0)
|
137
156
|
rspec (~> 3.0)
|
138
157
|
rubocop (~> 0.81.0)
|
139
158
|
rubocop-rspec
|
140
|
-
typhoeus
|
141
159
|
webmock
|
142
160
|
|
143
161
|
BUNDLED WITH
|
data/lib/belvo/http.rb
CHANGED
@@ -17,7 +17,7 @@ module Belvo
|
|
17
17
|
# @param url [String] Belvo API host url
|
18
18
|
# @return [Faraday::Connection]
|
19
19
|
def initialize(url)
|
20
|
-
@url = format('%<url>s/
|
20
|
+
@url = format('%<url>s/', url: url)
|
21
21
|
@session = Faraday::Connection.new(url: @url) do |faraday|
|
22
22
|
faraday.adapter :typhoeus
|
23
23
|
faraday.response :json
|
@@ -41,7 +41,7 @@ module Belvo
|
|
41
41
|
raise RequestError.new(
|
42
42
|
'Request error',
|
43
43
|
response.status,
|
44
|
-
response.body
|
44
|
+
response.body
|
45
45
|
)
|
46
46
|
end
|
47
47
|
response
|
@@ -51,8 +51,8 @@ module Belvo
|
|
51
51
|
# @return [Boolean] True if credentials are valid to authenticate
|
52
52
|
# to Belvo API else False.
|
53
53
|
def authenticate
|
54
|
-
@session.basic_auth
|
55
|
-
response = @session.get('')
|
54
|
+
@session.request(:basic_auth, @key_id, @key_password)
|
55
|
+
response = @session.get('api/')
|
56
56
|
response.success?
|
57
57
|
end
|
58
58
|
|
@@ -113,7 +113,7 @@ module Belvo
|
|
113
113
|
params = {} if params.nil?
|
114
114
|
|
115
115
|
resource_path = format('%<path>s%<id>s/', path: path, id: id)
|
116
|
-
response = get(resource_path, params)
|
116
|
+
response = get(resource_path, **params)
|
117
117
|
|
118
118
|
raise_for_status response
|
119
119
|
response.body
|
data/lib/belvo/options.rb
CHANGED
@@ -175,4 +175,23 @@ module Belvo
|
|
175
175
|
:widget
|
176
176
|
)
|
177
177
|
end
|
178
|
+
|
179
|
+
# @!class InvestmentsPortfolioOptions < Faraday::Options
|
180
|
+
# Contains configurable properties of an InvestmentsPortfolio
|
181
|
+
# @!attribute save_data [rw] Should data be persisted or not.
|
182
|
+
# @!attribute token [rw] OTP token required by the institution
|
183
|
+
class InvestmentsPortfolioOptions < Faraday::Options.new(:token, :save_data)
|
184
|
+
end
|
185
|
+
|
186
|
+
# @!class InvestmentsTransactionOptions < Faraday::Options
|
187
|
+
# Contains configurable properties of an InvestmentsTransaction
|
188
|
+
# @!attribute date_to [rw] Date string (YYYY-MM-DD)
|
189
|
+
# @!attribute save_data [rw] Should data be persisted or not.
|
190
|
+
# @!attribute token [rw] OTP token required by the institution
|
191
|
+
class InvestmentsTransactionOptions < Faraday::Options.new(
|
192
|
+
:date_to,
|
193
|
+
:token,
|
194
|
+
:save_data
|
195
|
+
)
|
196
|
+
end
|
178
197
|
end
|
data/lib/belvo/resources.rb
CHANGED
@@ -25,11 +25,14 @@ module Belvo
|
|
25
25
|
|
26
26
|
# List all results
|
27
27
|
# @param params [Hash] Extra parameters sent as query strings.
|
28
|
-
# @return [Array]
|
28
|
+
# @return [Array] List of results when no block is passed.
|
29
|
+
# @yield [Hash] Each result to be processed individually.
|
29
30
|
# @raise [RequestError] If response code is different than 2XX
|
30
31
|
def list(params: nil)
|
31
|
-
results = []
|
32
|
-
@session.list(@endpoint, params: params)
|
32
|
+
results = block_given? ? nil : []
|
33
|
+
@session.list(@endpoint, params: params) do |item|
|
34
|
+
results.nil? ? yield(item) : results.push(item)
|
35
|
+
end
|
33
36
|
results
|
34
37
|
end
|
35
38
|
|
@@ -70,7 +73,7 @@ module Belvo
|
|
70
73
|
|
71
74
|
def initialize(session)
|
72
75
|
super(session)
|
73
|
-
@endpoint = 'links/'
|
76
|
+
@endpoint = 'api/links/'
|
74
77
|
end
|
75
78
|
|
76
79
|
# Register a new link
|
@@ -158,7 +161,7 @@ module Belvo
|
|
158
161
|
class Account < Resource
|
159
162
|
def initialize(session)
|
160
163
|
super(session)
|
161
|
-
@endpoint = 'accounts/'
|
164
|
+
@endpoint = 'api/accounts/'
|
162
165
|
end
|
163
166
|
|
164
167
|
# Retrieve accounts from an existing link
|
@@ -183,7 +186,7 @@ module Belvo
|
|
183
186
|
class Transaction < Resource
|
184
187
|
def initialize(session)
|
185
188
|
super(session)
|
186
|
-
@endpoint = 'transactions/'
|
189
|
+
@endpoint = 'api/transactions/'
|
187
190
|
end
|
188
191
|
|
189
192
|
# Retrieve transactions from an existing link
|
@@ -213,7 +216,7 @@ module Belvo
|
|
213
216
|
class Owner < Resource
|
214
217
|
def initialize(session)
|
215
218
|
super(session)
|
216
|
-
@endpoint = 'owners/'
|
219
|
+
@endpoint = 'api/owners/'
|
217
220
|
end
|
218
221
|
|
219
222
|
# Retrieve owners from an existing link
|
@@ -237,7 +240,7 @@ module Belvo
|
|
237
240
|
class Balance < Resource
|
238
241
|
def initialize(session)
|
239
242
|
super(session)
|
240
|
-
@endpoint = 'balances/'
|
243
|
+
@endpoint = 'api/balances/'
|
241
244
|
end
|
242
245
|
|
243
246
|
# Retrieve balances from a specific account or all accounts from a
|
@@ -267,7 +270,7 @@ module Belvo
|
|
267
270
|
class Statement < Resource
|
268
271
|
def initialize(session)
|
269
272
|
super(session)
|
270
|
-
@endpoint = 'statements/'
|
273
|
+
@endpoint = 'api/statements/'
|
271
274
|
end
|
272
275
|
|
273
276
|
# Retrieve statements information from a specific banking link.
|
@@ -297,7 +300,7 @@ module Belvo
|
|
297
300
|
class Income < Resource
|
298
301
|
def initialize(session)
|
299
302
|
super(session)
|
300
|
-
@endpoint = 'incomes/'
|
303
|
+
@endpoint = 'api/incomes/'
|
301
304
|
end
|
302
305
|
|
303
306
|
# Retrieve incomes information from a specific banking link.
|
@@ -324,7 +327,7 @@ module Belvo
|
|
324
327
|
class Invoice < Resource
|
325
328
|
def initialize(session)
|
326
329
|
super(session)
|
327
|
-
@endpoint = 'invoices/'
|
330
|
+
@endpoint = 'api/invoices/'
|
328
331
|
end
|
329
332
|
|
330
333
|
# @param link [String] Link UUID
|
@@ -354,7 +357,7 @@ module Belvo
|
|
354
357
|
class RecurringExpenses < Resource
|
355
358
|
def initialize(session)
|
356
359
|
super(session)
|
357
|
-
@endpoint = 'recurring-expenses/'
|
360
|
+
@endpoint = 'api/recurring-expenses/'
|
358
361
|
end
|
359
362
|
|
360
363
|
# Retrieve recurring expenses information from a specific banking link
|
@@ -378,7 +381,7 @@ module Belvo
|
|
378
381
|
class RiskInsights < Resource
|
379
382
|
def initialize(session)
|
380
383
|
super(session)
|
381
|
-
@endpoint = 'risk-insights/'
|
384
|
+
@endpoint = 'api/risk-insights/'
|
382
385
|
end
|
383
386
|
|
384
387
|
# Retrieve risk insights information from a specific banking link
|
@@ -402,7 +405,7 @@ module Belvo
|
|
402
405
|
class TaxComplianceStatus < Resource
|
403
406
|
def initialize(session)
|
404
407
|
super(session)
|
405
|
-
@endpoint = 'tax-compliance-status/'
|
408
|
+
@endpoint = 'api/tax-compliance-status/'
|
406
409
|
end
|
407
410
|
|
408
411
|
# Retrieve tax compliance status information from a specific fiscal link.
|
@@ -433,7 +436,7 @@ module Belvo
|
|
433
436
|
class TaxReturn < Resource
|
434
437
|
def initialize(session)
|
435
438
|
super(session)
|
436
|
-
@endpoint = 'tax-returns/'
|
439
|
+
@endpoint = 'api/tax-returns/'
|
437
440
|
end
|
438
441
|
|
439
442
|
class TaxReturnType
|
@@ -478,7 +481,7 @@ module Belvo
|
|
478
481
|
class TaxStatus < Resource
|
479
482
|
def initialize(session)
|
480
483
|
super(session)
|
481
|
-
@endpoint = 'tax-status/'
|
484
|
+
@endpoint = 'api/tax-status/'
|
482
485
|
end
|
483
486
|
|
484
487
|
# Retrieve tax status information from a specific fiscal link.
|
@@ -508,7 +511,7 @@ module Belvo
|
|
508
511
|
class Institution < Resource
|
509
512
|
def initialize(session)
|
510
513
|
super(session)
|
511
|
-
@endpoint = 'institutions/'
|
514
|
+
@endpoint = 'api/institutions/'
|
512
515
|
end
|
513
516
|
end
|
514
517
|
|
@@ -518,7 +521,7 @@ module Belvo
|
|
518
521
|
class WidgetToken < Resource
|
519
522
|
def initialize(session)
|
520
523
|
super(session)
|
521
|
-
@endpoint = 'token/'
|
524
|
+
@endpoint = 'api/token/'
|
522
525
|
end
|
523
526
|
|
524
527
|
def create(options: nil)
|
@@ -538,4 +541,57 @@ module Belvo
|
|
538
541
|
@session.post(@endpoint, body)
|
539
542
|
end
|
540
543
|
end
|
544
|
+
|
545
|
+
# A InvestmentsPortfolio is a comprehensive view of your user's current
|
546
|
+
# investment holdings
|
547
|
+
class InvestmentsPortfolio < Resource
|
548
|
+
def initialize(session)
|
549
|
+
super(session)
|
550
|
+
@endpoint = 'investments/portfolios/'
|
551
|
+
end
|
552
|
+
|
553
|
+
# Retrieve investments portfolios from an existing link
|
554
|
+
# @param link [String] Link UUID
|
555
|
+
# @param options [InvestmentsPortfolioOptions] Configurable properties
|
556
|
+
# @return [Hash] created investments portfolios details
|
557
|
+
# @raise [RequestError] If response code is different than 2XX
|
558
|
+
def retrieve(link:, options: nil)
|
559
|
+
options = InvestmentsPortfolioOptions.from(options)
|
560
|
+
body = {
|
561
|
+
link: link,
|
562
|
+
token: options.token,
|
563
|
+
save_data: options.save_data || true
|
564
|
+
}.merge(options)
|
565
|
+
body = clean body: body
|
566
|
+
@session.post(@endpoint, body)
|
567
|
+
end
|
568
|
+
end
|
569
|
+
|
570
|
+
# A InvestmentsTransaction gets the existing transactions for an instrument
|
571
|
+
class InvestmentsTransaction < Resource
|
572
|
+
def initialize(session)
|
573
|
+
super(session)
|
574
|
+
@endpoint = 'investments/transactions/'
|
575
|
+
end
|
576
|
+
|
577
|
+
# Retrieve investments transactions from an existing link
|
578
|
+
# @param link [String] Link UUID
|
579
|
+
# @param date_from [String] Date string (YYYY-MM-DD)
|
580
|
+
# @param options [InvestmentsTransactionOptions] Configurable properties
|
581
|
+
# @return [Hash] created investments transactions details
|
582
|
+
# @raise [RequestError] If response code is different than 2XX
|
583
|
+
def retrieve(link:, date_from:, options: nil)
|
584
|
+
options = InvestmentsTransactionOptions.from(options)
|
585
|
+
date_to = options.date_to || Date.today.to_s
|
586
|
+
body = {
|
587
|
+
link: link,
|
588
|
+
date_from: date_from,
|
589
|
+
date_to: date_to,
|
590
|
+
token: options.token,
|
591
|
+
save_data: options.save_data || true
|
592
|
+
}.merge(options)
|
593
|
+
body = clean body: body
|
594
|
+
@session.post(@endpoint, body)
|
595
|
+
end
|
596
|
+
end
|
541
597
|
end
|
data/lib/belvo/version.rb
CHANGED
data/lib/belvo.rb
CHANGED
@@ -121,5 +121,17 @@ module Belvo
|
|
121
121
|
def widget_token
|
122
122
|
@widget_token = WidgetToken.new @session
|
123
123
|
end
|
124
|
+
|
125
|
+
# Provides access to InvestmentsPortfolio resource
|
126
|
+
# @return [InvestmentsPortfolio]
|
127
|
+
def investments_portfolio
|
128
|
+
@investments_portfolio = InvestmentsPortfolio.new @session
|
129
|
+
end
|
130
|
+
|
131
|
+
# Provides access to InvestmentsTransaction resource
|
132
|
+
# @return [InvestmentsTransaction]
|
133
|
+
def investments_transaction
|
134
|
+
@investments_transaction = InvestmentsTransaction.new @session
|
135
|
+
end
|
124
136
|
end
|
125
137
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: belvo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Belvo Finance S.L.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -148,9 +148,11 @@ extra_rdoc_files: []
|
|
148
148
|
files:
|
149
149
|
- ".circleci/config.yml"
|
150
150
|
- ".codeclimate.yml"
|
151
|
+
- ".github/CODEOWNERS"
|
151
152
|
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
152
153
|
- ".github/pull_request_template.md"
|
153
154
|
- ".github/workflows/danger-pr-reviews.yml"
|
155
|
+
- ".github/workflows/generate-docs.yml"
|
154
156
|
- ".gitignore"
|
155
157
|
- ".rspec"
|
156
158
|
- ".rubocop.yml"
|
@@ -193,7 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
193
195
|
- !ruby/object:Gem::Version
|
194
196
|
version: '0'
|
195
197
|
requirements: []
|
196
|
-
rubygems_version: 3.
|
198
|
+
rubygems_version: 3.3.11
|
197
199
|
signing_key:
|
198
200
|
specification_version: 4
|
199
201
|
summary: The Ruby gem for the Belvo API
|