belvo 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/belvo/resources.rb +19 -0
- data/lib/belvo/utils.rb +8 -6
- data/lib/belvo/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7c835bc36e3ffa4aed0c08effb1c7a7ec0f64b46955f4fb59bd9bd4aabd6e98
|
4
|
+
data.tar.gz: 24fa5cb7a3ec5b0581eac4b04b2e58ffa9a08bd332d91512b0d33641a3185264
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f7843ca0c81834407decbcccc5a136ad29800041c4d5a090cfae523a27521e0aa0e8a44abd69310ad01aa403a80114341e7735ac9168fa53f6345eb1336146e
|
7
|
+
data.tar.gz: 1fc654b148a1c0ff31480f593741064371baefef276d7e7df2f70d74fbe95dd8e31e15cf49e109f0468e48060d05d2b923b6a375675cf7c78d6771c1265ef0c3
|
data/Gemfile.lock
CHANGED
data/lib/belvo/resources.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
require 'date'
|
4
4
|
require 'belvo/options'
|
5
5
|
require 'belvo/utils'
|
6
|
+
require 'belvo/exceptions'
|
6
7
|
|
7
8
|
module Belvo
|
8
9
|
# Represents a consumable REST resource from Belvo API
|
@@ -185,6 +186,24 @@ module Belvo
|
|
185
186
|
@endpoint = 'api/transactions/'
|
186
187
|
end
|
187
188
|
|
189
|
+
# List all transactions for specific link id
|
190
|
+
# @param id [String] Resource ID
|
191
|
+
# @param params [Hash] Extra parameters sent as query strings.
|
192
|
+
# @return [Array] List of results when no block is passed.
|
193
|
+
# @yield [Hash] Each result to be processed individually.
|
194
|
+
# @raise [RequestError] If response code is different than 2XX
|
195
|
+
def list(params: nil)
|
196
|
+
params = {} if params.nil?
|
197
|
+
unless params.key?(:link)
|
198
|
+
raise RequestError.new(
|
199
|
+
'Link id required',
|
200
|
+
400,
|
201
|
+
'A link ID is required to list transactions'
|
202
|
+
)
|
203
|
+
end
|
204
|
+
@session.list(@endpoint, params: params)
|
205
|
+
end
|
206
|
+
|
188
207
|
# Retrieve transactions from an existing link
|
189
208
|
# @param link [String] Link UUID
|
190
209
|
# @param date_from [String] Date string (YYYY-MM-DD)
|
data/lib/belvo/utils.rb
CHANGED
@@ -2,13 +2,15 @@
|
|
2
2
|
|
3
3
|
require 'base64'
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
module Belvo
|
6
|
+
# Class with helper functions
|
7
|
+
class Utils
|
8
|
+
def self.read_file_to_b64(path)
|
9
|
+
return if path.nil? || !File.file?(path)
|
9
10
|
|
10
|
-
|
11
|
-
|
11
|
+
data = File.open(path).read
|
12
|
+
Base64.encode64(data)
|
13
|
+
end
|
12
14
|
end
|
13
15
|
end
|
14
16
|
|
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: 1.
|
4
|
+
version: 1.2.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: 2022-
|
11
|
+
date: 2022-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|