belvo 0.13.1 → 0.14.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: 426490295ec3ff52627ef0cc1e70a27c418837827947da27e416ccadaa7214ee
4
- data.tar.gz: 92630f9d7c9a72dc57d7c1677edb1f1f90bde1442ed787ab5a375d5d8b6871e2
3
+ metadata.gz: '038fbaeb161f1c341855ded020989160dc8ebbbcea33f5fe05fa0c92c81d0bcf'
4
+ data.tar.gz: 4eee5f78d13eb4fff6a3a01ed50aa673a4b62b0bb10b45b86795d8e980f1a48d
5
5
  SHA512:
6
- metadata.gz: 58500920831162b704712f0d44e949a3502c0dafe0cd58eb080522c15302a28ec1b2761d2d72058ca1f5e3777da5f75bd629001d72ed70b7a682b65c2037c18f
7
- data.tar.gz: ff5c028732ffce74c00630c7e2bb22f38eb3a7e602ecb55b31578ee4eba975e341f5be29d45174575dbd37884304281f73ef9cdc55aed8aa3085aadea31fc7cd
6
+ metadata.gz: 4845b72c9a053c7bc8fabe97d6990cd1006fc75b4493f42944aac21cc3aea72860a2d9d7ab0cc0ae56f1a68f465c9c0aff1c9ca76c39e3ee82a4f638862f955b
7
+ data.tar.gz: d41485f0c38659baa74b675d9220f3f1a07086d62c0ead42c886e3dedd06d0c4bcaab7ee878cc5cbe1dcf06e01eb7cd0d71413925be407c26af1617b596e1e1f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- belvo (0.13.1)
4
+ belvo (0.14.0)
5
5
  faraday
6
6
  faraday_middleware
7
7
  typhoeus
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/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,7 +17,6 @@ module Belvo
18
17
  :username2,
19
18
  :username3,
20
19
  :password2,
21
- :encryption_key,
22
20
  :username_type,
23
21
  :certificate,
24
22
  :private_key,
@@ -30,11 +28,9 @@ module Belvo
30
28
  # Contains the configurable properties for an Account
31
29
  # @!attribute save_data [rw] Should data be persisted or not.
32
30
  # @!attribute token [rw] OTP token required by the institution
33
- # @!attribute encryption_key [rw] Custom encryption key
34
31
  class AccountOptions < Faraday::Options.new(
35
32
  :save_data,
36
- :token,
37
- :encryption_key
33
+ :token
38
34
  )
39
35
  end
40
36
 
@@ -44,12 +40,10 @@ module Belvo
44
40
  # @!attribute account [rw] Account ID (UUID)
45
41
  # @!attribute save_data [rw] Should data be persisted or not.
46
42
  # @!attribute token [rw] OTP token required by the institution
47
- # @!attribute encryption_key [rw] Custom encryption key
48
43
  class TransactionOptions < Faraday::Options.new(
49
44
  :date_to,
50
45
  :account,
51
46
  :token,
52
- :encryption_key,
53
47
  :save_data
54
48
  )
55
49
  end
@@ -58,8 +52,7 @@ module Belvo
58
52
  # Contains configurable properties of an Owner
59
53
  # @!attribute save_data [rw] Should data be persisted or not.
60
54
  # @!attribute token [rw] OTP token required by the institution
61
- # @!attribute encryption_key [rw] Custom encryption key
62
- class OwnerOptions < Faraday::Options.new(:token, :encryption_key, :save_data)
55
+ class OwnerOptions < Faraday::Options.new(:token, :save_data)
63
56
  end
64
57
 
65
58
  # @!class BalanceOptions < Faraday::Options
@@ -68,12 +61,10 @@ module Belvo
68
61
  # @!attribute account [rw] Account ID (UUID)
69
62
  # @!attribute save_data [rw] Should data be persisted or not.
70
63
  # @!attribute token [rw] OTP token required by the institution
71
- # @!attribute encryption_key [rw] Custom encryption key
72
64
  class BalanceOptions < Faraday::Options.new(
73
65
  :date_to,
74
66
  :account,
75
67
  :token,
76
- :encryption_key,
77
68
  :save_data
78
69
  )
79
70
  end
@@ -82,12 +73,10 @@ module Belvo
82
73
  # Contains configurable properties of a Statement
83
74
  # @!attribute save_data [rw] Should data be persisted or not.
84
75
  # @!attribute token [rw] OTP token required by the institution
85
- # @!attribute encryption_key [rw] Custom encryption key
86
76
  # @!attribute attach_pdf [rw] Should the PDF file be included in the
87
77
  # response or not.
88
78
  class StatementOptions < Faraday::Options.new(
89
79
  :token,
90
- :encryption_key,
91
80
  :save_data,
92
81
  :attach_pdf
93
82
  )
@@ -96,9 +85,7 @@ module Belvo
96
85
  # @!class IncomeOptions < Faraday::Options
97
86
  # Contains configurable properties of an Income
98
87
  # @!attribute save_data [rw] Should data be persisted or not.
99
- # @!attribute encryption_key [rw] Custom encryption key
100
88
  class IncomeOptions < Faraday::Options.new(
101
- :encryption_key,
102
89
  :save_data
103
90
  )
104
91
  end
@@ -107,13 +94,11 @@ module Belvo
107
94
  # Contains configurable properties of an Invoice
108
95
  # @!attribute save_data [rw] Should data be persisted or not.
