belvo 0.10.0 → 0.14.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d8e956f90ab794d8165e888ebb059212e3e7ea4ee2f6ca6526a6223473086fd9
4
- data.tar.gz: c177f509945811c6df6f64367270118763cf48bbc3728dbcd4c8b880ee7d79b3
3
+ metadata.gz: '038fbaeb161f1c341855ded020989160dc8ebbbcea33f5fe05fa0c92c81d0bcf'
4
+ data.tar.gz: 4eee5f78d13eb4fff6a3a01ed50aa673a4b62b0bb10b45b86795d8e980f1a48d
5
5
  SHA512:
6
- metadata.gz: 9a09abefb67fad3b3bc8244dfff5a93f49069ddb4a213e833d27724a41a3276683c6e23d8c386790efe5bd9ea07a6f4ff10d76dbd7eecb384cf5c76739e6f063
7
- data.tar.gz: 87cd5325266f6987429d0061f7589cf7cd617164171f0126da439672d0e2f03256a7608d7deec25e61f1ac1705173cea4ca25dc03805253345bcec8b465dbdd4
6
+ metadata.gz: 4845b72c9a053c7bc8fabe97d6990cd1006fc75b4493f42944aac21cc3aea72860a2d9d7ab0cc0ae56f1a68f465c9c0aff1c9ca76c39e3ee82a4f638862f955b
7
+ data.tar.gz: d41485f0c38659baa74b675d9220f3f1a07086d62c0ead42c886e3dedd06d0c4bcaab7ee878cc5cbe1dcf06e01eb7cd0d71413925be407c26af1617b596e1e1f
@@ -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.10.0)
4
+ belvo (0.14.0)
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
- rexml (3.2.4)
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
@@ -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
@@ -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.rb CHANGED
@@ -3,6 +3,7 @@
3
3
  require 'belvo/http'
4
4
  require 'belvo/exceptions'
5
5
  require 'belvo/resources'
6
+ require 'belvo/utils'
6
7
 
7
8
  module Belvo
8
9
  # Allows easy access to Belvo API servers.
@@ -18,7 +19,11 @@ module Belvo
18
19
  # @return [APISession] Authenticated Belvo API session
19
20
  def initialize(secret_key_id, secret_key_password, url = nil)
20
21
  (belvo_api_url = url) || ENV['BELVO_API_URL']
21
- raise BelvoAPIError, 'You need to provide a URL.' if belvo_api_url.nil?
22
+ belvo_api_url = Environment.get_url(belvo_api_url)
23
+
24
+ if belvo_api_url.nil?
25
+ raise BelvoAPIError, 'You need to provide a URL or a valid environment.'
26
+ end
22
27
 
23
28
  @session = Belvo::APISession.new(belvo_api_url)
24
29
 
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
@@ -10,7 +10,6 @@ module Belvo
10
10
  # @!attribute username2 [rw] End-user secondary username, if any
11
11
  # @!attribute username3 [rw] End-user tertiary username, if any
12
12
  # @!attribute password2 [rw] End-user secondary password, if any
13
- # @!attribute encryption_key [rw] Custom encryption key
14
13
  # @!attribute username_type [rw] Type of the username provided
15
14
  class LinkOptions < Faraday::Options.new(
16
15
  :access_mode,
@@ -18,10 +17,10 @@ module Belvo
18
17
  :username2,
19
18
  :username3,
20
19
  :password2,
21
- :encryption_key,
22
20
  :username_type,
23
21
  :certificate,
24
- :private_key
22
+ :private_key,
23
+ :external_id
25
24
  )
26
25
  end
27
26
 
@@ -29,11 +28,9 @@ module Belvo
29
28
  # Contains the configurable properties for an Account
30
29
  # @!attribute save_data [rw] Should data be persisted or not.
31
30
  # @!attribute token [rw] OTP token required by the institution
32
- # @!attribute encryption_key [rw] Custom encryption key
33
31
  class AccountOptions < Faraday::Options.new(
34
32
  :save_data,
35
- :token,
36
- :encryption_key
33
+ :token
37
34
  )
38
35
  end
39
36
 
@@ -43,12 +40,10 @@ module Belvo
43
40
  # @!attribute account [rw] Account ID (UUID)
44
41
  # @!attribute save_data [rw] Should data be persisted or not.
45
42
  # @!attribute token [rw] OTP token required by the institution
