fidor_api 2.0.0 → 2.0.1

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: 7152a33b506bf53d79fbc0c821a2934fc1603e0383eb155989bdf453348d4cba
4
- data.tar.gz: 284f12cf8778162c93b8830b5fb4db5f066115a63cb46c37db6ba6fcd7aece0b
3
+ metadata.gz: ea591697f4b9ea4d84d1b836aa2cb67de5e70d86c9cb726518c139cdfa3df157
4
+ data.tar.gz: d69f03db3d2efceef5ed2851d6780c088bdae26baeded6de1dbbe7144cbdaf1d
5
5
  SHA512:
6
- metadata.gz: b9d5efd9dc9ef4c6b82c1834127ffd2263459bd09172d458da3c6caed1886ce9842312bea50ac37fa8b7a88f4bdaeddf4fd4fd68544664534d1b308567839c4f
7
- data.tar.gz: eb6492bbab496adec66c0c981f56932cd788259f17133329ab0da05e6e97a0471635e0d1fc2f629ca67fd68a76510a254a4e2b5e36bb71ef496de7875273a7e6
6
+ metadata.gz: 8bd4cd844e1385350d18a38cbe9c8ecfcd333b0ff476f8be646d9e66e5c5a9590543baa73f924218459b10ef0afb7c7b8a9492dc0f4b97bb9d01b84b95d11c7d
7
+ data.tar.gz: ef18b392a1561fafd657720f9e7b116ae5a1c0e09d4a47a0b2560c62d79c7bb91f93f3a6c8b35c1486a96f961c78a22b8b011cae97dd0f50687b8ebc3a96a3e6
data/README.md CHANGED
@@ -72,6 +72,10 @@ module FidorApi
72
72
  api_host
73
73
  end
74
74
 
75
+ def auth_redirect_host
76
+ 'http://auth.custom.example.com'
77
+ end
78
+
75
79
  def auth_methods
76
80
  %i[authorization_code resource_owner_password_credentials client_credentials].freeze
77
81
  end
@@ -90,6 +94,16 @@ Rails.application.config.x.tap do |config|
90
94
  end
91
95
  ```
92
96
 
97
+ Methods required to be implemented:
98
+
99
+ | Method Name | Expected to Return | Usage |
100
+ | - | - | - |
101
+ | `api_host` | `String` | Used as endpoint for the normal API calls |
102
+ | `auth_host` | `String` | Used for the oAuth2 calls |
103
+ | `auth_redirect_host` | `String` | Used for the web-based redirect flow URLs |
104
+ | `auth_methods` | `Array` of `Symbol` | Defines the supported oAuth2 authentication methods |
105
+ | `transfers_api` | `Symbol` | Defines which transfer API is supported. `:generic` or `:classic` |
106
+
93
107
  ### 1. oAuth (Rails)
94
108
 
95
109
  Redirect the user to the authorize URL:
@@ -25,7 +25,7 @@ module FidorApi
25
25
  def authorize_start(redirect_uri:, state: SecureRandom.hex(8))
26
26
  check_flow_support! :authorization_code
27
27
 
28
- "#{config.environment.auth_host}/oauth/authorize" \
28
+ "#{config.environment.auth_redirect_host}/oauth/authorize" \
29
29
  + "?client_id=#{config.client_id}" \
30
30
  + "&redirect_uri=#{CGI.escape(redirect_uri)}" \
31
31
  + "&state=#{state}" \
@@ -49,13 +49,15 @@ module FidorApi
49
49
  end
50
50
  rescue Faraday::ClientError => e
51
51
  raise if e.response[:status] != 422
52
+
52
53
  model.tap { |m| m.parse_errors(e.response[:body]) }
53
54
  end
54
55
 
55
56
  POSSIBLE_CONFIRMABLE_HEADERS = %w[x-fidor-confirmation-path location].freeze
56
57
 
57
58
  def extract_confirmable_id(headers)
58
- return if (tuple = headers.detect { |key, _| POSSIBLE_CONFIRMABLE_HEADERS.include? key }).nil?
59
+ return if (tuple = headers.detect { |key, value| POSSIBLE_CONFIRMABLE_HEADERS.include?(key) && value.present? }).nil?
60
+
59
61
  tuple.last.split('/').last
60
62
  end
61
63
  end
@@ -9,6 +9,10 @@ module FidorApi
9
9
  raise NotImplementedError
10
10
  end
11
11
 
12
+ def auth_redirect_host
13
+ raise NotImplementedError
14
+ end
15
+
12
16
  def auth_methods
13
17
  raise NotImplementedError
14
18
  end
@@ -10,6 +10,10 @@ module FidorApi
10
10
  'https://apm.fidor.de'.freeze
11
11
  end
12
12
 
13
+ def auth_redirect_host
14
+ 'https://apm.fidor.de'.freeze
15
+ end
16
+
13
17
  def auth_methods
14
18
  %i[authorization_code].freeze
15
19
  end
@@ -10,6 +10,10 @@ module FidorApi
10
10
  'https://apm.sandbox.fidor.com'.freeze
11
11
  end
12
12
 
13
+ def auth_redirect_host
14
+ 'https://apm.sandbox.fidor.com'.freeze
15
+ end
16
+
13
17
  def auth_methods
14
18
  %i[authorization_code].freeze
15
19
  end
@@ -6,7 +6,11 @@ module FidorApi
6
6
  end
7
7
 
8
8
  def auth_host
9
- api_host
9
+ 'https://api.example.com'.freeze
10
+ end
11
+
12
+ def auth_redirect_host
13
+ 'https://auth.example.com'.freeze
10
14
  end
11
15
 
12
16
  def auth_methods
@@ -7,6 +7,7 @@ module FidorApi
7
7
  define_method name do
8
8
  value = read_attribute(name)
9
9
  return if value.nil?
10
+
10
11
  BigDecimal((value / 100.0).to_s)
11
12
  end
12
13
 
@@ -37,6 +37,7 @@ module FidorApi
37
37
 
38
38
  def routing_type=(type)
39
39
  raise Errors::NotSupported unless SUPPORTED_ROUTING_TYPES.key?(type)
40
+
40
41
  @beneficiary ||= {}
41
42
  @beneficiary['routing_type'] = type
42
43
  define_methods_for(type)
@@ -1,3 +1,3 @@
1
1
  module FidorApi
2
- VERSION = '2.0.0'.freeze
2
+ VERSION = '2.0.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
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.1
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-10 00:00:00.000000000 Z
11
+ date: 2018-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '10.0'
103
+ version: '12.3'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '10.0'
110
+ version: '12.3'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rspec
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -126,16 +126,16 @@ dependencies:
126
126
  name: rubocop
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - "~>"
129
+ - - '='
130
130
  - !ruby/object:Gem::Version
131
- version: '0.58'
131
+ version: 0.59.1
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - "~>"
136
+ - - '='
137
137
  - !ruby/object:Gem::Version
138
- version: '0.58'
138
+ version: 0.59.1
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: simplecov
141
141
  requirement: !ruby/object:Gem::Requirement