belvo 0.6.2 → 0.10.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
  SHA256:
3
- metadata.gz: f7e008d86a0b4f4ff368e9027711fc3b32a81886e8a5f392d5c67f84bb417c89
4
- data.tar.gz: 7aa7a82b3ee88a0b0cb6f837edaab45996fc8f6eed41024996711cdebd3f9905
3
+ metadata.gz: d8e956f90ab794d8165e888ebb059212e3e7ea4ee2f6ca6526a6223473086fd9
4
+ data.tar.gz: c177f509945811c6df6f64367270118763cf48bbc3728dbcd4c8b880ee7d79b3
5
5
  SHA512:
6
- metadata.gz: a03bc5b178bf8065bdbd8a04eaf94ba627abbabe212c272ec64d782ba4edf804a22eae7e5c75275857501e22d23708eab6efe3521dc0d589a862ce01c61ee7a8
7
- data.tar.gz: 28f60a6dc881c85b213a64c6881eca73fac7f18659a534e16a3bc6eff5c4013c09db9d635a79c2f3c59af90c5214311559335d989f37f35e401db0273610e29f
6
+ metadata.gz: 9a09abefb67fad3b3bc8244dfff5a93f49069ddb4a213e833d27724a41a3276683c6e23d8c386790efe5bd9ea07a6f4ff10d76dbd7eecb384cf5c76739e6f063
7
+ data.tar.gz: 87cd5325266f6987429d0061f7589cf7cd617164171f0126da439672d0e2f03256a7608d7deec25e61f1ac1705173cea4ca25dc03805253345bcec8b465dbdd4
data/.travis.yml CHANGED
@@ -14,4 +14,5 @@ deploy:
14
14
  on:
15
15
  tags: true
16
16
  repo: belvo-finance/belvo-ruby
17
+ branch: master
17
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.co. All
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.6.2)
4
+ belvo (0.10.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.0)
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.3)
22
- safe_yaml (~> 1.0.0)
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.1)
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.12.2)
31
+ ffi (1.13.1)
32
32
  hashdiff (1.0.1)
33
33
  jaro_winkler (1.5.4)
34
- json (2.3.0)
34
+ json (2.3.1)
35
35
  multipart-post (2.1.1)
36
- parallel (1.19.1)
37
- parser (2.7.1.2)
38
- ast (~> 2.4.0)
39
- public_suffix (4.0.5)
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.9.0)
44
- rspec-core (~> 3.9.0)
45
- rspec-expectations (~> 3.9.0)
46
- rspec-mocks (~> 3.9.0)
47
- rspec-core (3.9.2)
48
- rspec-support (~> 3.9.3)
49
- rspec-expectations (3.9.2)
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.9.0)
52
- rspec-mocks (3.9.1)
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.9.0)
55
- rspec-support (3.9.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.39.0)
64
+ rubocop-rspec (1.41.0)
65
65
  rubocop (>= 0.68.1)
66
66
  ruby-progressbar (1.10.1)
67
- safe_yaml (1.0.5)
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.25.0)
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.8.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.co'
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 = ['sdks@belvo.co']
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
@@ -75,6 +75,12 @@ module Belvo
75
75
  @invoices = Invoice.new @session
76
76
  end
77
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
+
78
84
  # Provides access to TaxReturns resource
79
85
  # @return [TaxReturn]
80
86
  def tax_returns
data/lib/belvo/options.rb CHANGED
@@ -8,6 +8,7 @@ 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 username2 [rw] End-user secondary username, if any
11
+ # @!attribute username3 [rw] End-user tertiary username, if any
11
12
  # @!attribute password2 [rw] End-user secondary password, if any
12
13
  # @!attribute encryption_key [rw] Custom encryption key
13
14
  # @!attribute username_type [rw] Type of the username provided
@@ -15,6 +16,7 @@ module Belvo
15
16
  :access_mode,
16
17
  :token,
17
18
  :username2,
19
+ :username3,
18
20
  :password2,
19
21
  :encryption_key,
20
22
  :username_type,
@@ -115,6 +117,21 @@ module Belvo
115
117
  )
116
118
  end
117
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
+
118
135
  # @!class TaxReturnOptions < Faraday::Options
119
136
  # Contains configurable properties of a TaxReturn
120
137
  # @!attribute save_data [rw] Should data be persisted or not.
@@ -144,4 +161,13 @@ module Belvo
144
161
  :attach_pdf
145
162
  )
146
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 [rw] Should the WidgetToken be tied to a specific link.
168
+ class WidgetTokenOptions < Faraday::Options.new(
169
+ :scopes,
170
+ :link
171
+ )
172
+ end
147
173
  end
@@ -93,7 +93,7 @@ module Belvo
93
93
  institution: institution,
94
94
  username: username,
95
95
  password: password,
96
- access_mode: options.access_mode || AccessMode::SINGLE
96
+ access_mode: options.access_mode
97
97
  }.merge(options)
98
98
  body = clean body: body
99
99
  @session.post(@endpoint, body)
@@ -337,6 +337,38 @@ module Belvo
337
337
  end
338
338
  end
339
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
+
340
372
  # A Tax return is the representation of the tax return document sent every
341
373
  # year by a person or a business to the tax authority in the country.
342
374
  class TaxReturn < Resource
@@ -421,12 +453,17 @@ module Belvo
421
453
  @endpoint = 'token/'
422
454
  end
423
455
 
424
- def create
456
+ def create(options: nil)
457
+ options = WidgetTokenOptions.from(options)
458
+ link_id = options.link
459
+ options.delete('link')
425
460
  body = {
426
461
  id: @session.key_id,
427
462
  password: @session.key_password,
428
- scopes: 'read_institutions,write_links,read_links,delete_links'
429
- }
463
+ scopes: 'read_institutions,write_links,read_links',
464
+ link_id: link_id
465
+ }.merge(options)
466
+ body = clean body: body
430
467
  @session.post(@endpoint, body)
431
468
  end
432
469
  end
data/lib/belvo/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Belvo
4
4
  # belvo-ruby current version
5
- VERSION = '0.6.2'
5
+ VERSION = '0.10.0'
6
6
  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.6.2
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Belvo Finance S.L.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-08 00:00:00.000000000 Z
11
+ date: 2021-02-24 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
- - sdks@belvo.co
144
+ - sdks@belvo.com
145
145
  executables: []
146
146
  extensions: []
147
147
  extra_rdoc_files: []
@@ -176,7 +176,7 @@ metadata:
176
176
  homepage_uri: https://github.com/belvo-finance/belvo-ruby
177
177
  source_code_uri: https://github.com/belvo-finance/belvo-ruby
178
178
  changelog_uri: https://github.com/belvo-finance/belvo-ruby/blob/master/README.md
179
- post_install_message:
179
+ post_install_message:
180
180
  rdoc_options: []
181
181
  require_paths:
182
182
  - lib
@@ -191,8 +191,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
191
191
  - !ruby/object:Gem::Version
192
192
  version: '0'
193
193
  requirements: []
194
- rubygems_version: 3.1.4
195
- signing_key:
194
+ rubygems_version: 3.0.8
195
+ signing_key:
196
196
  specification_version: 4
197
197
  summary: The Ruby gem for the Belvo API
198
198
  test_files: []