46
- # @!attribute encryption_key [rw] Custom encryption key
47
43
  class TransactionOptions < Faraday::Options.new(
48
44
  :date_to,
49
45
  :account,
50
46
  :token,
51
- :encryption_key,
52
47
  :save_data
53
48
  )
54
49
  end
@@ -57,8 +52,7 @@ module Belvo
57
52
  # Contains configurable properties of an Owner
58
53
  # @!attribute save_data [rw] Should data be persisted or not.
59
54
  # @!attribute token [rw] OTP token required by the institution
60
- # @!attribute encryption_key [rw] Custom encryption key
61
- class OwnerOptions < Faraday::Options.new(:token, :encryption_key, :save_data)
55
+ class OwnerOptions < Faraday::Options.new(:token, :save_data)
62
56
  end
63
57
 
64
58
  # @!class BalanceOptions < Faraday::Options
@@ -67,12 +61,10 @@ module Belvo
67
61
  # @!attribute account [rw] Account ID (UUID)
68
62
  # @!attribute save_data [rw] Should data be persisted or not.
69
63
  # @!attribute token [rw] OTP token required by the institution
70
- # @!attribute encryption_key [rw] Custom encryption key
71
64
  class BalanceOptions < Faraday::Options.new(
72
65
  :date_to,
73
66
  :account,
74
67
  :token,
75
- :encryption_key,
76
68
  :save_data
77
69
  )
78
70
  end
@@ -81,12 +73,10 @@ module Belvo
81
73
  # Contains configurable properties of a Statement
82
74
  # @!attribute save_data [rw] Should data be persisted or not.
83
75
  # @!attribute token [rw] OTP token required by the institution
84
- # @!attribute encryption_key [rw] Custom encryption key
85
76
  # @!attribute attach_pdf [rw] Should the PDF file be included in the
86
77
  # response or not.
87
78
  class StatementOptions < Faraday::Options.new(
88
79
  :token,
89
- :encryption_key,
90
80
  :save_data,
91
81
  :attach_pdf
92
82
  )
@@ -95,9 +85,7 @@ module Belvo
95
85
  # @!class IncomeOptions < Faraday::Options
96
86
  # Contains configurable properties of an Income
97
87
  # @!attribute save_data [rw] Should data be persisted or not.
98
- # @!attribute encryption_key [rw] Custom encryption key
99
88
  class IncomeOptions < Faraday::Options.new(
100
- :encryption_key,
101
89
  :save_data
102
90
  )
103
91
  end
@@ -106,13 +94,11 @@ module Belvo
106
94
  # Contains configurable properties of an Invoice
107
95
  # @!attribute save_data [rw] Should data be persisted or not.
108
96
  # @!attribute token [rw] OTP token required by the institution
109
- # @!attribute encryption_key [rw] Custom encryption key
110
97
  # @!attribute attach_xml [rw] Should the XML file be included in the
111
98
  # response or not.
112
99
  class InvoiceOptions < Faraday::Options.new(
113
100
  :save_data,
114
101
  :token,
115
- :encryption_key,
116
102
  :attach_xml
117
103
  )
118
104
  end
@@ -121,12 +107,10 @@ module Belvo
121
107
  # Contains configurable properties of a TaxComplianceStatus
122
108
  # @!attribute save_data [rw] Should data be persisted or not.
123
109
  # @!attribute token [rw] OTP token required by the institution
124
- # @!attribute encryption_key [rw] Custom encryption key
125
110
  # @!attribute attach_pdf [rw] Should the PDF file be included in the
126
111
  # response or not.
127
112
  class TaxComplianceStatusOptions < Faraday::Options.new(
128
113
  :token,
129
- :encryption_key,
130
114
  :save_data,
131
115
  :attach_pdf
132
116
  )
@@ -136,14 +120,15 @@ module Belvo
136
120
  # Contains configurable properties of a TaxReturn
137
121
  # @!attribute save_data [rw] Should data be persisted or not.
138
122
  # @!attribute token [rw] OTP token required by the institution
139
- # @!attribute encryption_key [rw] Custom encryption key
140
123
  # @!attribute attach_pdf [rw] Should the PDF file be included in the
141
124
  # response or not.
142
125
  class TaxReturnOptions < Faraday::Options.new(
143
126
  :token,
144
- :encryption_key,
145
127
  :save_data,
146
- :attach_pdf
128
+ :attach_pdf,
129
+ :type,
130
+ :date_from,
131
+ :date_to
147
132
  )
