afterbanks-psd2-api-ruby 0.1.0 → 0.1.2

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: 74a77be49119cc3b5c78ebcdb319db8f2fb0dc240d9c7374c5a65bfeee4086ca
4
- data.tar.gz: 75d2475c8af58adfb6cf21954057a7076f8367da1b31f9dc0315fa0e05e79d72
3
+ metadata.gz: b231b2ae3d5d4a5dcc4da8e04c765b9ff797e65e63b3175e4c40e08aac7aee9c
4
+ data.tar.gz: 19a60b950a91ffa7960c29038ac4dd93d9e8ba1d069ff69155f02ddcecf2ff85
5
5
  SHA512:
6
- metadata.gz: f8978cabe120ef0cdfc65618af4515587f2120c6c0272e0deeffee291f1c0f87a3b25e78079bdc8075594205cc408c83485372361895178596a94f2d6c058cd1
7
- data.tar.gz: 6b01263e08c321231c7e93111e1752ab9dc4e20b36d45018f35238a59c9bd0cfb90a04ee59160abbd3b531b12b3857010c2dd807d9bf1d103c58c1b162fb56de
6
+ metadata.gz: ae3cb367d060dd1993b83ca1a38a8bc4759460e1ba80e7c0af2c553b2132605431fe28ffa6dec8a8246ced047b472a7a37acff1e04116dd2094ac93bd7dfceb9
7
+ data.tar.gz: 361d21c49d77cae9c3011fe8dd6a0131432273a03f74a290b244dbf0baf86ef4179e9989ff6f4e559405caa0fcd7052da91ab701ec5e0b511ad1fe09106d3cf8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- afterbanks-psd2-api-ruby (0.1.0)
4
+ afterbanks-psd2-api-ruby (0.1.2)
5
5
  rest-client (~> 2.0.2)
6
6
 
7
7
  GEM
@@ -13,14 +13,15 @@ GEM
13
13
  crack (0.4.3)
14
14
  safe_yaml (~> 1.0.0)
15
15
  diff-lcs (1.3)
16
- domain_name (0.5.20190701)
17
- unf (>= 0.0.5, < 1.0.0)
16
+ domain_name (0.6.20240107)
18
17
  hashdiff (1.0.1)
19
- http-cookie (1.0.3)
18
+ http-cookie (1.0.8)
20
19
  domain_name (~> 0.5)
21
- mime-types (3.3.1)
20
+ logger (1.6.2)
21
+ mime-types (3.6.0)
22
+ logger
22
23
  mime-types-data (~> 3.2015)
23
- mime-types-data (3.2020.1104)
24
+ mime-types-data (3.2024.1203)
24
25
  netrc (0.11.0)
25
26
  parallel (1.19.1)
26
27
  parser (3.0.0.0)
@@ -64,9 +65,6 @@ GEM
64
65
  ruby-progressbar (1.10.1)
65
66
  safe_yaml (1.0.5)
66
67
  timecop (0.9.2)
67
- unf (0.1.4)
68
- unf_ext
69
- unf_ext (0.0.7.7)
70
68
  unicode-display_width (1.6.0)
71
69
  webmock (3.8.3)
72
70
  addressable (>= 2.3.6)
data/README.md CHANGED
@@ -33,6 +33,8 @@ You can set a `logger` as well.
33
33
  Changelog
34
34
  ---------
35
35
 
36
+ * 0.1.2 Add AccountNotFoundError (need for Revolut rules changes)
37
+ * 0.1.1 Fix options parameters to ensure not null and check other parameters on Transaction.list
36
38
  * 0.1.0 First full version, including resource wrapping (banks, user, accounts, transactions), error coverage and support for logging
37
39
 
38
40
  TODO
@@ -54,6 +56,7 @@ List of Error
54
56
  * `C005` -> MaximumNumberOfCallsReachedConsentError
55
57
  * `T000` -> GenericTransactionError
56
58
  * `T001` -> InvalidConsentForProductError
59
+ * `P000` -> AccountNotFoundError
57
60
 
58
61
 
59
62
 
@@ -12,6 +12,8 @@ module AfterbanksPSD2
12
12
  end
13
13
 
14
14
  def api_call(method:, path:, params: {}, options: {})
15
+ options = {} if options.nil?
16
+
15
17
  api_url = ENV['AFTERBANKS_API_URL'] || 'https://apipsd2.afterbanks.com'
16
18
  url = api_url + path
17
19
 
@@ -125,6 +127,8 @@ module AfterbanksPSD2
125
127
  raise GenericTransactionError.new(**error_info)
126
128
  when 'T001'
127
129
  raise InvalidConsentForProductError.new(**error_info)
130
+ when 'P000'
131
+ raise AccountNotFoundError.new(**error_info)
128
132
  end
129
133
 
130
134
  nil
@@ -73,4 +73,10 @@ module AfterbanksPSD2
73
73
  'T001'
74
74
  end
75
75
  end
76
+
77
+ class AccountNotFoundError < Error
78
+ def code
79
+ 'P000'
80
+ end
81
+ end
76
82
  end
@@ -10,6 +10,12 @@ module AfterbanksPSD2
10
10
  account: { type: :afterbankspsd2_account }
11
11
 
12
12
  def self.list(token:, products:, start_date:)
13
+ raise ArgumentError, "Token is missing" if token.nil? || token.empty?
14
+ raise ArgumentError, "Products must be a string" unless products.is_a?(String)
15
+ raise ArgumentError, "Products is missing" if products.nil? || products.empty?
16
+ raise ArgumentError, "Start date is missing" if start_date.nil? || products.empty?
17
+ raise ArgumentError, "Start date must be a Date" unless start_date.is_a?(Date)
18
+
13
19
  params = {
14
20
  servicekey: AfterbanksPSD2.configuration.servicekey,
15
21
  token: token,
@@ -17,6 +23,8 @@ module AfterbanksPSD2
17
23
  startDate: start_date.strftime("%d-%m-%Y")
18
24
  }
19
25
 
26
+ options = {}
27
+
20
28
  # if the start_date is older than 90 days, we need to increase timeout to 2 hours
21
29
  if start_date < Date.today << 3
22
30
  options = {
@@ -46,7 +54,7 @@ module AfterbanksPSD2
46
54
 
47
55
  def self.transactions_information_for(response:, products:)
48
56
  transactions_information = []
49
- products_array = products.split(",")
57
+ products_array = products.to_s.split(",").map(&:strip)
50
58
 
51
59
  response.each do |account_information|
52
60
  product = account_information['product']
@@ -1,3 +1,3 @@
1
1
  module AfterbanksPSD2
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: afterbanks-psd2-api-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florent Lemaitre
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-10-14 00:00:00.000000000 Z
11
+ date: 2024-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client