fidor_api 2.0.6 → 2.1.3

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: 5dd37e81db3e11e356adccfa11fb66235fa3370e1220581da482d88417b25442
4
- data.tar.gz: 7fee31a5205c39f66d15dde3714d07cfbde6e414e6e1a48a0f4e8f7b45802e2d
3
+ metadata.gz: dde80cf3ee63bb2992c025c4701be72e13e6c90bcd907c9ac654467c4ef44170
4
+ data.tar.gz: '01885ad2f19700dce68a3e133ffe32a0c8479fe0c36fcd61a85ce6cca1d61b3a'
5
5
  SHA512:
6
- metadata.gz: 49ae375b0fd5100dc744a03713cba67cd77cbc2d4712e9369cf16bf8a7b4967a1e77777d50affd97aee9391cdce83dd6cf772b297b49db90552d3ca58bf10771
7
- data.tar.gz: 1a0a82c9a8e80dc9dc9d31e6b4b4436c5683943eca65ca6aaea24d42268e60a65106adbac203e85393ba1d6e4b519d2ab9b2fac4fa4474abc8b6853dc50476ec
6
+ metadata.gz: e91d904bbdd0da115206bff006dd4fc57149aa6f50feef9cb234d7ac7f7de196331416063612f989118b8f15f6d2ec6163728d2f930ef0c1ba773b4e5f9bf53b
7
+ data.tar.gz: 8dc6b3525053907ecd11686b5a4535a683774a242090a73f5649eeb4a74c10494d7ae38df719b618fdbe3e4bd66d462d0afbc65ccdab6259e928517ce17db431
@@ -37,7 +37,7 @@ module FidorApi
37
37
 
38
38
  response
39
39
  rescue Faraday::ClientError => e
40
- client.config.logger.error e.inspect
40
+ client.config.logger.error e.inspect if client.config.logger # rubocop:disable Style/SafeNavigation
41
41
  raise
42
42
  end
43
43
 
@@ -5,19 +5,23 @@ module FidorApi
5
5
  autoload :Cards, 'fidor_api/client/dsl/cards'
6
6
  autoload :ConfirmableActions, 'fidor_api/client/dsl/confirmable_actions'
7
7
  autoload :CoreData, 'fidor_api/client/dsl/core_data'
8
+ autoload :DebitReturns, 'fidor_api/client/dsl/debit_returns'
8
9
  autoload :Messages, 'fidor_api/client/dsl/messages'
9
10
  autoload :Preauths, 'fidor_api/client/dsl/preauths'
11
+ autoload :ScheduledTransfers, 'fidor_api/client/dsl/scheduled_transfers'
10
12
  autoload :StandingOrders, 'fidor_api/client/dsl/standing_orders'
11
13
  autoload :Transactions, 'fidor_api/client/dsl/transactions'
12
14
  autoload :Transfers, 'fidor_api/client/dsl/transfers'
13
15
 
14
- def self.included(klass)
16
+ def self.included(klass) # rubocop:disable Metrics/MethodLength
15
17
  klass.include Accounts
16
18
  klass.include Cards
17
19
  klass.include ConfirmableActions
18
20
  klass.include CoreData
21
+ klass.include DebitReturns
19
22
  klass.include Messages
20
23
  klass.include Preauths
24
+ klass.include ScheduledTransfers
21
25
  klass.include StandingOrders
22
26
  klass.include Transactions
23
27
  klass.include Transfers
@@ -5,6 +5,10 @@ module FidorApi
5
5
  def account_transactions(id, options = {})
6
6
  fetch(:collection, Model::Transaction, "accounts/#{id}/transactions", options)
7
7
  end
8
+
9
+ def account_transaction(account_id, transaction_id, options = {})
10
+ fetch(:single, Model::Transaction, "accounts/#{account_id}/transactions/#{transaction_id}", options)
11
+ end
8
12
  end
9
13
  end
10
14
  end
@@ -9,6 +9,10 @@ module FidorApi
9
9
  def card(id, options = {})
10
10
  fetch(:single, Model::Card, "cards/#{id}", options)
11
11
  end
12
+
13
+ def create_card(attributes = {}, options = {})
14
+ create(FidorApi::Model::Card, 'cards', attributes, options)
15
+ end
12
16
  end
13
17
  end
14
18
  end