148
133
  end
149
134
 
@@ -151,12 +136,10 @@ module Belvo
151
136
  # Contains configurable properties of a TaxStatus
152
137
  # @!attribute save_data [rw] Should data be persisted or not.
153
138
  # @!attribute token [rw] OTP token required by the institution
154
- # @!attribute encryption_key [rw] Custom encryption key
155
139
  # @!attribute attach_pdf [rw] Should the PDF file be included in the
156
140
  # response or not.
157
141
  class TaxStatusOptions < Faraday::Options.new(
158
142
  :token,
159
- :encryption_key,
160
143
  :save_data,
161
144
  :attach_pdf
162
145
  )
@@ -165,9 +148,11 @@ module Belvo
165
148
  # Contains configurable properties of a WidgetToken
166
149
  # @!attribute scopes [rw] Should have WidgetToken's permssions.
167
150
  # @!attribute link [rw] Should the WidgetToken be tied to a specific link.
151
+ # @!attribute widget [rw] Should have the Widget branding params.
168
152
  class WidgetTokenOptions < Faraday::Options.new(
169
153
  :scopes,
170
- :link
154
+ :link,
155
+ :widget
171
156
  )
172
157
  end
173
158
  end
@@ -99,7 +99,7 @@ module Belvo
99
99
  @session.post(@endpoint, body)
100
100
  end
101
101
 
102
- # Allows to change password, password2 or setting a custom encryption key
102
+ # Allows to change password, password2
103
103
  # @param id [String] Link UUID
104
104
  # @param password [String] End-user password
105
105
  # @param password2 [String, nil] End-user secondary password, if any
@@ -114,7 +114,6 @@ module Belvo
114
114
  password: password,
115
115
  password2: password2,
116
116
  token: options.token,
117
- encryption_key: options.encryption_key,
118
117
  username_type: options.username_type,
119
118
  certificate: options.certificate,
120
119
  private_key: options.private_key
@@ -134,6 +133,24 @@ module Belvo
134
133
  }
135
134
  @session.token(@endpoint, id, body)
136
135
  end
136
+
137
+ # Patch an existing link
138
+ # @param id [String] Link UUID
139
+ # @param options [LinkOptions] Configurable properties
140
+ # @return [Hash] created link details
141
+ # @raise [RequestError] If response code is different than 2XX
142
+ def patch(
143
+ id:,
144
+ options: nil
145
+ )
146
+ options = LinkOptions.from(options)
147
+ body = {
148
+ access_mode: options.access_mode
149
+ }.merge(options)
150
+ body = clean body: body
151
+ resource_path = format('%<path>s%<id>s/', path: @endpoint, id: id)
152
+ @session.patch(resource_path, body)
153
+ end
137
154
  end
138
155
 
139
156
  # An Account is the representation of a bank account inside a financial
@@ -154,7 +171,6 @@ module Belvo
154
171
  body = {
155
172
  link: link,
156
173
  token: options.token,
157
- encryption_key: options.encryption_key,
158
174
  save_data: options.save_data || true
159
175
  }.merge(options)
160
176
  body = clean body: body
@@ -185,7 +201,6 @@ module Belvo
185
201
  date_to: date_to,
186
202
  token: options.token,
187
203
  account: options.account,
188
- encryption_key: options.encryption_key,
189
204
  save_data: options.save_data || true
190
205
  }.merge(options)
191
206
  body = clean body: body
@@ -211,7 +226,6 @@ module Belvo
211
226
  body = {
212
227
  link: link,
213
228
  token: options.token,
214
- encryption_key: options.encryption_key,
215
229
  save_data: options.save_data || true
216
230
  }.merge(options)
217
231
  body = clean body: body
@@ -242,7 +256,6 @@ module Belvo
242
256
  date_to: date_to,
243
257
  token: options.token,
244
258
  account: options.account,
245
- encryption_key: options.encryption_key,
246
259
  save_data: options.save_data || true
247
260
  }.merge(options)
248
261
  body = clean body: body
@@ -272,7 +285,6 @@ module Belvo
272
285
  year: year,
273
286
  month: month,
274
287
  token: options.token,
275
- encryption_key: options.encryption_key,
276
288
  save_data: options.save_data || true,
277
289
  attach_pdf: options.attach_pdf
278
290
  }.merge(options)
