belvo 0.9.0 → 0.13.1
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/.github/workflows/danger-pr-reviews.yml +48 -0
- data/Dangerfile +21 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +44 -2
- data/LICENSE +1 -1
- data/README.md +6 -0
- data/lib/belvo/http.rb +1 -2
- data/lib/belvo/options.rb +9 -3
- data/lib/belvo/resources.rb +38 -6
- data/lib/belvo/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 426490295ec3ff52627ef0cc1e70a27c418837827947da27e416ccadaa7214ee
|
|
4
|
+
data.tar.gz: 92630f9d7c9a72dc57d7c1677edb1f1f90bde1442ed787ab5a375d5d8b6871e2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 58500920831162b704712f0d44e949a3502c0dafe0cd58eb080522c15302a28ec1b2761d2d72058ca1f5e3777da5f75bd629001d72ed70b7a682b65c2037c18f
|
|
7
|
+
data.tar.gz: ff5c028732ffce74c00630c7e2bb22f38eb3a7e602ecb55b31578ee4eba975e341f5be29d45174575dbd37884304281f73ef9cdc55aed8aa3085aadea31fc7cd
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
name: Run Danger
|
|
2
|
+
|
|
3
|
+
on: [pull_request]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
build:
|
|
7
|
+
name: Run Danger
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
|
|
10
|
+
steps:
|
|
11
|
+
- name: Checkout Code
|
|
12
|
+
uses: actions/checkout@v2
|
|
13
|
+
with:
|
|
14
|
+
fetch-depth: 1
|
|
15
|
+
|
|
16
|
+
# Setup ruby
|
|
17
|
+
- name: Set up Ruby 2.6
|
|
18
|
+
uses: actions/setup-ruby@v1
|
|
19
|
+
with:
|
|
20
|
+
ruby-version: 2.6
|
|
21
|
+
|
|
22
|
+
# Install the right bundler version
|
|
23
|
+
- name: Install bundler
|
|
24
|
+
run: gem install bundler
|
|
25
|
+
|
|
26
|
+
# Cache dependencies
|
|
27
|
+
- name: Cache ruby dependencies
|
|
28
|
+
id: cache-ruby
|
|
29
|
+
uses: actions/cache@v2
|
|
30
|
+
with:
|
|
31
|
+
path: vendor/bundle
|
|
32
|
+
key: union-gems-${{ hashFiles('**/Gemfile.lock') }}
|
|
33
|
+
restore-keys: |
|
|
34
|
+
union-gems-
|
|
35
|
+
# Install dependencies on cache miss
|
|
36
|
+
- name: Install ruby dependencies
|
|
37
|
+
if: steps.cache-ruby.outputs.cache-hit != 'true'
|
|
38
|
+
run: |
|
|
39
|
+
bundle config path vendor/bundle
|
|
40
|
+
bundle install --jobs 4 --retry 3 --without=documentation
|
|
41
|
+
# Run danger
|
|
42
|
+
- name: Run danger
|
|
43
|
+
env:
|
|
44
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
45
|
+
run: |
|
|
46
|
+
bundle config path vendor/bundle
|
|
47
|
+
bundle exec danger
|
|
48
|
+
|
data/Dangerfile
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# rubocop:disable all
|
|
2
|
+
# Mainly to encourage writing up some reasoning about the PR, rather than
|
|
3
|
+
# just leaving a title
|
|
4
|
+
fail "Please provide a short summary in the PR description :page_with_curl:" if github.pr_body.length < 10
|
|
5
|
+
|
|
6
|
+
# The title should include the correct prefix tag
|
|
7
|
+
if !github.pr_title.match(/^\[(?:Fixed|Added|Changed|Removed|Security|Other)\]/)
|
|
8
|
+
fail "Please provide a valid PR title label: [Added]/[Fixed]/[Changed]/[Removed]/[Security]/[Other]"
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
# The title should include the JIRA ticket unless is a dependabot PR
|
|
12
|
+
if github.pr_labels.include?("dependencies")
|
|
13
|
+
message ("PR autogenerated by dependabot")
|
|
14
|
+
elsif !github.pr_title.match(/^\[.*\]\s?\[BEL-\d+\]/)
|
|
15
|
+
fail "Please provide a valid Jira ticket ID associated to this PR: [BEL-XXXX]. If you do not have any associated Jira ticket, just use [BEL-XXXX]"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
warn("PR is classed as Work in Progress", sticky: false) if github.pr_title.include? "[WIP]"
|
|
19
|
+
|
|
20
|
+
message("One approval required for merging :smiley_cat: :smiley_cat:")
|
|
21
|
+
# rubocop:enable all
|
data/Gemfile
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# rubocop:disable all
|
|
1
2
|
# frozen_string_literal: true
|
|
2
3
|
|
|
3
4
|
source 'https://rubygems.org'
|
|
@@ -13,4 +14,6 @@ gem 'rspec', '~> 3.0'
|
|
|
13
14
|
gem 'rubocop', '~> 0.81.0', require: false
|
|
14
15
|
gem 'rubocop-rspec', require: false
|
|
15
16
|
gem 'typhoeus'
|
|
17
|
+
gem 'danger', '8.2.1'
|
|
16
18
|
gem 'webmock'
|
|
19
|
+
# rubocop:enable all
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
belvo (0.
|
|
4
|
+
belvo (0.13.1)
|
|
5
5
|
faraday
|
|
6
6
|
faraday_middleware
|
|
7
7
|
typhoeus
|
|
@@ -12,6 +12,14 @@ GEM
|
|
|
12
12
|
addressable (2.7.0)
|
|
13
13
|
public_suffix (>= 2.0.2, < 5.0)
|
|
14
14
|
ast (2.4.1)
|
|
15
|
+
claide (1.0.3)
|
|
16
|
+
claide-plugins (0.9.2)
|
|
17
|
+
cork
|
|
18
|
+
nap
|
|
19
|
+
open4 (~> 1.3)
|
|
20
|
+
colored2 (3.1.2)
|
|
21
|
+
cork (0.3.0)
|
|
22
|
+
colored2 (~> 3.1)
|
|
15
23
|
coveralls (0.8.23)
|
|
16
24
|
json (>= 1.8, < 3)
|
|
17
25
|
simplecov (~> 0.16.1)
|
|
@@ -19,6 +27,19 @@ GEM
|
|
|
19
27
|
thor (>= 0.19.4, < 2.0)
|
|
20
28
|
tins (~> 1.6)
|
|
21
29
|
crack (0.4.4)
|
|
30
|
+
danger (8.2.1)
|
|
31
|
+
claide (~> 1.0)
|
|
32
|
+
claide-plugins (>= 0.9.2)
|
|
33
|
+
colored2 (~> 3.1)
|
|
34
|
+
cork (~> 0.1)
|
|
35
|
+
faraday (>= 0.9.0, < 2.0)
|
|
36
|
+
faraday-http-cache (~> 2.0)
|
|
37
|
+
git (~> 1.7)
|
|
38
|
+
kramdown (~> 2.3)
|
|
39
|
+
kramdown-parser-gfm (~> 1.0)
|
|
40
|
+
no_proxy_fix
|
|
41
|
+
octokit (~> 4.7)
|
|
42
|
+
terminal-table (~> 1)
|
|
22
43
|
diff-lcs (1.4.4)
|
|
23
44
|
docile (1.3.2)
|
|
24
45
|
ethon (0.12.0)
|
|
@@ -26,20 +47,35 @@ GEM
|
|
|
26
47
|
faraday (1.1.0)
|
|
27
48
|
multipart-post (>= 1.2, < 3)
|
|
28
49
|
ruby2_keywords
|
|
50
|
+
faraday-http-cache (2.2.0)
|
|
51
|
+
faraday (>= 0.8)
|
|
29
52
|
faraday_middleware (1.0.0)
|
|
30
53
|
faraday (~> 1.0)
|
|
31
54
|
ffi (1.13.1)
|
|
55
|
+
git (1.8.1)
|
|
56
|
+
rchardet (~> 1.8)
|
|
32
57
|
hashdiff (1.0.1)
|
|
33
58
|
jaro_winkler (1.5.4)
|
|
34
59
|
json (2.3.1)
|
|
60
|
+
kramdown (2.3.1)
|
|
61
|
+
rexml
|
|
62
|
+
kramdown-parser-gfm (1.1.0)
|
|
63
|
+
kramdown (~> 2.0)
|
|
35
64
|
multipart-post (2.1.1)
|
|
65
|
+
nap (1.1.0)
|
|
66
|
+
no_proxy_fix (0.1.2)
|
|
67
|
+
octokit (4.21.0)
|
|
68
|
+
faraday (>= 0.9)
|
|
69
|
+
sawyer (~> 0.8.0, >= 0.5.3)
|
|
70
|
+
open4 (1.3.4)
|
|
36
71
|
parallel (1.20.0)
|
|
37
72
|
parser (2.7.2.0)
|
|
38
73
|
ast (~> 2.4.1)
|
|
39
74
|
public_suffix (4.0.6)
|
|
40
75
|
rainbow (3.0.0)
|
|
41
76
|
rake (12.3.3)
|
|
42
|
-
|
|
77
|
+
rchardet (1.8.0)
|
|
78
|
+
rexml (3.2.5)
|
|
43
79
|
rspec (3.10.0)
|
|
44
80
|
rspec-core (~> 3.10.0)
|
|
45
81
|
rspec-expectations (~> 3.10.0)
|
|
@@ -65,6 +101,9 @@ GEM
|
|
|
65
101
|
rubocop (>= 0.68.1)
|
|
66
102
|
ruby-progressbar (1.10.1)
|
|
67
103
|
ruby2_keywords (0.0.2)
|
|
104
|
+
sawyer (0.8.2)
|
|
105
|
+
addressable (>= 2.3.5)
|
|
106
|
+
faraday (> 0.8, < 2.0)
|
|
68
107
|
simplecov (0.16.1)
|
|
69
108
|
docile (~> 1.1)
|
|
70
109
|
json (>= 1.8, < 3)
|
|
@@ -73,6 +112,8 @@ GEM
|
|
|
73
112
|
sync (0.5.0)
|
|
74
113
|
term-ansicolor (1.7.1)
|
|
75
114
|
tins (~> 1.0)
|
|
115
|
+
terminal-table (1.8.0)
|
|
116
|
+
unicode-display_width (~> 1.1, >= 1.1.1)
|
|
76
117
|
thor (1.0.1)
|
|
77
118
|
tins (1.26.0)
|
|
78
119
|
sync
|
|
@@ -90,6 +131,7 @@ PLATFORMS
|
|
|
90
131
|
DEPENDENCIES
|
|
91
132
|
belvo!
|
|
92
133
|
coveralls
|
|
134
|
+
danger (= 8.2.1)
|
|
93
135
|
faraday
|
|
94
136
|
faraday_middleware
|
|
95
137
|
rake (~> 12.0)
|
data/LICENSE
CHANGED
data/README.md
CHANGED
|
@@ -73,6 +73,12 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
|
73
73
|
|
|
74
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).
|
|
75
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
|
+
|
|
76
82
|
|
|
77
83
|
## Code of Conduct
|
|
78
84
|
|
data/lib/belvo/http.rb
CHANGED
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
|
|
|
@@ -143,7 +144,10 @@ module Belvo
|
|
|
143
144
|
:token,
|
|
144
145
|
:encryption_key,
|
|
145
146
|
:save_data,
|
|
146
|
-
:attach_pdf
|
|
147
|
+
:attach_pdf,
|
|
148
|
+
:type,
|
|
149
|
+
:date_from,
|
|
150
|
+
:date_to
|
|
147
151
|
)
|
|
148
152
|
end
|
|
149
153
|
|
|
@@ -165,9 +169,11 @@ module Belvo
|
|
|
165
169
|
# Contains configurable properties of a WidgetToken
|
|
166
170
|
# @!attribute scopes [rw] Should have WidgetToken's permssions.
|
|
167
171
|
# @!attribute link [rw] Should the WidgetToken be tied to a specific link.
|
|
172
|
+
# @!attribute widget [rw] Should have the Widget branding params.
|
|
168
173
|
class WidgetTokenOptions < Faraday::Options.new(
|
|
169
174
|
:scopes,
|
|
170
|
-
:link
|
|
175
|
+
:link,
|
|
176
|
+
:widget
|
|
171
177
|
)
|
|
172
178
|
end
|
|
173
179
|
end
|
data/lib/belvo/resources.rb
CHANGED
|
@@ -134,6 +134,24 @@ module Belvo
|
|
|
134
134
|
}
|
|
135
135
|
@session.token(@endpoint, id, body)
|
|
136
136
|
end
|
|
137
|
+
|
|
138
|
+
# Patch an existing link
|
|
139
|
+
# @param id [String] Link UUID
|
|
140
|
+
# @param options [LinkOptions] Configurable properties
|
|
141
|
+
# @return [Hash] created link details
|
|
142
|
+
# @raise [RequestError] If response code is different than 2XX
|
|
143
|
+
def patch(
|
|
144
|
+
id:,
|
|
145
|
+
options: nil
|
|
146
|
+
)
|
|
147
|
+
options = LinkOptions.from(options)
|
|
148
|
+
body = {
|
|
149
|
+
access_mode: options.access_mode
|
|
150
|
+
}.merge(options)
|
|
151
|
+
body = clean body: body
|
|
152
|
+
resource_path = format('%<path>s%<id>s/', path: @endpoint, id: id)
|
|
153
|
+
@session.patch(resource_path, body)
|
|
154
|
+
end
|
|
137
155
|
end
|
|
138
156
|
|
|
139
157
|
# An Account is the representation of a bank account inside a financial
|
|
@@ -377,6 +395,11 @@ module Belvo
|
|
|
377
395
|
@endpoint = 'tax-returns/'
|
|
378
396
|
end
|
|
379
397
|
|
|
398
|
+
class TaxReturnType
|
|
399
|
+
YEARLY = 'yearly'
|
|
400
|
+
MONTHLY = 'monthly'
|
|
401
|
+
end
|
|
402
|
+
|
|
380
403
|
# Retrieve tax returns information from a specific fiscal link.
|
|
381
404
|
# @param link [String] Link UUID
|
|
382
405
|
# @param year_from [Integer]
|
|
@@ -384,17 +407,23 @@ module Belvo
|
|
|
384
407
|
# @param options [TaxReturnOptions] Configurable properties
|
|
385
408
|
# @return [Hash] created tax returns details
|
|
386
409
|
# @raise [RequestError] If response code is different than 2XX
|
|
387
|
-
def retrieve(link:, year_from
|
|
410
|
+
def retrieve(link:, year_from: nil, year_to: nil, options: nil)
|
|
388
411
|
options = TaxReturnOptions.from(options)
|
|
389
412
|
body = {
|
|
390
413
|
link: link,
|
|
391
|
-
year_from: year_from,
|
|
392
|
-
year_to: year_to,
|
|
393
414
|
token: options.token,
|
|
394
415
|
encryption_key: options.encryption_key,
|
|
395
416
|
save_data: options.save_data || true,
|
|
396
|
-
attach_pdf: options.attach_pdf
|
|
417
|
+
attach_pdf: options.attach_pdf,
|
|
418
|
+
type: options.type
|
|
397
419
|
}.merge(options)
|
|
420
|
+
if options.type == TaxReturnType::MONTHLY
|
|
421
|
+
body[:date_from] = options.date_from
|
|
422
|
+
body[:date_to] = options.date_to
|
|
423
|
+
else
|
|
424
|
+
body[:year_from] = year_from
|
|
425
|
+
body[:year_to] = year_to
|
|
426
|
+
end
|
|
398
427
|
body = clean body: body
|
|
399
428
|
@session.post(@endpoint, body)
|
|
400
429
|
end
|
|
@@ -456,12 +485,15 @@ module Belvo
|
|
|
456
485
|
def create(options: nil)
|
|
457
486
|
options = WidgetTokenOptions.from(options)
|
|
458
487
|
link_id = options.link
|
|
488
|
+
widget = options.widget
|
|
459
489
|
options.delete('link')
|
|
490
|
+
options.delete('widget')
|
|
460
491
|
body = {
|
|
461
492
|
id: @session.key_id,
|
|
462
493
|
password: @session.key_password,
|
|
463
|
-
scopes: 'read_institutions,write_links,read_links
|
|
464
|
-
link_id: link_id
|
|
494
|
+
scopes: 'read_institutions,write_links,read_links',
|
|
495
|
+
link_id: link_id,
|
|
496
|
+
widget: widget
|
|
465
497
|
}.merge(options)
|
|
466
498
|
body = clean body: body
|
|
467
499
|
@session.post(@endpoint, body)
|
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.13.1
|
|
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-06-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|
|
@@ -149,11 +149,13 @@ files:
|
|
|
149
149
|
- ".codeclimate.yml"
|
|
150
150
|
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
|
151
151
|
- ".github/pull_request_template.md"
|
|
152
|
+
- ".github/workflows/danger-pr-reviews.yml"
|
|
152
153
|
- ".gitignore"
|
|
153
154
|
- ".rspec"
|
|
154
155
|
- ".rubocop.yml"
|
|
155
156
|
- ".travis.yml"
|
|
156
157
|
- CODE_OF_CONDUCT.md
|
|
158
|
+
- Dangerfile
|
|
157
159
|
- Gemfile
|
|
158
160
|
- Gemfile.lock
|
|
159
161
|
- LICENSE
|