belvo 0.6.0 → 0.8.0
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/.travis.yml +10 -1
- data/CODE_OF_CONDUCT.md +1 -1
- data/Gemfile.lock +27 -27
- data/README.md +15 -3
- data/belvo.gemspec +1 -1
- data/lib/belvo.rb +12 -0
- data/lib/belvo/http.rb +13 -0
- data/lib/belvo/options.rb +40 -0
- data/lib/belvo/resources.rb +73 -11
- data/lib/belvo/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 53c6172de053ccd0f9028de57bcbf117bf70203d145d43683aa2bb9ea655ff07
|
|
4
|
+
data.tar.gz: 68252e440ba5aad457873c11e4006e07498af01a339b807d8d5a2620e29e2d63
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 92b08d1c008377e9bffd4ca66fc6b7fa680bda7a2856a0eda10c62045eddf1e51c24e55074b34cf066d8f94c3412817c514f6a7a92bb23cab4c192c5a15f3b23
|
|
7
|
+
data.tar.gz: 814a61e039b60718acb159e33e4724eb59468857769363ec1746e4fbd14ebcccab4ff38ba462f145031dc647851cd15f454bfe165c66ff779b87f8bbe585d5d5
|
data/.travis.yml
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
---
|
|
2
1
|
language: ruby
|
|
3
2
|
cache: bundler
|
|
4
3
|
rvm:
|
|
@@ -7,3 +6,13 @@ before_install: gem install bundler -v 2.1.4
|
|
|
7
6
|
script:
|
|
8
7
|
- bundle exec rubocop
|
|
9
8
|
- bundle exec rspec spec
|
|
9
|
+
deploy:
|
|
10
|
+
provider: rubygems
|
|
11
|
+
api_key:
|
|
12
|
+
secure: nsKurIEds1W6zwyj0mDmYx77amlDJOycegZV9o+OrBOzRRcpT+O3oFHGouMzAQyIbdUtmWyXp9uJHBEz7Q6Zc5fy6iG05sGO7tFoJMlKiPE5piiOTM5y6qt1GjZ1MYIU0rpnsp9QDsVUR1ATGpoD9O/zzn/lOPbxp2FoWHqWra84D/1jvVXPTqslLgup+GDsxseiAfwTMoTy65TXodISkvoYtlPL3EBV4/XQVBjVGGtM5mdjDJg+YA4yVA2NwCCjhFcj88fRxBmqWRnG/pzmX3nyRlMGjtUBm8OpLSR1NiXXqgzYUAVMD8/8VL/h3OsBqvwqgjZKMO6rXqNKFJQAxYUqvJaLcHP8D05dxWlumqwxlHzscKWLjAe7JbVo2DiAMvMTR8NTJOI7LOraU10iFHtmwAVnyBOaSJUVJuFgAoybq9tqYoZ/uZ7shCuWVNUIWIQM7HN9v99tfvemXMB+2RIN565bzBWSorn5MvXsApvqCLLDFuRnt7urR+0ZyT4dKXgvWRhnNOQgiMwEE/8+Y66nKVB7iNxFDw6LtittyoOZ0HvbHQDtqXOkzT/yaq2Ff2zwuUNYrCHqcdnxg5TBOYg5ndurcFxAc77ZlNSvidEC9tgXHA1m+r0Vq+ZCWOiyyohX33ZfA/UsAIStKr7a6ZLZZywuiqXasg1O9XoRB74=
|
|
13
|
+
gem: belvo
|
|
14
|
+
on:
|
|
15
|
+
tags: true
|
|
16
|
+
repo: belvo-finance/belvo-ruby
|
|
17
|
+
branch: master
|
|
18
|
+
skip_cleanup: 'true'
|
data/CODE_OF_CONDUCT.md
CHANGED
|
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
|
|
|
55
55
|
## Enforcement
|
|
56
56
|
|
|
57
57
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
-
reported by contacting the project team at hello@belvo.
|
|
58
|
+
reported by contacting the project team at hello@belvo.com. All
|
|
59
59
|
complaints will be reviewed and investigated and will result in a response that
|
|
60
60
|
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
61
|
obligated to maintain confidentiality with regard to the reporter of an incident.
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
belvo (0.
|
|
4
|
+
belvo (0.8.0)
|
|
5
5
|
faraday
|
|
6
6
|
faraday_middleware
|
|
7
7
|
typhoeus
|
|
@@ -11,48 +11,48 @@ GEM
|
|
|
11
11
|
specs:
|
|
12
12
|
addressable (2.7.0)
|
|
13
13
|
public_suffix (>= 2.0.2, < 5.0)
|
|
14
|
-
ast (2.4.
|
|
14
|
+
ast (2.4.1)
|
|
15
15
|
coveralls (0.8.23)
|
|
16
16
|
json (>= 1.8, < 3)
|
|
17
17
|
simplecov (~> 0.16.1)
|
|
18
18
|
term-ansicolor (~> 1.3)
|
|
19
19
|
thor (>= 0.19.4, < 2.0)
|
|
20
20
|
tins (~> 1.6)
|
|
21
|
-
crack (0.4.
|
|
22
|
-
|
|
23
|
-
diff-lcs (1.3)
|
|
21
|
+
crack (0.4.4)
|
|
22
|
+
diff-lcs (1.4.4)
|
|
24
23
|
docile (1.3.2)
|
|
25
24
|
ethon (0.12.0)
|
|
26
25
|
ffi (>= 1.3.0)
|
|
27
|
-
faraday (1.0
|
|
26
|
+
faraday (1.1.0)
|
|
28
27
|
multipart-post (>= 1.2, < 3)
|
|
28
|
+
ruby2_keywords
|
|
29
29
|
faraday_middleware (1.0.0)
|
|
30
30
|
faraday (~> 1.0)
|
|
31
|
-
ffi (1.
|
|
31
|
+
ffi (1.13.1)
|
|
32
32
|
hashdiff (1.0.1)
|
|
33
33
|
jaro_winkler (1.5.4)
|
|
34
|
-
json (2.3.
|
|
34
|
+
json (2.3.1)
|
|
35
35
|
multipart-post (2.1.1)
|
|
36
|
-
parallel (1.
|
|
37
|
-
parser (2.7.
|
|
38
|
-
ast (~> 2.4.
|
|
39
|
-
public_suffix (4.0.
|
|
36
|
+
parallel (1.20.0)
|
|
37
|
+
parser (2.7.2.0)
|
|
38
|
+
ast (~> 2.4.1)
|
|
39
|
+
public_suffix (4.0.6)
|
|
40
40
|
rainbow (3.0.0)
|
|
41
41
|
rake (12.3.3)
|
|
42
42
|
rexml (3.2.4)
|
|
43
|
-
rspec (3.
|
|
44
|
-
rspec-core (~> 3.
|
|
45
|
-
rspec-expectations (~> 3.
|
|
46
|
-
rspec-mocks (~> 3.
|
|
47
|
-
rspec-core (3.
|
|
48
|
-
rspec-support (~> 3.
|
|
49
|
-
rspec-expectations (3.
|
|
43
|
+
rspec (3.10.0)
|
|
44
|
+
rspec-core (~> 3.10.0)
|
|
45
|
+
rspec-expectations (~> 3.10.0)
|
|
46
|
+
rspec-mocks (~> 3.10.0)
|
|
47
|
+
rspec-core (3.10.0)
|
|
48
|
+
rspec-support (~> 3.10.0)
|
|
49
|
+
rspec-expectations (3.10.0)
|
|
50
50
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
51
|
-
rspec-support (~> 3.
|
|
52
|
-
rspec-mocks (3.
|
|
51
|
+
rspec-support (~> 3.10.0)
|
|
52
|
+
rspec-mocks (3.10.0)
|
|
53
53
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
54
|
-
rspec-support (~> 3.
|
|
55
|
-
rspec-support (3.
|
|
54
|
+
rspec-support (~> 3.10.0)
|
|
55
|
+
rspec-support (3.10.0)
|
|
56
56
|
rubocop (0.81.0)
|
|
57
57
|
jaro_winkler (~> 1.5.1)
|
|
58
58
|
parallel (~> 1.10)
|
|
@@ -61,10 +61,10 @@ GEM
|
|
|
61
61
|
rexml
|
|
62
62
|
ruby-progressbar (~> 1.7)
|
|
63
63
|
unicode-display_width (>= 1.4.0, < 2.0)
|
|
64
|
-
rubocop-rspec (1.
|
|
64
|
+
rubocop-rspec (1.41.0)
|
|
65
65
|
rubocop (>= 0.68.1)
|
|
66
66
|
ruby-progressbar (1.10.1)
|
|
67
|
-
|
|
67
|
+
ruby2_keywords (0.0.2)
|
|
68
68
|
simplecov (0.16.1)
|
|
69
69
|
docile (~> 1.1)
|
|
70
70
|
json (>= 1.8, < 3)
|
|
@@ -74,12 +74,12 @@ GEM
|
|
|
74
74
|
term-ansicolor (1.7.1)
|
|
75
75
|
tins (~> 1.0)
|
|
76
76
|
thor (1.0.1)
|
|
77
|
-
tins (1.
|
|
77
|
+
tins (1.26.0)
|
|
78
78
|
sync
|
|
79
79
|
typhoeus (1.4.0)
|
|
80
80
|
ethon (>= 0.9.0)
|
|
81
81
|
unicode-display_width (1.7.0)
|
|
82
|
-
webmock (3.
|
|
82
|
+
webmock (3.9.5)
|
|
83
83
|
addressable (>= 2.3.6)
|
|
84
84
|
crack (>= 0.3.2)
|
|
85
85
|
hashdiff (>= 0.4.0, < 2.0.0)
|
data/README.md
CHANGED
|
@@ -5,8 +5,17 @@
|
|
|
5
5
|
<a href="https://coveralls.io/github/belvo-finance/belvo-ruby"><img alt="Coveralls github" src="https://img.shields.io/coveralls/github/belvo-finance/belvo-ruby?style=for-the-badge"></a>
|
|
6
6
|
<a href="https://codeclimate.com/github/belvo-finance/belvo-ruby"><img alt="CodeClimate maintainability" src="https://img.shields.io/codeclimate/maintainability/belvo-finance/belvo-ruby?style=for-the-badge"></a>
|
|
7
7
|
</p>
|
|
8
|
-
<p align="center"><a href="https://developers.belvo.co">Developers portal</a> | <a href="https://belvo-finance.github.io/belvo-ruby">Documentation</a></p>
|
|
9
8
|
|
|
9
|
+
## 📕 Documentation
|
|
10
|
+
How to use `belvo-ruby`: https://belvo-finance.github.io/belvo-ruby/
|
|
11
|
+
|
|
12
|
+
If you want to check the full documentation about Belvo API: https://docs.belvo.com
|
|
13
|
+
|
|
14
|
+
Or if you want to more information about:
|
|
15
|
+
* [Getting Belvo API keys](https://developers.belvo.com/docs/get-your-belvo-api-keys)
|
|
16
|
+
* [Using Connect Widget](https://developers.belvo.com/docs/connect-widget)
|
|
17
|
+
* [Testing in sandbox](https://developers.belvo.com/docs/test-in-sandbox)
|
|
18
|
+
* [Using webhooks and recurrent links](https://developers.belvo.com/docs/webhooks)
|
|
10
19
|
|
|
11
20
|
## Installation
|
|
12
21
|
|
|
@@ -32,14 +41,15 @@ require 'belvo'
|
|
|
32
41
|
belvo = Belvo::Client.new(
|
|
33
42
|
'af6e69ff-43fa-4e10-8d90-3d217309a1e5',
|
|
34
43
|
'gdi64m68Lc6xUjIKN3aJF2fZd51wD36lTjGVyJO5xQBfL7PRsgFef-ADXBxIhUnd',
|
|
35
|
-
'https://sandbox.belvo.
|
|
44
|
+
'https://sandbox.belvo.com'
|
|
36
45
|
)
|
|
37
46
|
|
|
38
47
|
begin
|
|
39
48
|
new_link = belvo.links.register(
|
|
40
49
|
institution: 'banamex_mx_retail',
|
|
41
50
|
username: 'janedoe',
|
|
42
|
-
password: 'super-secret'
|
|
51
|
+
password: 'super-secret',
|
|
52
|
+
options: { access_mode: Belvo::Link::AccessMode::SINGLE }
|
|
43
53
|
)
|
|
44
54
|
|
|
45
55
|
belvo.accounts.retrieve(link: new_link['id'])
|
|
@@ -51,6 +61,8 @@ rescue Belvo::RequestError => e
|
|
|
51
61
|
end
|
|
52
62
|
```
|
|
53
63
|
|
|
64
|
+
**Note:** If you create a `Link` without specifying [access_mode](https://docs.belvo.com/#operation/RegisterLink), the SDK will respect the default value from the API.
|
|
65
|
+
|
|
54
66
|
## Development
|
|
55
67
|
|
|
56
68
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/belvo.gemspec
CHANGED
|
@@ -6,7 +6,7 @@ Gem::Specification.new do |spec|
|
|
|
6
6
|
spec.name = 'belvo'
|
|
7
7
|
spec.version = Belvo::VERSION
|
|
8
8
|
spec.authors = ['Belvo Finance S.L.']
|
|
9
|
-
spec.email = ['
|
|
9
|
+
spec.email = ['sdks@belvo.com']
|
|
10
10
|
spec.license = 'MIT'
|
|
11
11
|
spec.summary = 'The Ruby gem for the Belvo API'
|
|
12
12
|
spec.description = %(Belvo is the leading Open Banking API platform in Latin
|
data/lib/belvo.rb
CHANGED
|
@@ -63,12 +63,24 @@ module Belvo
|
|
|
63
63
|
@statements = Statement.new @session
|
|
64
64
|
end
|
|
65
65
|
|
|
66
|
+
# Provides access to Incomes resource
|
|
67
|
+
# @return [Income]
|
|
68
|
+
def incomes
|
|
69
|
+
@incomes = Income.new @session
|
|
70
|
+
end
|
|
71
|
+
|
|
66
72
|
# Provides access to Invoices resource
|
|
67
73
|
# @return [Invoice]
|
|
68
74
|
def invoices
|
|
69
75
|
@invoices = Invoice.new @session
|
|
70
76
|
end
|
|
71
77
|
|
|
78
|
+
# Provides access to TaxComplianceStatus resource
|
|
79
|
+
# @return [TaxComplianceStatus]
|
|
80
|
+
def tax_compliance_status
|
|
81
|
+
@tax_compliance_status = TaxComplianceStatus.new @session
|
|
82
|
+
end
|
|
83
|
+
|
|
72
84
|
# Provides access to TaxReturns resource
|
|
73
85
|
# @return [TaxReturn]
|
|
74
86
|
def tax_returns
|
data/lib/belvo/http.rb
CHANGED
|
@@ -120,6 +120,19 @@ module Belvo
|
|
|
120
120
|
response.body
|
|
121
121
|
end
|
|
122
122
|
|
|
123
|
+
# Perform a POST request to an API endpoint
|
|
124
|
+
# @param path [String] API endpoint
|
|
125
|
+
# @param id [String] Resource UUID
|
|
126
|
+
# @param data [object] JSON parseable object
|
|
127
|
+
# @return [Hash] Response details
|
|
128
|
+
# @raise [RequestError] If response code is different than 2XX
|
|
129
|
+
def token(path, id, data)
|
|
130
|
+
resource_path = format('%<path>s%<id>s/token/', path: path, id: id)
|
|
131
|
+
response = @session.post(resource_path, data.to_json)
|
|
132
|
+
raise_for_status response
|
|
133
|
+
response.body
|
|
134
|
+
end
|
|
135
|
+
|
|
123
136
|
# Perform a POST request to an API endpoint
|
|
124
137
|
# @param path [String] API endpoint
|
|
125
138
|
# @param data [object] JSON parseable object
|
data/lib/belvo/options.rb
CHANGED
|
@@ -7,11 +7,17 @@ module Belvo
|
|
|
7
7
|
# Contains the configurable properties for a Link
|
|
8
8
|
# @!attribute access_mode [rw] Link access mode (SINGLE or RECURRENT)
|
|
9
9
|
# @!attribute token [rw] OTP token required by the institution
|
|
10
|
+
# @!attribute username2 [rw] End-user secondary username, if any
|
|
11
|
+
# @!attribute username3 [rw] End-user tertiary username, if any
|
|
12
|
+
# @!attribute password2 [rw] End-user secondary password, if any
|
|
10
13
|
# @!attribute encryption_key [rw] Custom encryption key
|
|
11
14
|
# @!attribute username_type [rw] Type of the username provided
|
|
12
15
|
class LinkOptions < Faraday::Options.new(
|
|
13
16
|
:access_mode,
|
|
14
17
|
:token,
|
|
18
|
+
:username2,
|
|
19
|
+
:username3,
|
|
20
|
+
:password2,
|
|
15
21
|
:encryption_key,
|
|
16
22
|
:username_type,
|
|
17
23
|
:certificate,
|
|
@@ -86,6 +92,16 @@ module Belvo
|
|
|
86
92
|
)
|
|
87
93
|
end
|
|
88
94
|
|
|
95
|
+
# @!class IncomeOptions < Faraday::Options
|
|
96
|
+
# Contains configurable properties of an Income
|
|
97
|
+
# @!attribute save_data [rw] Should data be persisted or not.
|
|
98
|
+
# @!attribute encryption_key [rw] Custom encryption key
|
|
99
|
+
class IncomeOptions < Faraday::Options.new(
|
|
100
|
+
:encryption_key,
|
|
101
|
+
:save_data
|
|
102
|
+
)
|
|
103
|
+
end
|
|
104
|
+
|
|
89
105
|
# @!class InvoiceOptions < Faraday::Options
|
|
90
106
|
# Contains configurable properties of an Invoice
|
|
91
107
|
# @!attribute save_data [rw] Should data be persisted or not.
|
|
@@ -101,6 +117,21 @@ module Belvo
|
|
|
101
117
|
)
|
|
102
118
|
end
|
|
103
119
|
|
|
120
|
+
# @!class TaxComplianceStatusOptions < Faraday::Options
|
|
121
|
+
# Contains configurable properties of a TaxComplianceStatus
|
|
122
|
+
# @!attribute save_data [rw] Should data be persisted or not.
|
|
123
|
+
# @!attribute token [rw] OTP token required by the institution
|
|
124
|
+
# @!attribute encryption_key [rw] Custom encryption key
|
|
125
|
+
# @!attribute attach_pdf [rw] Should the PDF file be included in the
|
|
126
|
+
# response or not.
|
|
127
|
+
class TaxComplianceStatusOptions < Faraday::Options.new(
|
|
128
|
+
:token,
|
|
129
|
+
:encryption_key,
|
|
130
|
+
:save_data,
|
|
131
|
+
:attach_pdf
|
|
132
|
+
)
|
|
133
|
+
end
|
|
134
|
+
|
|
104
135
|
# @!class TaxReturnOptions < Faraday::Options
|
|
105
136
|
# Contains configurable properties of a TaxReturn
|
|
106
137
|
# @!attribute save_data [rw] Should data be persisted or not.
|
|
@@ -130,4 +161,13 @@ module Belvo
|
|
|
130
161
|
:attach_pdf
|
|
131
162
|
)
|
|
132
163
|
end
|
|
164
|
+
# @!class WidgetTokenOptions < Faraday::Options
|
|
165
|
+
# Contains configurable properties of a WidgetToken
|
|
166
|
+
# @!attribute scopes [rw] Should have WidgetToken's permssions.
|
|
167
|
+
# @!attribute link_id [rw] Should the WidgetToken be tied to a specific link.
|
|
168
|
+
class WidgetTokenOptions < Faraday::Options.new(
|
|
169
|
+
:scopes,
|
|
170
|
+
:link_id
|
|
171
|
+
)
|
|
172
|
+
end
|
|
133
173
|
end
|
data/lib/belvo/resources.rb
CHANGED
|
@@ -77,7 +77,6 @@ module Belvo
|
|
|
77
77
|
# @param institution [String] Institution name
|
|
78
78
|
# @param username [String] End-user username
|
|
79
79
|
# @param password [String] End-user password
|
|
80
|
-
# @param password2 [String, nil] End-user secondary password, if any
|
|
81
80
|
# @param options [LinkOptions] Configurable properties
|
|
82
81
|
# @return [Hash] created link details
|
|
83
82
|
# @raise [RequestError] If response code is different than 2XX
|
|
@@ -85,7 +84,6 @@ module Belvo
|
|
|
85
84
|
institution:,
|
|
86
85
|
username:,
|
|
87
86
|
password:,
|
|
88
|
-
password2: nil,
|
|
89
87
|
options: nil
|
|
90
88
|
)
|
|
91
89
|
options = LinkOptions.from(options)
|
|
@@ -95,13 +93,7 @@ module Belvo
|
|
|
95
93
|
institution: institution,
|
|
96
94
|
username: username,
|
|
97
95
|
password: password,
|
|
98
|
-
|
|
99
|
-
token: options.token,
|
|
100
|
-
encryption_key: options.encryption_key,
|
|
101
|
-
access_mode: options.access_mode || AccessMode::SINGLE,
|
|
102
|
-
username_type: options.username_type,
|
|
103
|
-
certificate: options.certificate,
|
|
104
|
-
private_key: options.private_key
|
|
96
|
+
access_mode: options.access_mode
|
|
105
97
|
}.merge(options)
|
|
106
98
|
body = clean body: body
|
|
107
99
|
@session.post(@endpoint, body)
|
|
@@ -130,6 +122,18 @@ module Belvo
|
|
|
130
122
|
body = clean body: body
|
|
131
123
|
@session.put(@endpoint, id, body)
|
|
132
124
|
end
|
|
125
|
+
|
|
126
|
+
# Allows to create a token with client-specified scope and short TTL.
|
|
127
|
+
# @param id [String] Link UUID
|
|
128
|
+
# @param scopes [String] Configurable scopes eg: "read_links,write_links"
|
|
129
|
+
# @return [Hash] with a "refresh" and "access" token
|
|
130
|
+
# @raise [RequestError] If response code is different than 2XX
|
|
131
|
+
def token(id:, scopes:)
|
|
132
|
+
body = {
|
|
133
|
+
scopes: scopes
|
|
134
|
+
}
|
|
135
|
+
@session.token(@endpoint, id, body)
|
|
136
|
+
end
|
|
133
137
|
end
|
|
134
138
|
|
|
135
139
|
# An Account is the representation of a bank account inside a financial
|
|
@@ -277,6 +281,30 @@ module Belvo
|
|
|
277
281
|
end
|
|
278
282
|
end
|
|
279
283
|
|
|
284
|
+
# A Income contains a resume of monthly Transactions inside an Account.
|
|
285
|
+
class Income < Resource
|
|
286
|
+
def initialize(session)
|
|
287
|
+
super(session)
|
|
288
|
+
@endpoint = 'incomes/'
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
# Retrieve incomes information from a specific banking link.
|
|
292
|
+
# @param link [String] Link UUID
|
|
293
|
+
# @param options [IncomesOptions] Configurable properties
|
|
294
|
+
# @return [Hash] created incomes details
|
|
295
|
+
# @raise [RequestError] If response code is different than 2XX
|
|
296
|
+
def retrieve(link:, options: nil)
|
|
297
|
+
options = IncomeOptions.from(options)
|
|
298
|
+
body = {
|
|
299
|
+
link: link,
|
|
300
|
+
encryption_key: options.encryption_key,
|
|
301
|
+
save_data: options.save_data || true
|
|
302
|
+
}.merge(options)
|
|
303
|
+
body = clean body: body
|
|
304
|
+
@session.post(@endpoint, body)
|
|
305
|
+
end
|
|
306
|
+
end
|
|
307
|
+
|
|
280
308
|
# An Invoice is the representation of an electronic invoice, that can be
|
|
281
309
|
# received or sent, by a business or an individual and has been uploaded
|
|
282
310
|
# to the fiscal institution website
|
|
@@ -309,6 +337,38 @@ module Belvo
|
|
|
309
337
|
end
|
|
310
338
|
end
|
|
311
339
|
|
|
340
|
+
# A Tax compliance status is the representation of the tax situation
|
|
341
|
+
# of a person or a business to the tax authority in the country.
|
|
342
|
+
class TaxComplianceStatus < Resource
|
|
343
|
+
def initialize(session)
|
|
344
|
+
super(session)
|
|
345
|
+
@endpoint = 'tax-compliance-status/'
|
|
346
|
+
end
|
|
347
|
+
|
|
348
|
+
# Retrieve tax compliance status information from a specific fiscal link.
|
|
349
|
+
# @param link [String] Link UUID
|
|
350
|
+
# @param options [TaxComplianceStatusOptions] Configurable properties
|
|
351
|
+
# @return [Hash] created tax compliance status details
|
|
352
|
+
# @raise [RequestError] If response code is different than 2XX
|
|
353
|
+
def retrieve(link:, options: nil)
|
|
354
|
+
options = TaxComplianceStatusOptions.from(options)
|
|
355
|
+
body = {
|
|
356
|
+
link: link,
|
|
357
|
+
token: options.token,
|
|
358
|
+
encryption_key: options.encryption_key,
|
|
359
|
+
save_data: options.save_data || true,
|
|
360
|
+
attach_pdf: options.attach_pdf
|
|
361
|
+
}.merge(options)
|
|
362
|
+
body = clean body: body
|
|
363
|
+
@session.post(@endpoint, body)
|
|
364
|
+
end
|
|
365
|
+
|
|
366
|
+
def resume(_session_id, _token, _link: nil)
|
|
367
|
+
raise NotImplementedError 'TaxComplianceStatus does not support'\
|
|
368
|
+
' resuming a session'
|
|
369
|
+
end
|
|
370
|
+
end
|
|
371
|
+
|
|
312
372
|
# A Tax return is the representation of the tax return document sent every
|
|
313
373
|
# year by a person or a business to the tax authority in the country.
|
|
314
374
|
class TaxReturn < Resource
|
|
@@ -393,12 +453,14 @@ module Belvo
|
|
|
393
453
|
@endpoint = 'token/'
|
|
394
454
|
end
|
|
395
455
|
|
|
396
|
-
def create
|
|
456
|
+
def create(options: nil)
|
|
457
|
+
options = WidgetTokenOptions.from(options)
|
|
397
458
|
body = {
|
|
398
459
|
id: @session.key_id,
|
|
399
460
|
password: @session.key_password,
|
|
400
461
|
scopes: 'read_institutions,write_links,read_links,delete_links'
|
|
401
|
-
}
|
|
462
|
+
}.merge(options)
|
|
463
|
+
body = clean body: body
|
|
402
464
|
@session.post(@endpoint, body)
|
|
403
465
|
end
|
|
404
466
|
end
|
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.8.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: 2021-02-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|
|
@@ -141,7 +141,7 @@ description: |-
|
|
|
141
141
|
America and the easiest way for users to connect their
|
|
142
142
|
account to an app
|
|
143
143
|
email:
|
|
144
|
-
-
|
|
144
|
+
- sdks@belvo.com
|
|
145
145
|
executables: []
|
|
146
146
|
extensions: []
|
|
147
147
|
extra_rdoc_files: []
|
|
@@ -191,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
191
191
|
- !ruby/object:Gem::Version
|
|
192
192
|
version: '0'
|
|
193
193
|
requirements: []
|
|
194
|
-
rubygems_version: 3.
|
|
194
|
+
rubygems_version: 3.0.8
|
|
195
195
|
signing_key:
|
|
196
196
|
specification_version: 4
|
|
197
197
|
summary: The Ruby gem for the Belvo API
|