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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 77535d19fd4a624ef494fa4c6354fc427bbfa388122398bace8dbe011207a006
4
- data.tar.gz: e7655524ec6125db8fadb1f1b7fbee29e82685a4ead7edfecaec56a618f09bda
3
+ metadata.gz: d7c835bc36e3ffa4aed0c08effb1c7a7ec0f64b46955f4fb59bd9bd4aabd6e98
4
+ data.tar.gz: 24fa5cb7a3ec5b0581eac4b04b2e58ffa9a08bd332d91512b0d33641a3185264
5
5
  SHA512:
6
- metadata.gz: 6366c18991ba3ff5b24efbfde467560a05d52d1392f349cf8a38c0515a59bba430fa2456e0fbcf35fdc89a0a28cdd43756371e5bc0dcc106afc6e03e3f845bac
7
- data.tar.gz: 2ea9b99bd9dba5890256ca1c3404943d08b606187f8ecf6453f133d047955fca96691224b98d816699144bb6110353902b71e3543934e858d1834c76762630db
6
+ metadata.gz: 7f7843ca0c81834407decbcccc5a136ad29800041c4d5a090cfae523a27521e0aa0e8a44abd69310ad01aa403a80114341e7735ac9168fa53f6345eb1336146e
7
+ data.tar.gz: 1fc654b148a1c0ff31480f593741064371baefef276d7e7df2f70d74fbe95dd8e31e15cf49e109f0468e48060d05d2b923b6a375675cf7c78d6771c1265ef0c3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- belvo (1.1.0)
4
+ belvo (1.2.0)
5
5
  faraday
6
6
  faraday_middleware
7
7
  typhoeus
@@ -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
- # Class with helper functions
6
- class Utils
7
- def self.read_file_to_b64(path)
8
- return if path.nil? || !File.file?(path)
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
- data = File.open(path).read
11
- Base64.encode64(data)
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
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Belvo
4
4
  # belvo-ruby current version
5
- VERSION = '1.1.0'
5
+ VERSION = '1.2.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: 1.1.0
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-07-05 00:00:00.000000000 Z
11
+ date: 2022-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday