belvo 0.18.0 → 0.19.2
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 +4 -4
- data/.circleci/config.yml +1 -2
- data/.github/CODEOWNERS +1 -0
- data/Gemfile.lock +1 -1
- data/lib/belvo/http.rb +1 -1
- data/lib/belvo/options.rb +19 -0
- data/lib/belvo/resources.rb +68 -15
- data/lib/belvo/version.rb +1 -1
- data/lib/belvo.rb +12 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: efea687616660ff8f3d179ac0069cf8264ec2a0777d73e592b7510894a30cd4b
|
4
|
+
data.tar.gz: ce5e1215ba5278fb40e2192e77d9e1f4e6675e17436255d0b0e2f0d14cde97eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 827e7bc7c884745ccd3e6821edc3384e1585fd1033cef0e3efef0505898de894642c6d30b288cb2bdc4e131a6661cb35561a61cee5a9c0750e08e09e396d1e94
|
7
|
+
data.tar.gz: 37495bcce07c083dc5a0631b1a78e71a615e60abb9883b8c551d98a4a1c9b5304582f8d8da9f15b5e801e80210f6736872b2ac7d2bd0e8bb7b4d48e67a4dbac5
|
data/.circleci/config.yml
CHANGED
data/.github/CODEOWNERS
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
* @belvo-finance/ruby @belvo-finance/opensource
|
data/Gemfile.lock
CHANGED
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
|
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
@@ -70,7 +70,7 @@ module Belvo
|
|
70
70
|
|
71
71
|
def initialize(session)
|
72
72
|
super(session)
|
73
|
-
@endpoint = 'links/'
|
73
|
+
@endpoint = 'api/links/'
|
74
74
|
end
|
75
75
|
|
76
76
|
# Register a new link
|
@@ -158,7 +158,7 @@ module Belvo
|
|
158
158
|
class Account < Resource
|
159
159
|
def initialize(session)
|
160
160
|
super(session)
|
161
|
-
@endpoint = 'accounts/'
|
161
|
+
@endpoint = 'api/accounts/'
|
162
162
|
end
|
163
163
|
|
164
164
|
# Retrieve accounts from an existing link
|
@@ -183,7 +183,7 @@ module Belvo
|
|
183
183
|
class Transaction < Resource
|
184
184
|
def initialize(session)
|
185
185
|
super(session)
|
186
|
-
@endpoint = 'transactions/'
|
186
|
+
@endpoint = 'api/transactions/'
|
187
187
|
end
|
188
188
|
|
189
189
|
# Retrieve transactions from an existing link
|
@@ -213,7 +213,7 @@ module Belvo
|
|
213
213
|
class Owner < Resource
|
214
214
|
def initialize(session)
|
215
215
|
super(session)
|
216
|
-
@endpoint = 'owners/'
|
216
|
+
@endpoint = 'api/owners/'
|
217
217
|
end
|
218
218
|
|
219
219
|
# Retrieve owners from an existing link
|
@@ -237,7 +237,7 @@ module Belvo
|
|
237
237
|
class Balance < Resource
|
238
238
|
def initialize(session)
|
239
239
|
super(session)
|
240
|
-
@endpoint = 'balances/'
|
240
|
+
@endpoint = 'api/balances/'
|
241
241
|
end
|
242
242
|
|
243
243
|
# Retrieve balances from a specific account or all accounts from a
|
@@ -267,7 +267,7 @@ module Belvo
|
|
267
267
|
class Statement < Resource
|
268
268
|
def initialize(session)
|
269
269
|
super(session)
|
270
|
-
@endpoint = 'statements/'
|
270
|
+
@endpoint = 'api/statements/'
|
271
271
|
end
|
272
272
|
|
273
273
|
# Retrieve statements information from a specific banking link.
|
@@ -297,7 +297,7 @@ module Belvo
|
|
297
297
|
class Income < Resource
|
298
298
|
def initialize(session)
|
299
299
|
super(session)
|
300
|
-
@endpoint = 'incomes/'
|
300
|
+
@endpoint = 'api/incomes/'
|
301
301
|
end
|
302
302
|
|
303
303
|
# Retrieve incomes information from a specific banking link.
|
@@ -324,7 +324,7 @@ module Belvo
|
|
324
324
|
class Invoice < Resource
|
325
325
|
def initialize(session)
|
326
326
|
super(session)
|
327
|
-
@endpoint = 'invoices/'
|
327
|
+
@endpoint = 'api/invoices/'
|
328
328
|
end
|
329
329
|
|
330
330
|
# @param link [String] Link UUID
|
@@ -354,7 +354,7 @@ module Belvo
|
|
354
354
|
class RecurringExpenses < Resource
|
355
355
|
def initialize(session)
|
356
356
|
super(session)
|
357
|
-
@endpoint = 'recurring-expenses/'
|
357
|
+
@endpoint = 'api/recurring-expenses/'
|
358
358
|
end
|
359
359
|
|
360
360
|
# Retrieve recurring expenses information from a specific banking link
|
@@ -378,7 +378,7 @@ module Belvo
|
|
378
378
|
class RiskInsights < Resource
|
379
379
|
def initialize(session)
|
380
380
|
super(session)
|
381
|
-
@endpoint = 'risk-insights/'
|
381
|
+
@endpoint = 'api/risk-insights/'
|
382
382
|
end
|
383
383
|
|
384
384
|
# Retrieve risk insights information from a specific banking link
|
@@ -402,7 +402,7 @@ module Belvo
|
|
402
402
|
class TaxComplianceStatus < Resource
|
403
403
|
def initialize(session)
|
404
404
|
super(session)
|
405
|
-
@endpoint = 'tax-compliance-status/'
|
405
|
+
@endpoint = 'api/tax-compliance-status/'
|
406
406
|
end
|
407
407
|
|
408
408
|
# Retrieve tax compliance status information from a specific fiscal link.
|
@@ -433,7 +433,7 @@ module Belvo
|
|
433
433
|
class TaxReturn < Resource
|
434
434
|
def initialize(session)
|
435
435
|
super(session)
|
436
|
-
@endpoint = 'tax-returns/'
|
436
|
+
@endpoint = 'api/tax-returns/'
|
437
437
|
end
|
438
438
|
|
439
439
|
class TaxReturnType
|
@@ -478,7 +478,7 @@ module Belvo
|
|
478
478
|
class TaxStatus < Resource
|
479
479
|
def initialize(session)
|
480
480
|
super(session)
|
481
|
-
@endpoint = 'tax-status/'
|
481
|
+
@endpoint = 'api/tax-status/'
|
482
482
|
end
|
483
483
|
|
484
484
|
# Retrieve tax status information from a specific fiscal link.
|
@@ -508,7 +508,7 @@ module Belvo
|
|
508
508
|
class Institution < Resource
|
509
509
|
def initialize(session)
|
510
510
|
super(session)
|
511
|
-
@endpoint = 'institutions/'
|
511
|
+
@endpoint = 'api/institutions/'
|
512
512
|
end
|
513
513
|
end
|
514
514
|
|
@@ -518,7 +518,7 @@ module Belvo
|
|
518
518
|
class WidgetToken < Resource
|
519
519
|
def initialize(session)
|
520
520
|
super(session)
|
521
|
-
@endpoint = 'token/'
|
521
|
+
@endpoint = 'api/token/'
|
522
522
|
end
|
523
523
|
|
524
524
|
def create(options: nil)
|
@@ -538,4 +538,57 @@ module Belvo
|
|
538
538
|
@session.post(@endpoint, body)
|
539
539
|
end
|
540
540
|
end
|
541
|
+
|
542
|
+
# A InvestmentsPortfolio is a comprehensive view of your user's current
|
543
|
+
# investment holdings
|
544
|
+
class InvestmentsPortfolio < Resource
|
545
|
+
def initialize(session)
|
546
|
+
super(session)
|
547
|
+
@endpoint = 'investments/portfolios/'
|
548
|
+
end
|
549
|
+
|
550
|
+
# Retrieve investments portfolios from an existing link
|
551
|
+
# @param link [String] Link UUID
|
552
|
+
# @param options [InvestmentsPortfolioOptions] Configurable properties
|
553
|
+
# @return [Hash] created investments portfolios details
|
554
|
+
# @raise [RequestError] If response code is different than 2XX
|
555
|
+
def retrieve(link:, options: nil)
|
556
|
+
options = InvestmentsPortfolioOptions.from(options)
|
557
|
+
body = {
|
558
|
+
link: link,
|
559
|
+
token: options.token,
|
560
|
+
save_data: options.save_data || true
|
561
|
+
}.merge(options)
|
562
|
+
body = clean body: body
|
563
|
+
@session.post(@endpoint, body)
|
564
|
+
end
|
565
|
+
end
|
566
|
+
|
567
|
+
# A InvestmentsTransaction gets the existing transactions for an instrument
|
568
|
+
class InvestmentsTransaction < Resource
|
569
|
+
def initialize(session)
|
570
|
+
super(session)
|
571
|
+
@endpoint = 'investments/transactions/'
|
572
|
+
end
|
573
|
+
|
574
|
+
# Retrieve investments transactions from an existing link
|
575
|
+
# @param link [String] Link UUID
|
576
|
+
# @param date_from [String] Date string (YYYY-MM-DD)
|
577
|
+
# @param options [InvestmentsTransactionOptions] Configurable properties
|
578
|
+
# @return [Hash] created investments transactions details
|
579
|
+
# @raise [RequestError] If response code is different than 2XX
|
580
|
+
def retrieve(link:, date_from:, options: nil)
|
581
|
+
options = InvestmentsTransactionOptions.from(options)
|
582
|
+
date_to = options.date_to || Date.today.to_s
|
583
|
+
body = {
|
584
|
+
link: link,
|
585
|
+
date_from: date_from,
|
586
|
+
date_to: date_to,
|
587
|
+
token: options.token,
|
588
|
+
save_data: options.save_data || true
|
589
|
+
}.merge(options)
|
590
|
+
body = clean body: body
|
591
|
+
@session.post(@endpoint, body)
|
592
|
+
end
|
593
|
+
end
|
541
594
|
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.19.2
|
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: 2021-
|
11
|
+
date: 2021-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -148,6 +148,7 @@ 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"
|
@@ -193,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
193
194
|
- !ruby/object:Gem::Version
|
194
195
|
version: '0'
|
195
196
|
requirements: []
|
196
|
-
rubygems_version: 3.2.
|
197
|
+
rubygems_version: 3.2.32
|
197
198
|
signing_key:
|
198
199
|
specification_version: 4
|
199
200
|
summary: The Ruby gem for the Belvo API
|