@@ -0,0 +1,19 @@
1
+ module FidorApi
2
+ class Client
3
+ module DSL
4
+ module DebitReturns
5
+ def debit_return(transaction_id, options = {})
6
+ fetch(:single, Model::DebitReturn, "transactions/#{transaction_id}/debit_return", options)
7
+ end
8
+
9
+ def create_debit_return(transaction_id, options = {})
10
+ create(FidorApi::Model::DebitReturn, "transactions/#{transaction_id}/debit_return", {}, options)
11
+ end
12
+
13
+ def confirm_debit_return(transaction_id, options = {})
14
+ request(:put, "/transactions/#{transaction_id}/debit_return/confirm", {}, options[:headers] || {})
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,35 @@
1
+ module FidorApi
2
+ class Client
3
+ module DSL
4
+ module ScheduledTransfers
5
+ def scheduled_transfers(options = {})
6
+ fetch(:collection, FidorApi::Model::ScheduledTransfer, 'scheduled_transfers', options)
7
+ end
8
+
9
+ def scheduled_transfer(id, options = {})
10
+ fetch(:single, FidorApi::Model::ScheduledTransfer, "scheduled_transfers/#{id}", options)
11
+ end
12
+
13
+ def new_scheduled_transfer(attributes = {})
14
+ FidorApi::Model::ScheduledTransfer.new(attributes)
15
+ end
16
+
17
+ def create_scheduled_transfer(attributes = {}, options = {})
18
+ create(FidorApi::Model::ScheduledTransfer, 'scheduled_transfers', attributes, options)
19
+ end
20
+
21
+ def update_scheduled_transfer(id, attributes = {}, options = {})
22
+ update(FidorApi::Model::ScheduledTransfer, "scheduled_transfers/#{id}", id, attributes, options)
23
+ end
24
+
25
+ def confirm_scheduled_transfer(id, options = {})
26
+ request(:put, "scheduled_transfers/#{id}/confirm", {}, options[:headers])
27
+ end
28
+
29
+ def delete_scheduled_transfer(id, options = {})
30
+ request(:delete, "scheduled_transfers/#{id}", nil, options[:headers])
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -6,12 +6,28 @@ module FidorApi
6
6
  fetch(:single, FidorApi::Model::StandingOrder, "standing_orders/#{id}", options)
7
7
  end
8
8
 
9
+ def standing_orders(options = {})
10
+ fetch(:collection, FidorApi::Model::StandingOrder, 'standing_orders', options)
11
+ end
12
+
9
13
  def new_standing_order(attributes = {})
10
14
  FidorApi::Model::StandingOrder.new(attributes)
11
15
  end
12
16
 
13
- def create_standing_order(attributes = {})
14
- create(FidorApi::Model::StandingOrder, 'standing_orders', attributes)
17
+ def create_standing_order(attributes = {}, options = {})
18
+ create(FidorApi::Model::StandingOrder, 'standing_orders', attributes, options)
19
+ end
20
+
21
+ def update_standing_order(id, attributes = {}, options = {})
22
+ update(FidorApi::Model::StandingOrder, "standing_orders/#{id}", id, attributes, options)
23
+ end
24
+
25
+ def confirm_standing_order(id, options = {})
26
+ request(:put, "standing_orders/#{id}/confirm", {}, options[:headers])
27
+ end
28
+
29
+ def delete_standing_order(id, options = {})
30
+ request(:delete, "standing_orders/#{id}", nil, options[:headers])
15
31
  end
16
32
  end
17
33
  end
@@ -30,7 +30,7 @@ module FidorApi
30
30
 
31
31
  def confirm_transfer(id, options = {})
32
32
  check_transfer_support! :generic
33
- request(:put, "/transfers/#{id}/confirm", {}, options.delete(:headers)).headers['Location']
33
+ request(:put, "/transfers/#{id}/confirm", {}, options[:headers])
34
34
  end
35
35
  end
36
36
  end
@@ -5,9 +5,11 @@ module FidorApi
5
5
  autoload :Card, 'fidor_api/model/card'
6
6
  autoload :ConfirmableAction, 'fidor_api/model/confirmable_action'
7
7
  autoload :Customer, 'fidor_api/model/customer'
8
+ autoload :DebitReturn, 'fidor_api/model/debit_return'
8
9
  autoload :Helpers, 'fidor_api/model/helpers'
9
10
  autoload :Message, 'fidor_api/model/message'
10
11
  autoload :Preauth, 'fidor_api/model/preauth'
12
+ autoload :ScheduledTransfer, 'fidor_api/model/scheduled_transfer'
11
13
  autoload :StandingOrder, 'fidor_api/model/standing_order'
12
14
  autoload :Transaction, 'fidor_api/model/transaction'
13
15
  autoload :Transfer, 'fidor_api/model/transfer'
@@ -36,7 +36,8 @@ module FidorApi
36
36
  next unless respond_to?(field) || field == :base
37
37
 
38
38
  if key
39
- errors.add(field, key.to_sym, hash.symbolize_keys)
39
+ # https://github.com/rails/rails/issues/28903
40
+ errors.add(field, key.to_sym, hash.symbolize_keys.except(:message))
40
41
  else