109
96
  # @!attribute token [rw] OTP token required by the institution
110
- # @!attribute encryption_key [rw] Custom encryption key
111
97
  # @!attribute attach_xml [rw] Should the XML file be included in the
112
98
  # response or not.
113
99
  class InvoiceOptions < Faraday::Options.new(
114
100
  :save_data,
115
101
  :token,
116
- :encryption_key,
117
102
  :attach_xml
118
103
  )
119
104
  end
@@ -122,12 +107,10 @@ module Belvo
122
107
  # Contains configurable properties of a TaxComplianceStatus
123
108
  # @!attribute save_data [rw] Should data be persisted or not.
124
109
  # @!attribute token [rw] OTP token required by the institution
125
- # @!attribute encryption_key [rw] Custom encryption key
126
110
  # @!attribute attach_pdf [rw] Should the PDF file be included in the
127
111
  # response or not.
128
112
  class TaxComplianceStatusOptions < Faraday::Options.new(
129
113
  :token,
130
- :encryption_key,
131
114
  :save_data,
132
115
  :attach_pdf
133
116
  )
@@ -137,12 +120,10 @@ module Belvo
137
120
  # Contains configurable properties of a TaxReturn
138
121
  # @!attribute save_data [rw] Should data be persisted or not.
139
122
  # @!attribute token [rw] OTP token required by the institution
140
- # @!attribute encryption_key [rw] Custom encryption key
141
123
  # @!attribute attach_pdf [rw] Should the PDF file be included in the
142
124
  # response or not.
143
125
  class TaxReturnOptions < Faraday::Options.new(
144
126
  :token,
145
- :encryption_key,
146
127
  :save_data,
147
128
  :attach_pdf,
148
129
  :type,
@@ -155,12 +136,10 @@ module Belvo
155
136
  # Contains configurable properties of a TaxStatus
156
137
  # @!attribute save_data [rw] Should data be persisted or not.
157
138
  # @!attribute token [rw] OTP token required by the institution
158
- # @!attribute encryption_key [rw] Custom encryption key
159
139
  # @!attribute attach_pdf [rw] Should the PDF file be included in the
160
140
  # response or not.
161
141
  class TaxStatusOptions < Faraday::Options.new(
162
142
  :token,
163
- :encryption_key,
164
143
  :save_data,
165
144
  :attach_pdf
166
145
  )
@@ -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
@@ -172,7 +171,6 @@ module Belvo
172
171
  body = {
173
172
  link: link,
174
173
  token: options.token,
175
- encryption_key: options.encryption_key,
176
174
  save_data: options.save_data || true
177
175
  }.merge(options)
178
176
  body = clean body: body
@@ -203,7 +201,6 @@ module Belvo
203
201
  date_to: date_to,
204
202
  token: options.token,
205
203
  account: options.account,
206
- encryption_key: options.encryption_key,
207
204
  save_data: options.save_data || true
208
205
  }.merge(options)
209
206
  body = clean body: body
@@ -229,7 +226,6 @@ module Belvo
229
226
  body = {
230
227
  link: link,
231
228
  token: options.token,
232
- encryption_key: options.encryption_key,
233
229
  save_data: options.save_data || true
234
230
  }.merge(options)
235
231
  body = clean body: body
@@ -260,7 +256,6 @@ module Belvo
260
256
  date_to: date_to,
261
257
  token: options.token,
262
258
  account: options.account,
263
- encryption_key: options.encryption_key,
264
259
  save_data: options.save_data || true
265
260
  }.merge(options)
266
261
  body = clean body: body
@@ -290,7 +285,6 @@ module Belvo
290
285
  year: year,
291
286
  month: month,
292
287
  token: options.token,
293
- encryption_key: options.encryption_key,
294
288
  save_data: options.save_data || true,
295
289
  attach_pdf: options.attach_pdf
296
290
  }.merge(options)
@@ -315,7 +309,6 @@ module Belvo
315
309
  options = IncomeOptions.from(options)
316
310
  body = {
317
311
  link: link,
318
- encryption_key: options.encryption_key,
319
312
  save_data: options.save_data || true
320
313
  }.merge(options)
321
314
  body = clean body: body
@@ -346,7 +339,6 @@ module Belvo
346
339
  date_to: date_to,
347
340
  type: type,
348
341
  token: options.token,
349
- encryption_key: options.encryption_key,
350
342
  save_data: options.save_data || true,
351
343
  attach_xml: options.attach_xml
352
344
  }.merge(options)
@@ -373,7 +365,6 @@ module Belvo
373
365
  body = {
374
366
  link: link,
375
367
  token: options.token,
376
- encryption_key: options.encryption_key,
377
368
  save_data: options.save_data || true,
378
369
  attach_pdf: options.attach_pdf
379
370
  }.merge(options)
@@ -412,7 +403,6 @@ module Belvo
412
403
  body = {
413
404
  link: link,
414
405
  token: options.token,
415
- encryption_key: options.encryption_key,
416
406
  save_data: options.save_data || true,
417
407
  attach_pdf: options.attach_pdf,
418
408
  type: options.type
@@ -451,7 +441,6 @@ module Belvo
451
441
  body = {
452
442
  link: link,
453
443
  token: options.token,
454
- encryption_key: options.encryption_key,
455
444
  save_data: options.save_data || true,
456
445
  attach_pdf: options.attach_pdf
457
446
  }.merge(options)
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.13.1'
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.13.1
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-06-23 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