belvo 0.7.0 → 0.12.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: 8eec099b22dbcb9dbac55982ac84c447bdae2f69c5f06bb310ea8a1be8889b1d
4
- data.tar.gz: dfe77adac6722c395f8b31c867a2a803dabd226fcbda6452ffb29dbe6310e412
3
+ metadata.gz: d3ccb9e6a9841f2313f4a3307a67c3a0527fad92b91f3a84a607150b2bd86dd8
4
+ data.tar.gz: 1103d2e823428b7a1db97821714bd60764cd0c649d59c1876b309cf2f20e0b8d
5
5
  SHA512:
6
- metadata.gz: 71f7405acc9de362147b1182644c0af7bfe358160d070eaaae59b41d95caec18800d9bb589e61ef7dd0ae6ef2c22418cda0dfcd636d1f5165ae430d01b5dd0be
7
- data.tar.gz: 90c3ce711c21df50880301629d3555f8dff981441e1dc30e1065e5182550dfd1e1bf43e282d47e58da05cd8131669eb00974f48aa7879ca22c06cf11b94d46a7
6
+ metadata.gz: f95143ddfe260d93a6462c70e224df80dd43d2c0a76db8c38b8176d0471643fd22de8db22e2f7299d527dd4c7f56842b3c19045a5d2482c9dfc0a0cdaa4b6566
7
+ data.tar.gz: 85ac380d5e207a78915c4a84c21d2efaf03c76f525e49080a5ef9192931b39b1e983df207e8e614cbdc5c4dcf7c0ca2c69cd64cb403839cb5f1c459b572db658
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.7.0)
4
+ belvo (0.12.0)
5
5
  faraday
6
6
  faraday_middleware
7
7
  typhoeus
@@ -39,7 +39,7 @@ GEM
39
39
  public_suffix (4.0.6)
40
40
  rainbow (3.0.0)
41
41
  rake (12.3.3)
42
- rexml (3.2.4)
42
+ rexml (3.2.5)
43
43
  rspec (3.10.0)
44
44
  rspec-core (~> 3.10.0)
45
45
  rspec-expectations (~> 3.10.0)
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2020 Belvo
3
+ Copyright (c) 2020 Belvo Technologies Inc.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
  ## 📕 Documentation
10
10
  How to use `belvo-ruby`: https://belvo-finance.github.io/belvo-ruby/
11
11
 
12
- If you want to check the full documentation about Belvo API: https://docs.belvo.co
12
+ If you want to check the full documentation about Belvo API: https://docs.belvo.com
13
13
 
14
14
  Or if you want to more information about:
15
15
  * [Getting Belvo API keys](https://developers.belvo.com/docs/get-your-belvo-api-keys)
@@ -41,7 +41,7 @@ require 'belvo'
41
41
  belvo = Belvo::Client.new(
42
42
  'af6e69ff-43fa-4e10-8d90-3d217309a1e5',
43
43
  'gdi64m68Lc6xUjIKN3aJF2fZd51wD36lTjGVyJO5xQBfL7PRsgFef-ADXBxIhUnd',
44
- 'https://sandbox.belvo.co'
44
+ 'https://sandbox.belvo.com'
45
45
  )
46
46
 
47
47
  begin
@@ -61,6 +61,8 @@ rescue Belvo::RequestError => e
61
61
  end
62
62
  ```
63
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
+
64
66
  ## Development
65
67
 
66
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.
@@ -71,6 +73,12 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
71
73
 
72
74
  Bug reports and pull requests are welcome on GitHub at https://github.com/belvo-finance/belvo-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/belvo-finance/belvo-ruby/blob/master/CODE_OF_CONDUCT.md).
73
75
 
76
+ If you wish to submit a pull request, please be sure check the items on this list:
77
+ - [ ] Tests related to the changed code were executed
78
+ - [ ] The source code has been coded following the OWASP security best practices (https://owasp.org/www-pdf-archive/OWASP_SCP_Quick_Reference_Guide_v2.pdf).
79
+ - [ ] Commit message properly labeled
80
+ - [ ] There is a ticket associated to each PR.
81
+
74
82
 
75
83
  ## Code of Conduct
76
84
 
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/http.rb CHANGED
@@ -99,8 +99,7 @@ module Belvo
99
99
 
100
100
  break unless response.body['next']
101
101
 
102
- path = response.body['next']
103
- params = nil
102
+ params = Faraday::Utils.parse_query URI(response.body['next']).query
104
103
  end
105
104
  end
106
105
 
data/lib/belvo/options.rb CHANGED
@@ -21,7 +21,8 @@ module Belvo
21
21
  :encryption_key,
22
22
  :username_type,
23
23
  :certificate,
24
- :private_key
24
+ :private_key,
25
+ :external_id
25
26
  )
26
27
  end
27
28
 
@@ -117,6 +118,21 @@ module Belvo
117
118
  )
118
119
  end
119
120
 
121
+ # @!class TaxComplianceStatusOptions < Faraday::Options
122
+ # Contains configurable properties of a TaxComplianceStatus
123
+ # @!attribute save_data [rw] Should data be persisted or not.
124
+ # @!attribute token [rw] OTP token required by the institution
125
+ # @!attribute encryption_key [rw] Custom encryption key
126
+ # @!attribute attach_pdf [rw] Should the PDF file be included in the
127
+ # response or not.
128
+ class TaxComplianceStatusOptions < Faraday::Options.new(
129
+ :token,
130
+ :encryption_key,
131
+ :save_data,
132
+ :attach_pdf
133
+ )
134
+ end
135
+
120
136
  # @!class TaxReturnOptions < Faraday::Options
121
137
  # Contains configurable properties of a TaxReturn
122
138
  # @!attribute save_data [rw] Should data be persisted or not.
@@ -146,4 +162,15 @@ module Belvo
146
162
  :attach_pdf
147
163
  )
148
164
  end
165
+ # @!class WidgetTokenOptions < Faraday::Options
166
+ # Contains configurable properties of a WidgetToken
167
+ # @!attribute scopes [rw] Should have WidgetToken's permssions.
168
+ # @!attribute link [rw] Should the WidgetToken be tied to a specific link.
169
+ # @!attribute widget [rw] Should have the Widget branding params.
170
+ class WidgetTokenOptions < Faraday::Options.new(
171
+ :scopes,
172
+ :link,
173
+ :widget
174
+ )
175
+ end
149
176
  end
@@ -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,20 @@ 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
+ widget = options.widget
460
+ options.delete('link')
461
+ options.delete('widget')
425
462
  body = {
426
463
  id: @session.key_id,
427
464
  password: @session.key_password,
428
- scopes: 'read_institutions,write_links,read_links,delete_links'
429
- }
465
+ scopes: 'read_institutions,write_links,read_links',
466
+ link_id: link_id,
467
+ widget: widget
468
+ }.merge(options)
469
+ body = clean body: body
430
470
  @session.post(@endpoint, body)
431
471
  end
432
472
  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.7.0'
5
+ VERSION = '0.12.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.7.0
4
+ version: 0.12.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-11-25 00:00:00.000000000 Z
11
+ date: 2021-05-12 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: []