41
42
  errors.add(field, hash.delete('message'), hash.symbolize_keys)
42
43
  end
@@ -2,7 +2,8 @@ module FidorApi
2
2
  module Model
3
3
  class Card < Base
4
4
  attribute :id, :integer
5
- attribute :account_id, :integer
5
+ attribute :identifier, :string
6
+ attribute :account_id, :string
6
7
  attribute :type, :string
7
8
  attribute :physical, :boolean
8
9
  attribute :design, :string
@@ -0,0 +1,7 @@
1
+ module FidorApi
2
+ module Model
3
+ class DebitReturn < Base
4
+ attribute :state, :string
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,55 @@
1
+ require_relative './beneficiary_helper'
2
+
3
+ module FidorApi
4
+ module Model
5
+ class ScheduledTransfer < Model::Base
6
+ include BeneficiaryHelper
7
+
8
+ attribute :id, :string
9
+ attribute :account_id, :integer
10
+ attribute :external_uid, :string
11
+ attribute :amount, :integer
12
+ attribute :currency, :string
13
+ attribute :subject, :string
14
+ attribute :beneficiary, :json
15
+ attribute :state, :string
16
+ attribute :scheduled_date, :string
17
+ attribute :created_at, :string
18
+
19
+ attribute_decimal_methods :amount
20
+
21
+ def beneficiary=(value)
22
+ write_attribute(:beneficiary, value)
23
+ define_methods_for(SUPPORTED_ROUTING_TYPES[beneficiary['routing_type']])
24
+ end
25
+
26
+ def routing_type
27
+ @beneficiary ||= {}
28
+ @beneficiary.dig('routing_type')
29
+ end
30
+
31
+ def routing_type=(type)
32
+ raise Errors::NotSupported unless SUPPORTED_ROUTING_TYPES.key?(type)
33
+
34
+ @beneficiary ||= {}
35
+ @beneficiary['routing_type'] = type
36
+ define_methods_for(SUPPORTED_ROUTING_TYPES[type])
37
+ end
38
+
39
+ %w[bank contact].each do |category|
40
+ %w[name address_line_1 address_line_2 city country].each do |attribute|
41
+ define_method "#{category}_#{attribute}" do
42
+ @beneficiary ||= {}
43
+ @beneficiary.dig(category, attribute)
44
+ end
45
+
46
+ define_method "#{category}_#{attribute}=" do |value|
47
+ @beneficiary ||= {}
48
+ @beneficiary[category] ||= {}
49
+ @beneficiary[category][attribute] = value
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -12,6 +12,7 @@ module FidorApi
12
12
  attribute :currency, :string
13
13
  attribute :subject, :string
14
14
  attribute :beneficiary, :json
15
+ attribute :state, :string
15
16
  attribute :schedule, :json
16
17
 
17
18
  attribute_decimal_methods :amount
@@ -45,6 +46,21 @@ module FidorApi
45
46
  @schedule[attribute] = value
46
47
  end
47
48
  end
49
+
50
+ %w[bank contact].each do |category|
51
+ %w[name address_line_1 address_line_2 city country].each do |attribute|
52
+ define_method "#{category}_#{attribute}" do
53
+ @beneficiary ||= {}
54
+ @beneficiary.dig(category, attribute)
55
+ end
56
+
57
+ define_method "#{category}_#{attribute}=" do |value|
58
+ @beneficiary ||= {}
59
+ @beneficiary[category] ||= {}
60
+ @beneficiary[category][attribute] = value
61
+ end
62
+ end
63
+ end
48
64
  end
49
65
  end
50
66
  end
@@ -6,14 +6,14 @@ module FidorApi
6
6
  class Generic < Model::Base
7
7
  include BeneficiaryHelper
8
8
 
9
- attribute :id, :string
10
- attribute :account_id, :string
11
- attribute :external_uid, :string
12
- attribute :amount, :integer
13
- attribute :currency, :string
14
- attribute :subject, :string
15
- attribute :beneficiary, :json
16
- attribute :state, :string
9
+ attribute :id, :string
10
+ attribute :account_id, :string
11
+ attribute :external_uid, :string
12
+ attribute :amount, :integer
13
+ attribute :currency, :string
14
+ attribute :subject, :string
15
+ attribute :beneficiary, :json
16
+ attribute :state, :string
17
17
 
18
18
  attribute_decimal_methods :amount
19
19
 
@@ -1,3 +1,3 @@
1
1
  module FidorApi