@@ -297,7 +309,6 @@ module Belvo
297
309
  options = IncomeOptions.from(options)
298
310
  body = {
299
311
  link: link,
300
- encryption_key: options.encryption_key,
301
312
  save_data: options.save_data || true
302
313
  }.merge(options)
303
314
  body = clean body: body
@@ -328,7 +339,6 @@ module Belvo
328
339
  date_to: date_to,
329
340
  type: type,
330
341
  token: options.token,
331
- encryption_key: options.encryption_key,
332
342
  save_data: options.save_data || true,
333
343
  attach_xml: options.attach_xml
334
344
  }.merge(options)
@@ -355,7 +365,6 @@ module Belvo
355
365
  body = {
356
366
  link: link,
357
367
  token: options.token,
358
- encryption_key: options.encryption_key,
359
368
  save_data: options.save_data || true,
360
369
  attach_pdf: options.attach_pdf
361
370
  }.merge(options)
@@ -377,6 +386,11 @@ module Belvo
377
386
  @endpoint = 'tax-returns/'
378
387
  end
379
388
 
389
+ class TaxReturnType
390
+ YEARLY = 'yearly'
391
+ MONTHLY = 'monthly'
392
+ end
393
+
380
394
  # Retrieve tax returns information from a specific fiscal link.
381
395
  # @param link [String] Link UUID
382
396
  # @param year_from [Integer]
@@ -384,17 +398,22 @@ module Belvo
384
398
  # @param options [TaxReturnOptions] Configurable properties
385
399
  # @return [Hash] created tax returns details
386
400
  # @raise [RequestError] If response code is different than 2XX
387
- def retrieve(link:, year_from:, year_to:, options: nil)
401
+ def retrieve(link:, year_from: nil, year_to: nil, options: nil)
388
402
  options = TaxReturnOptions.from(options)
389
403
  body = {
390
404
  link: link,
391
- year_from: year_from,
392
- year_to: year_to,
393
405
  token: options.token,
394
- encryption_key: options.encryption_key,
395
406
  save_data: options.save_data || true,
396
- attach_pdf: options.attach_pdf
407
+ attach_pdf: options.attach_pdf,
408
+ type: options.type
397
409
  }.merge(options)
410
+ if options.type == TaxReturnType::MONTHLY
411
+ body[:date_from] = options.date_from
412
+ body[:date_to] = options.date_to
413
+ else
414
+ body[:year_from] = year_from
415
+ body[:year_to] = year_to
416
+ end
398
417
  body = clean body: body
399
418
  @session.post(@endpoint, body)
400
419
  end
@@ -422,7 +441,6 @@ module Belvo
422
441
  body = {
423
442
  link: link,
424
443
  token: options.token,
425
- encryption_key: options.encryption_key,
426
444
  save_data: options.save_data || true,
427
445
  attach_pdf: options.attach_pdf
428
446
  }.merge(options)
@@ -456,12 +474,15 @@ module Belvo
456
474
  def create(options: nil)
457
475
  options = WidgetTokenOptions.from(options)
458
476
  link_id = options.link
477
+ widget = options.widget
459
478
  options.delete('link')
479
+ options.delete('widget')
460
480
  body = {
461
481
  id: @session.key_id,
462
482
  password: @session.key_password,
463
483
  scopes: 'read_institutions,write_links,read_links',
464
- link_id: link_id
484
+ link_id: link_id,
485
+ widget: widget
465
486
  }.merge(options)
466
487
  body = clean body: body
467
488
  @session.post(@endpoint, body)
data/lib/belvo/utils.rb CHANGED
@@ -11,3 +11,19 @@ class Utils
11
11
  Base64.encode64(data)
12
12
  end
13
13
  end
14
+
15
+ # Class to get the api url given an environment name
16
+ class Environment
17
+ SANDBOX = 'https://sandbox.belvo.com'
18
+ DEVELOPMENT = 'https://development.belvo.com'
19
+ PRODUCTION = 'https://api.belvo.com'
20
+
21
+ def self.get_url(environment)
22
+ nil unless environment
23
+ begin
24
+ const_get environment.upcase
25
+ rescue NameError
26
+ environment
27
+ end
28
+ end
29
+ 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.10.0'
5
+ VERSION = '0.14.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.10.0
4
+ version: 0.14.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: 2021-02-24 00:00:00.000000000 Z
11
+ date: 2021-07-05 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