belvo 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/belvo.rb +6 -0
- data/lib/belvo/options.rb +18 -1
- data/lib/belvo/resources.rb +40 -8
- data/lib/belvo/version.rb +1 -1
- 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: ff048795b869d8968a35be333ebbd05e4455b11324c0112e936bb864c2ed6b54
|
4
|
+
data.tar.gz: 5cbe5998bc9c47cd37918a1f7d511608316076ac95fa8b5219c6f5a5fa6e56fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7823be7ba6522dd1e137d0cb74afe0e732384f18bbc887e617320693de58511c51fdad8db8c4582d013c897a38505662a938f4412e92acc068c0804b9bcc3237
|
7
|
+
data.tar.gz: a3ff06d08002a13e6ea8107d1c5d8e89c3ef3ae881b601b8dd1b0c5e95d8c986e51140d53400537d75bbe347d376f30a270955bc59ad53a9a4615616527d210c
|
data/Gemfile.lock
CHANGED
data/lib/belvo.rb
CHANGED
@@ -75,6 +75,12 @@ module Belvo
|
|
75
75
|
@tax_returns = TaxReturn.new @session
|
76
76
|
end
|
77
77
|
|
78
|
+
# Provides access to TaxStatus resource
|
79
|
+
# @return [TaxStatus]
|
80
|
+
def tax_status
|
81
|
+
@tax_status = TaxStatus.new @session
|
82
|
+
end
|
83
|
+
|
78
84
|
# Provides access to Instituions resource
|
79
85
|
# @return [Institution]
|
80
86
|
def institutions
|
data/lib/belvo/options.rb
CHANGED
@@ -8,10 +8,12 @@ module Belvo
|
|
8
8
|
# @!attribute access_mode [rw] Link access mode (SINGLE or RECURRENT)
|
9
9
|
# @!attribute token [rw] OTP token required by the institution
|
10
10
|
# @!attribute encryption_key [rw] Custom encryption key
|
11
|
+
# @!attribute username_type [rw] Type of the username provided
|
11
12
|
class LinkOptions < Faraday::Options.new(
|
12
13
|
:access_mode,
|
13
14
|
:token,
|
14
|
-
:encryption_key
|
15
|
+
:encryption_key,
|
16
|
+
:username_type
|
15
17
|
)
|
16
18
|
end
|
17
19
|
|
@@ -111,4 +113,19 @@ module Belvo
|
|
111
113
|
:attach_pdf
|
112
114
|
)
|
113
115
|
end
|
116
|
+
|
117
|
+
# @!class TaxStatusOptions < Faraday::Options
|
118
|
+
# Contains configurable properties of a TaxStatus
|
119
|
+
# @!attribute save_data [rw] Should data be persisted or not.
|
120
|
+
# @!attribute token [rw] OTP token required by the institution
|
121
|
+
# @!attribute encryption_key [rw] Custom encryption key
|
122
|
+
# @!attribute attach_pdf [rw] Should the PDF file be included in the
|
123
|
+
# response or not.
|
124
|
+
class TaxStatusOptions < Faraday::Options.new(
|
125
|
+
:token,
|
126
|
+
:encryption_key,
|
127
|
+
:save_data,
|
128
|
+
:attach_pdf
|
129
|
+
)
|
130
|
+
end
|
114
131
|
end
|
data/lib/belvo/resources.rb
CHANGED
@@ -95,7 +95,8 @@ module Belvo
|
|
95
95
|
password2: password2,
|
96
96
|
token: options.token,
|
97
97
|
encryption_key: options.encryption_key,
|
98
|
-
access_mode: options.access_mode || AccessMode::SINGLE
|
98
|
+
access_mode: options.access_mode || AccessMode::SINGLE,
|
99
|
+
username_type: options.username_type
|
99
100
|
}.merge(options)
|
100
101
|
body = clean body: body
|
101
102
|
@session.post(@endpoint, body)
|
@@ -132,7 +133,7 @@ module Belvo
|
|
132
133
|
# Retrieve accounts from an existing link
|
133
134
|
# @param link [String] Link UUID
|
134
135
|
# @param options [AccountOptions] Configurable properties
|
135
|
-
# @return [Hash] created
|
136
|
+
# @return [Hash] created accounts details
|
136
137
|
# @raise [RequestError] If response code is different than 2XX
|
137
138
|
def retrieve(link:, options: nil)
|
138
139
|
options = AccountOptions.from(options)
|
@@ -159,7 +160,7 @@ module Belvo
|
|
159
160
|
# @param link [String] Link UUID
|
160
161
|
# @param date_from [String] Date string (YYYY-MM-DD)
|
161
162
|
# @param options [TransactionOptions] Configurable properties
|
162
|
-
# @return [Hash] created
|
163
|
+
# @return [Hash] created transactions details
|
163
164
|
# @raise [RequestError] If response code is different than 2XX
|
164
165
|
def retrieve(link:, date_from:, options: nil)
|
165
166
|
options = TransactionOptions.from(options)
|
@@ -189,7 +190,7 @@ module Belvo
|
|
189
190
|
# Retrieve owners from an existing link
|
190
191
|
# @param link [String] Link UUID
|
191
192
|
# @param options [OwnerOptions] Configurable properties
|
192
|
-
# @return [Hash] created
|
193
|
+
# @return [Hash] created owners details
|
193
194
|
# @raise [RequestError] If response code is different than 2XX
|
194
195
|
def retrieve(link:, options: nil)
|
195
196
|
options = OwnerOptions.from(options)
|
@@ -216,7 +217,7 @@ module Belvo
|
|
216
217
|
# @param link [String] Link UUID
|
217
218
|
# @param date_from [String] Date string (YYYY-MM-DD)
|
218
219
|
# @param options [BalanceOptions] Configurable properties
|
219
|
-
# @return [Hash] created
|
220
|
+
# @return [Hash] created balances details
|
220
221
|
# @raise [RequestError] If response code is different than 2XX
|
221
222
|
def retrieve(link:, date_from:, options: nil)
|
222
223
|
options = BalanceOptions.from(options)
|
@@ -247,7 +248,7 @@ module Belvo
|
|
247
248
|
# @param year [Integer]
|
248
249
|
# @param month [Integer]
|
249
250
|
# @param options [StatementOptions] Configurable properties
|
250
|
-
# @return [Hash] created
|
251
|
+
# @return [Hash] created statement details
|
251
252
|
# @raise [RequestError] If response code is different than 2XX
|
252
253
|
def retrieve(link:, account:, year:, month:, options: nil)
|
253
254
|
options = StatementOptions.from(options)
|
@@ -279,7 +280,7 @@ module Belvo
|
|
279
280
|
# @param date_from [String] Date string (YYYY-MM-DD)
|
280
281
|
# @param date_to [String] Date string (YYYY-MM-DD)
|
281
282
|
# @param options [InvoiceOptions] Configurable properties
|
282
|
-
# @return [Hash] created
|
283
|
+
# @return [Hash] created invoices details
|
283
284
|
# @raise [RequestError] If response code is different than 2XX
|
284
285
|
def retrieve(link:, date_from:, date_to:, type:, options: nil)
|
285
286
|
options = InvoiceOptions.from(options)
|
@@ -311,7 +312,7 @@ module Belvo
|
|
311
312
|
# @param year_from [Integer]
|
312
313
|
# @param year_to [Integer]
|
313
314
|
# @param options [TaxReturnOptions] Configurable properties
|
314
|
-
# @return [Hash] created
|
315
|
+
# @return [Hash] created tax returns details
|
315
316
|
# @raise [RequestError] If response code is different than 2XX
|
316
317
|
def retrieve(link:, year_from:, year_to:, options: nil)
|
317
318
|
options = TaxReturnOptions.from(options)
|
@@ -333,6 +334,37 @@ module Belvo
|
|
333
334
|
end
|
334
335
|
end
|
335
336
|
|
337
|
+
# A Tax status is the representation of the tax situation of a person or a
|
338
|
+
# business to the tax authority in the country.
|
339
|
+
class TaxStatus < Resource
|
340
|
+
def initialize(session)
|
341
|
+
super(session)
|
342
|
+
@endpoint = 'tax-status/'
|
343
|
+
end
|
344
|
+
|
345
|
+
# Retrieve tax status information from a specific fiscal link.
|
346
|
+
# @param link [String] Link UUID
|
347
|
+
# @param options [TaxStatusOptions] Configurable properties
|
348
|
+
# @return [Hash] created tax status details
|
349
|
+
# @raise [RequestError] If response code is different than 2XX
|
350
|
+
def retrieve(link:, options: nil)
|
351
|
+
options = TaxStatusOptions.from(options)
|
352
|
+
body = {
|
353
|
+
link: link,
|
354
|
+
token: options.token,
|
355
|
+
encryption_key: options.encryption_key,
|
356
|
+
save_data: options.save_data || true,
|
357
|
+
attach_pdf: options.attach_pdf
|
358
|
+
}.merge(options)
|
359
|
+
body = clean body: body
|
360
|
+
@session.post(@endpoint, body)
|
361
|
+
end
|
362
|
+
|
363
|
+
def resume(_session_id, _token, _link: nil)
|
364
|
+
raise NotImplementedError 'TaxReturn does not support resuming a session.'
|
365
|
+
end
|
366
|
+
end
|
367
|
+
|
336
368
|
# An Institution is an entity that Belvo can access information from. It can
|
337
369
|
# be a bank or fiscal type of institutions such as the SAT in Mexico.
|
338
370
|
class Institution < Resource
|
data/lib/belvo/version.rb
CHANGED
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.4.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: 2020-04-
|
11
|
+
date: 2020-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -190,7 +190,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
190
190
|
- !ruby/object:Gem::Version
|
191
191
|
version: '0'
|
192
192
|
requirements: []
|
193
|
-
|
193
|
+
rubyforge_project:
|
194
|
+
rubygems_version: 2.7.6
|
194
195
|
signing_key:
|
195
196
|
specification_version: 4
|
196
197
|
summary: The Ruby gem for the Belvo API
|