fidor_api 2.0.0.alpha1 → 2.0.0
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 +4 -4
- data/README.md +56 -1
- data/lib/fidor_api/client/configuration.rb +2 -0
- data/lib/fidor_api/client/connection.rb +2 -1
- data/lib/fidor_api/client/dsl/cards.rb +15 -0
- data/lib/fidor_api/client/dsl/preauths.rb +15 -0
- data/lib/fidor_api/client/dsl/transfers/classic.rb +20 -0
- data/lib/fidor_api/client/dsl.rb +6 -2
- data/lib/fidor_api/model/card.rb +30 -0
- data/lib/fidor_api/model/preauth.rb +15 -0
- data/lib/fidor_api/model/transaction.rb +4 -4
- data/lib/fidor_api/model/transfer/classic/internal.rb +1 -0
- data/lib/fidor_api/model/transfer/classic/sepa.rb +13 -1
- data/lib/fidor_api/model.rb +2 -0
- data/lib/fidor_api/version.rb +1 -1
- metadata +10 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7152a33b506bf53d79fbc0c821a2934fc1603e0383eb155989bdf453348d4cba
|
4
|
+
data.tar.gz: 284f12cf8778162c93b8830b5fb4db5f066115a63cb46c37db6ba6fcd7aece0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9d5efd9dc9ef4c6b82c1834127ffd2263459bd09172d458da3c6caed1886ce9842312bea50ac37fa8b7a88f4bdaeddf4fd4fd68544664534d1b308567839c4f
|
7
|
+
data.tar.gz: eb6492bbab496adec66c0c981f56932cd788259f17133329ab0da05e6e97a0471635e0d1fc2f629ca67fd68a76510a254a4e2b5e36bb71ef496de7875273a7e6
|
data/README.md
CHANGED
@@ -29,9 +29,64 @@ Or install it yourself as:
|
|
29
29
|
|
30
30
|
```ruby
|
31
31
|
client = FidorApi::Client.new do |config|
|
32
|
-
config.environment
|
32
|
+
# config.environment = FidorApi::Environment::FidorDE::Sandbox
|
33
33
|
config.client_id = 'your-client-id'
|
34
34
|
config.client_secret = 'your-client-secret'
|
35
|
+
|
36
|
+
# optional
|
37
|
+
config.faraday = lambda do |faraday|
|
38
|
+
faraday.use MyApp::CustomFaradayLogger, Rails.logger
|
39
|
+
end
|
40
|
+
end
|
41
|
+
```
|
42
|
+
|
43
|
+
#### Environments
|
44
|
+
|
45
|
+
By default this gem ships with different supported environments:
|
46
|
+
|
47
|
+
`FidorApi::Environment::FidorDE::Sandbox` (default)<br>
|
48
|
+
Connects against the Fidor Germany Sandbox API (`*.sandbox.fidor.com`).<br>
|
49
|
+
Supports only oauth2 authorization code flow and the classic transfer APIs.
|
50
|
+
|
51
|
+
`FidorApi::Environment::FidorDE::Production`<br>
|
52
|
+
Connects against the Fidor Germany Production API (`*.fidor.de`).<br>
|
53
|
+
Supports only oauth2 authorization code flow and the classic transfer APIs.
|
54
|
+
|
55
|
+
`FidorApi::Environment::Future`<br>
|
56
|
+
Connects against a fictional API version which represents a future version of the Fidor Standard API (`*.example.com`).<br>
|
57
|
+
Supports more oauth2 based authorization flows and the generic transfer API.<br>
|
58
|
+
It is used for testing purposes only.
|
59
|
+
|
60
|
+
In some cases you'll need to connect to a custom environment (e.g. when using mocked APIs or if you're working with internal test-servers).<br>
|
61
|
+
For this you can simply implement your own environment definition (for example inside your application code):
|
62
|
+
|
63
|
+
```ruby
|
64
|
+
module FidorApi
|
65
|
+
module Environment
|
66
|
+
class Custom < Base
|
67
|
+
def api_host
|
68
|
+
'http://api.custom.example.com'
|
69
|
+
end
|
70
|
+
|
71
|
+
def auth_host
|
72
|
+
api_host
|
73
|
+
end
|
74
|
+
|
75
|
+
def auth_methods
|
76
|
+
%i[authorization_code resource_owner_password_credentials client_credentials].freeze
|
77
|
+
end
|
78
|
+
|
79
|
+
def transfers_api
|
80
|
+
:generic
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
Rails.application.config.x.tap do |config|
|
87
|
+
# [...]
|
88
|
+
config.fidor_api.environment = FidorApi::Environment::Custom.new
|
89
|
+
# [...]
|
35
90
|
end
|
36
91
|
```
|
37
92
|
|
@@ -10,6 +10,7 @@ module FidorApi
|
|
10
10
|
logger
|
11
11
|
log_bodies
|
12
12
|
verify_ssl
|
13
|
+
faraday
|
13
14
|
].freeze
|
14
15
|
|
15
16
|
attr_accessor(*ATTRIBUTES)
|
@@ -19,6 +20,7 @@ module FidorApi
|
|
19
20
|
self.logger = Logger.new(STDOUT)
|
20
21
|
self.log_bodies = true
|
21
22
|
self.verify_ssl = true
|
23
|
+
self.faraday = ->(faraday) {}
|
22
24
|
end
|
23
25
|
|
24
26
|
def validate!
|
@@ -48,7 +48,8 @@ module FidorApi
|
|
48
48
|
config.response :logger, client.config.logger, bodies: client.config.log_bodies if client.config.logger
|
49
49
|
config.response :raise_error
|
50
50
|
config.response :json, content_type: /json/
|
51
|
-
config.
|
51
|
+
client.config.faraday.call(config)
|
52
|
+
config.adapter Faraday.default_adapter
|
52
53
|
end
|
53
54
|
end
|
54
55
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module FidorApi
|
2
|
+
class Client
|
3
|
+
module DSL
|
4
|
+
module Cards
|
5
|
+
def cards(options = {})
|
6
|
+
fetch(:collection, Model::Card, '/cards', options)
|
7
|
+
end
|
8
|
+
|
9
|
+
def card(id, options = {})
|
10
|
+
fetch(:single, Model::Card, "/cards/#{id}", options)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module FidorApi
|
2
|
+
class Client
|
3
|
+
module DSL
|
4
|
+
module Preauths
|
5
|
+
def preauths(options = {})
|
6
|
+
fetch(:collection, Model::Preauth, '/preauths', options)
|
7
|
+
end
|
8
|
+
|
9
|
+
def preauth(id, options = {})
|
10
|
+
fetch(:single, Model::Preauth, "/preauths/#{id}", options)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -22,6 +22,26 @@ module FidorApi
|
|
22
22
|
check_transfer_support! :classic
|
23
23
|
create(FidorApi::Model::Transfer::Classic::Internal, '/internal_transfers', attributes)
|
24
24
|
end
|
25
|
+
|
26
|
+
def sepa_transfers(options = {})
|
27
|
+
check_transfer_support! :classic
|
28
|
+
fetch(:collection, FidorApi::Model::Transfer::Classic::SEPA, '/sepa_credit_transfers', options)
|
29
|
+
end
|
30
|
+
|
31
|
+
def sepa_transfer(id, options = {})
|
32
|
+
check_transfer_support! :classic
|
33
|
+
fetch(:single, FidorApi::Model::Transfer::Classic::SEPA, "/sepa_credit_transfers/#{id}", options)
|
34
|
+
end
|
35
|
+
|
36
|
+
def new_sepa_transfer(attributes = {})
|
37
|
+
check_transfer_support! :classic
|
38
|
+
Model::Transfer::Classic::SEPA.new(attributes)
|
39
|
+
end
|
40
|
+
|
41
|
+
def create_sepa_transfer(attributes = {})
|
42
|
+
check_transfer_support! :classic
|
43
|
+
create(FidorApi::Model::Transfer::Classic::SEPA, '/sepa_credit_transfers', attributes)
|
44
|
+
end
|
25
45
|
end
|
26
46
|
end
|
27
47
|
end
|
data/lib/fidor_api/client/dsl.rb
CHANGED
@@ -1,18 +1,22 @@
|
|
1
1
|
module FidorApi
|
2
2
|
class Client
|
3
3
|
module DSL
|
4
|
+
autoload :Cards, 'fidor_api/client/dsl/cards'
|
4
5
|
autoload :ConfirmableActions, 'fidor_api/client/dsl/confirmable_actions'
|
5
6
|
autoload :CoreData, 'fidor_api/client/dsl/core_data'
|
6
7
|
autoload :Messages, 'fidor_api/client/dsl/messages'
|
7
|
-
autoload :
|
8
|
+
autoload :Preauths, 'fidor_api/client/dsl/preauths'
|
8
9
|
autoload :Transactions, 'fidor_api/client/dsl/transactions'
|
10
|
+
autoload :Transfers, 'fidor_api/client/dsl/transfers'
|
9
11
|
|
10
12
|
def self.included(klass)
|
13
|
+
klass.include Cards
|
11
14
|
klass.include ConfirmableActions
|
12
15
|
klass.include CoreData
|
13
16
|
klass.include Messages
|
14
|
-
klass.include
|
17
|
+
klass.include Preauths
|
15
18
|
klass.include Transactions
|
19
|
+
klass.include Transfers
|
16
20
|
end
|
17
21
|
|
18
22
|
private
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module FidorApi
|
2
|
+
module Model
|
3
|
+
class Card < Base
|
4
|
+
attribute :id, :integer
|
5
|
+
attribute :account_id, :integer
|
6
|
+
attribute :type, :string
|
7
|
+
attribute :physical, :boolean
|
8
|
+
attribute :design, :string
|
9
|
+
attribute :state, :string
|
10
|
+
attribute :disabled, :boolean
|
11
|
+
attribute :inscription, :string
|
12
|
+
attribute :balance, :integer
|
13
|
+
attribute :currency, :string
|
14
|
+
attribute :atm_limit, :integer
|
15
|
+
attribute :transaction_single_limit, :integer
|
16
|
+
attribute :transaction_volume_limit, :integer
|
17
|
+
attribute :email_notification, :boolean
|
18
|
+
attribute :sms_notification, :boolean
|
19
|
+
attribute :payed, :boolean
|
20
|
+
attribute :lock_reason, :string
|
21
|
+
attribute :created_at, :time
|
22
|
+
attribute :updated_at, :time
|
23
|
+
|
24
|
+
attribute_decimal_methods :balance
|
25
|
+
attribute_decimal_methods :atm_limit
|
26
|
+
attribute_decimal_methods :transaction_single_limit
|
27
|
+
attribute_decimal_methods :transaction_volume_limit
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module FidorApi
|
2
|
+
module Model
|
3
|
+
class Preauth < Base
|
4
|
+
attribute :id, :integer
|
5
|
+
attribute :preauth_type_details, :json
|
6
|
+
attribute :preauth_type, :string
|
7
|
+
attribute :amount, :integer
|
8
|
+
attribute :expires_at, :time
|
9
|
+
attribute :created_at, :time
|
10
|
+
attribute :updated_at, :time
|
11
|
+
|
12
|
+
attribute_decimal_methods :amount
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -8,12 +8,12 @@ module FidorApi
|
|
8
8
|
attribute :subject, :string
|
9
9
|
attribute :amount, :integer
|
10
10
|
attribute :booking_code, :string
|
11
|
-
attribute :booking_date, :
|
12
|
-
attribute :value_date, :
|
11
|
+
attribute :booking_date, :time
|
12
|
+
attribute :value_date, :time
|
13
13
|
attribute :return_transaction_id, :string
|
14
14
|
attribute :currency, :string
|
15
|
-
attribute :created_at, :
|
16
|
-
attribute :updated_at, :
|
15
|
+
attribute :created_at, :time
|
16
|
+
attribute :updated_at, :time
|
17
17
|
|
18
18
|
attribute_decimal_methods :amount
|
19
19
|
end
|
@@ -3,7 +3,19 @@ module FidorApi
|
|
3
3
|
module Transfer
|
4
4
|
module Classic
|
5
5
|
class SEPA < Base
|
6
|
-
attribute :id,
|
6
|
+
attribute :id, :integer
|
7
|
+
attribute :account_id, :string
|
8
|
+
attribute :external_uid, :string
|
9
|
+
attribute :remote_name, :string
|
10
|
+
attribute :remote_iban, :string
|
11
|
+
attribute :remote_bic, :string
|
12
|
+
attribute :amount, :integer
|
13
|
+
attribute :subject, :string
|
14
|
+
attribute :state, :string
|
15
|
+
attribute :created_at, :time
|
16
|
+
attribute :updated_at, :time
|
17
|
+
|
18
|
+
attribute_decimal_methods :amount
|
7
19
|
end
|
8
20
|
end
|
9
21
|
end
|
data/lib/fidor_api/model.rb
CHANGED
@@ -2,10 +2,12 @@ module FidorApi
|
|
2
2
|
module Model
|
3
3
|
autoload :Account, 'fidor_api/model/account'
|
4
4
|
autoload :Base, 'fidor_api/model/base'
|
5
|
+
autoload :Card, 'fidor_api/model/card'
|
5
6
|
autoload :ConfirmableAction, 'fidor_api/model/confirmable_action'
|
6
7
|
autoload :Customer, 'fidor_api/model/customer'
|
7
8
|
autoload :Helpers, 'fidor_api/model/helpers'
|
8
9
|
autoload :Message, 'fidor_api/model/message'
|
10
|
+
autoload :Preauth, 'fidor_api/model/preauth'
|
9
11
|
autoload :Transaction, 'fidor_api/model/transaction'
|
10
12
|
autoload :Transfer, 'fidor_api/model/transfer'
|
11
13
|
autoload :User, 'fidor_api/model/user'
|
data/lib/fidor_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fidor_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fidor Solutions AG
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-10 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
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '5.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
@@ -179,9 +179,11 @@ files:
|
|
179
179
|
- lib/fidor_api/client/configuration.rb
|
180
180
|
- lib/fidor_api/client/connection.rb
|
181
181
|
- lib/fidor_api/client/dsl.rb
|
182
|
+
- lib/fidor_api/client/dsl/cards.rb
|
182
183
|
- lib/fidor_api/client/dsl/confirmable_actions.rb
|
183
184
|
- lib/fidor_api/client/dsl/core_data.rb
|
184
185
|
- lib/fidor_api/client/dsl/messages.rb
|
186
|
+
- lib/fidor_api/client/dsl/preauths.rb
|
185
187
|
- lib/fidor_api/client/dsl/transactions.rb
|
186
188
|
- lib/fidor_api/client/dsl/transfers.rb
|
187
189
|
- lib/fidor_api/client/dsl/transfers/classic.rb
|
@@ -198,12 +200,14 @@ files:
|
|
198
200
|
- lib/fidor_api/model.rb
|
199
201
|
- lib/fidor_api/model/account.rb
|
200
202
|
- lib/fidor_api/model/base.rb
|
203
|
+
- lib/fidor_api/model/card.rb
|
201
204
|
- lib/fidor_api/model/confirmable_action.rb
|
202
205
|
- lib/fidor_api/model/customer.rb
|
203
206
|
- lib/fidor_api/model/helpers.rb
|
204
207
|
- lib/fidor_api/model/helpers/action_view_support.rb
|
205
208
|
- lib/fidor_api/model/helpers/attribute_decimal_methods.rb
|
206
209
|
- lib/fidor_api/model/message.rb
|
210
|
+
- lib/fidor_api/model/preauth.rb
|
207
211
|
- lib/fidor_api/model/transaction.rb
|
208
212
|
- lib/fidor_api/model/transfer.rb
|
209
213
|
- lib/fidor_api/model/transfer/classic.rb
|
@@ -229,9 +233,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
229
233
|
version: '0'
|
230
234
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
231
235
|
requirements:
|
232
|
-
- - "
|
236
|
+
- - ">="
|
233
237
|
- !ruby/object:Gem::Version
|
234
|
-
version:
|
238
|
+
version: '0'
|
235
239
|
requirements: []
|
236
240
|
rubyforge_project:
|
237
241
|
rubygems_version: 2.7.6
|