2
- VERSION = '2.0.6'.freeze
2
+ VERSION = '2.1.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fidor_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.6
4
+ version: 2.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fidor Solutions AG
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-01-11 00:00:00.000000000 Z
11
+ date: 2021-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '5.0'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '7'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: '5.0'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '7'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: faraday
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -72,28 +78,28 @@ dependencies:
72
78
  requirements:
73
79
  - - "~>"
74
80
  - !ruby/object:Gem::Version
75
- version: '10.0'
81
+ version: '11.0'
76
82
  type: :development
77
83
  prerelease: false
78
84
  version_requirements: !ruby/object:Gem::Requirement
79
85
  requirements:
80
86
  - - "~>"
81
87
  - !ruby/object:Gem::Version
82
- version: '10.0'
88
+ version: '11.0'
83
89
  - !ruby/object:Gem::Dependency
84
90
  name: rake
85
91
  requirement: !ruby/object:Gem::Requirement
86
92
  requirements:
87
93
  - - "~>"
88
94
  - !ruby/object:Gem::Version
89
- version: '12.3'
95
+ version: '13.0'
90
96
  type: :development
91
97
  prerelease: false
92
98
  version_requirements: !ruby/object:Gem::Requirement
93
99
  requirements:
94
100
  - - "~>"
95
101
  - !ruby/object:Gem::Version
96
- version: '12.3'
102
+ version: '13.0'
97
103
  - !ruby/object:Gem::Dependency
98
104
  name: rspec
99
105
  requirement: !ruby/object:Gem::Requirement
@@ -114,14 +120,14 @@ dependencies:
114
120
  requirements:
115
121
  - - '='
116
122
  - !ruby/object:Gem::Version
117
- version: 0.62.0
123
+ version: 0.75.0
118
124
  type: :development
119
125
  prerelease: false
120
126
  version_requirements: !ruby/object:Gem::Requirement
121
127
  requirements:
122
128
  - - '='
123
129
  - !ruby/object:Gem::Version
124
- version: 0.62.0
130
+ version: 0.75.0
125
131
  - !ruby/object:Gem::Dependency
126
132
  name: simplecov
127
133
  requirement: !ruby/object:Gem::Requirement
@@ -150,7 +156,7 @@ dependencies:
150
156
  - - "~>"
151
157
  - !ruby/object:Gem::Version
152
158
  version: '3.4'
153
- description:
159
+ description:
154
160
  email:
155
161
  - connect@fidor.com
156
162
  executables: []
@@ -169,8 +175,10 @@ files:
169
175
  - lib/fidor_api/client/dsl/cards.rb
170
176
  - lib/fidor_api/client/dsl/confirmable_actions.rb
171
177
  - lib/fidor_api/client/dsl/core_data.rb
178
+ - lib/fidor_api/client/dsl/debit_returns.rb
172
179
  - lib/fidor_api/client/dsl/messages.rb
173
180
  - lib/fidor_api/client/dsl/preauths.rb
181
+ - lib/fidor_api/client/dsl/scheduled_transfers.rb
174
182
  - lib/fidor_api/client/dsl/standing_orders.rb
175
183
  - lib/fidor_api/client/dsl/transactions.rb
176
184
  - lib/fidor_api/client/dsl/transfers.rb
@@ -192,11 +200,13 @@ files:
192
200
  - lib/fidor_api/model/card.rb
193
201
  - lib/fidor_api/model/confirmable_action.rb
194
202
  - lib/fidor_api/model/customer.rb
203
+ - lib/fidor_api/model/debit_return.rb
195
204
  - lib/fidor_api/model/helpers.rb
196
205
  - lib/fidor_api/model/helpers/action_view_support.rb
197
206
  - lib/fidor_api/model/helpers/attribute_decimal_methods.rb
198
207
  - lib/fidor_api/model/message.rb
199
208
  - lib/fidor_api/model/preauth.rb
209
+ - lib/fidor_api/model/scheduled_transfer.rb
200
210
  - lib/fidor_api/model/standing_order.rb
201
211
  - lib/fidor_api/model/transaction.rb
202
212
  - lib/fidor_api/model/transfer.rb
@@ -212,7 +222,7 @@ homepage: https://github.com/fidor/fidor_api
212
222
  licenses:
213
223
  - MIT
214
224
  metadata: {}
215
- post_install_message:
225
+ post_install_message:
216
226
  rdoc_options: []
217
227
  require_paths:
218
228
  - lib
@@ -227,9 +237,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
227
237
  - !ruby/object:Gem::Version
228
238
  version: '0'
229
239
  requirements: []
230
- rubyforge_project:
231
- rubygems_version: 2.7.7
232
- signing_key:
240
+ rubygems_version: 3.2.15
241
+ signing_key:
233
242
  specification_version: 4
234
243
  summary: Ruby client library to work with Fidor APIs
235
244
  test_files: []