flinks 0.4.2 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/flinks.gemspec +3 -3
- data/lib/flinks/api/account.rb +6 -6
- data/lib/flinks/api/authorize.rb +8 -8
- data/lib/flinks/api/card.rb +3 -3
- data/lib/flinks/api/refresh.rb +2 -2
- data/lib/flinks/api/statement.rb +2 -2
- data/lib/flinks/client.rb +3 -3
- data/lib/flinks/error.rb +5 -5
- data/lib/flinks/request.rb +11 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 190e14203528b2f647874f9b2de0b65e79129e1a5e61a643069d216bc45b54fc
|
4
|
+
data.tar.gz: bc172cc34769f3c9ba9e9758489f3bd1f6129515fac5440a68746a8d78130cf4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9310956e4c65b4363d4906cfbf8451341b6556d7ecfac8a1474bdfa6a8c7ec0c6cea4dd82d116066397aff99235aabb1c15b79539a65a2685aa70ed36f94b50e
|
7
|
+
data.tar.gz: bab30618f7c360ec5ec9fedfc87cf2f3cfa1125dc8bf4ddc9002399f487b8ccb4e7969bb621aa1fbdae2436fded4f350c154ddab48c17552ffced9de65ebdb5f
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.5.0
|
data/flinks.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: flinks 0.
|
5
|
+
# stub: flinks 0.5.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "flinks".freeze
|
9
|
-
s.version = "0.
|
9
|
+
s.version = "0.5.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["Philippe Dionne".freeze]
|
14
|
-
s.date = "2018-
|
14
|
+
s.date = "2018-07-03"
|
15
15
|
s.description = "Flinks financial services API client".freeze
|
16
16
|
s.email = "dionne.phil@gmail.com".freeze
|
17
17
|
s.extra_rdoc_files = [
|
data/lib/flinks/api/account.rb
CHANGED
@@ -39,8 +39,8 @@ module Flinks
|
|
39
39
|
end
|
40
40
|
|
41
41
|
# @see https://sandbox-api.flinks.io/Readme/#get-accounts-summary
|
42
|
-
# @param
|
43
|
-
# @param
|
42
|
+
# @param [String] request_id
|
43
|
+
# @param [Hash] options
|
44
44
|
# @return [Hash]
|
45
45
|
def accounts_summary(request_id:, options: {})
|
46
46
|
payload = options.merge(request_id: request_id)
|
@@ -50,8 +50,8 @@ module Flinks
|
|
50
50
|
end
|
51
51
|
|
52
52
|
# @see https://sandbox-api.flinks.io/Readme/#get-accounts-detail
|
53
|
-
# @param
|
54
|
-
# @param
|
53
|
+
# @param [String] request_id
|
54
|
+
# @param [Hash] options
|
55
55
|
# @return [Hash]
|
56
56
|
def accounts_detail(request_id:, options: {})
|
57
57
|
payload = options.merge(request_id: request_id)
|
@@ -61,14 +61,14 @@ module Flinks
|
|
61
61
|
end
|
62
62
|
|
63
63
|
# @see https://sandbox-api.flinks.io/Readme/#get-accounts-summary
|
64
|
-
# @param
|
64
|
+
# @param [String] request_id
|
65
65
|
# @return [Hash]
|
66
66
|
def accounts_summary_async(request_id:)
|
67
67
|
get("#{customer_id}/BankingServices/GetAccountsSummaryAsync/#{request_id}")
|
68
68
|
end
|
69
69
|
|
70
70
|
# @see https://sandbox-api.flinks.io/Readme/#get-accounts-detail
|
71
|
-
# @param
|
71
|
+
# @param [String] request_id
|
72
72
|
# @return [Hash]
|
73
73
|
def accounts_detail_async(request_id:)
|
74
74
|
get("#{customer_id}/BankingServices/GetAccountsDetailAsync/#{request_id}")
|
data/lib/flinks/api/authorize.rb
CHANGED
@@ -42,8 +42,8 @@ module Flinks
|
|
42
42
|
end
|
43
43
|
|
44
44
|
# @see https://sandbox-api.flinks.io/Readme/#authorize
|
45
|
-
# @param
|
46
|
-
# @param
|
45
|
+
# @param [String] login_id
|
46
|
+
# @param [Hash] options
|
47
47
|
# @return [Hash]
|
48
48
|
def authorize(login_id:, options: {})
|
49
49
|
payload = options.merge(login_id: login_id)
|
@@ -53,10 +53,10 @@ module Flinks
|
|
53
53
|
end
|
54
54
|
|
55
55
|
# @see https://sandbox-api.flinks.io/Readme/#authorize
|
56
|
-
# @param
|
57
|
-
# @param
|
58
|
-
# @param
|
59
|
-
# @param
|
56
|
+
# @param [String] username
|
57
|
+
# @param [String] password
|
58
|
+
# @param [String] institution
|
59
|
+
# @param [Hash] options
|
60
60
|
def authorize_with_credentials(username:, password:, institution:, options: {})
|
61
61
|
payload = options.merge(username: username, password: password, institution: institution)
|
62
62
|
validate_request!(AuthorizeWithCredentialsRequestSchema, payload)
|
@@ -65,8 +65,8 @@ module Flinks
|
|
65
65
|
end
|
66
66
|
|
67
67
|
# @see https://sandbox-api.flinks.io/Readme/#authorize-multiple
|
68
|
-
# @param
|
69
|
-
# @param
|
68
|
+
# @param [Array] login_ids
|
69
|
+
# @param [Hash] options
|
70
70
|
# @return [Hash]
|
71
71
|
def authorize_multiple(login_ids:, options: {})
|
72
72
|
payload = options.merge(login_ids: login_ids)
|
data/lib/flinks/api/card.rb
CHANGED
@@ -5,10 +5,10 @@ module Flinks
|
|
5
5
|
module Card
|
6
6
|
|
7
7
|
# https://sandbox-api.flinks.io/Readme/#delete-card-information
|
8
|
-
# @param
|
8
|
+
# @param [String] login_id
|
9
9
|
# @return [Hash]
|
10
|
-
def delete_card(
|
11
|
-
get("#{customer_id}/BankingServices/DeleteCard/#{
|
10
|
+
def delete_card(login_id:)
|
11
|
+
get("#{customer_id}/BankingServices/DeleteCard/#{login_id}")
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
data/lib/flinks/api/refresh.rb
CHANGED
@@ -5,8 +5,8 @@ module Flinks
|
|
5
5
|
module Refresh
|
6
6
|
|
7
7
|
# @see https://sandbox-api.flinks.io/Readme/#scheduling-background-refresh
|
8
|
-
# @param
|
9
|
-
# @param
|
8
|
+
# @param [Boolean] activated
|
9
|
+
# @param [String] login_id
|
10
10
|
# @return [Hash]
|
11
11
|
def set_scheduled_refresh(activated, login_id:)
|
12
12
|
patch("#{customer_id}/BankingServices/SetScheduledRefresh", params: { login_id: login_id, is_activated: activated })
|
data/lib/flinks/api/statement.rb
CHANGED
@@ -14,7 +14,7 @@ module Flinks
|
|
14
14
|
end
|
15
15
|
|
16
16
|
# @see https://sandbox-api.flinks.io/Readme/#get-pdf-statements
|
17
|
-
# @param
|
17
|
+
# @param [Hash] options
|
18
18
|
# @return [Hash]
|
19
19
|
def statements(options: {})
|
20
20
|
validate_request!(StatementRequestSchema, options)
|
@@ -22,7 +22,7 @@ module Flinks
|
|
22
22
|
end
|
23
23
|
|
24
24
|
# @see https://sandbox-api.flinks.io/Readme/#get-pdf-statements
|
25
|
-
# @param
|
25
|
+
# @param [String] request_id
|
26
26
|
# @return [Hash]
|
27
27
|
def statements_async(request_id:)
|
28
28
|
get("#{customer_id}/BankingServices/GetStatementsAsync/#{request_id}")
|
data/lib/flinks/client.rb
CHANGED
@@ -34,7 +34,7 @@ module Flinks
|
|
34
34
|
|
35
35
|
# Builds an error message from a validation object
|
36
36
|
#
|
37
|
-
# @param
|
37
|
+
# @param [Dry::Validation::Result] validation
|
38
38
|
# @return [String]
|
39
39
|
def error_message(validation)
|
40
40
|
validation.messages(full: true).values.flatten.to_sentence
|
@@ -42,8 +42,8 @@ module Flinks
|
|
42
42
|
|
43
43
|
# Validates a request payload against a schema object
|
44
44
|
#
|
45
|
-
# @param
|
46
|
-
# @param
|
45
|
+
# @param [Class] schema
|
46
|
+
# @param [Hash] options
|
47
47
|
# @raise [ArgumentError]
|
48
48
|
def validate_request!(schema, options)
|
49
49
|
payload = schema.call(options)
|
data/lib/flinks/error.rb
CHANGED
@@ -4,7 +4,7 @@ module Flinks
|
|
4
4
|
class Error < StandardError
|
5
5
|
attr_reader :response, :code
|
6
6
|
|
7
|
-
# @param
|
7
|
+
# @param [HTTP::Response] response
|
8
8
|
# @return [Flinks::Error]
|
9
9
|
def self.from_response(response)
|
10
10
|
klass = case response.code
|
@@ -31,7 +31,7 @@ module Flinks
|
|
31
31
|
klass.new(response)
|
32
32
|
end
|
33
33
|
|
34
|
-
# @param
|
34
|
+
# @param [HTTP::Response] response
|
35
35
|
# @return [Flinks::Error]
|
36
36
|
def self.error_for_202(response)
|
37
37
|
if response.parse['FlinksCode'] == 'OPERATION_PENDING'
|
@@ -41,7 +41,7 @@ module Flinks
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
# @param
|
44
|
+
# @param [HTTP::Response] response
|
45
45
|
# @return [Flinks::Error]
|
46
46
|
def self.error_for_400(response)
|
47
47
|
if response.parse['FlinksCode'] == 'SESSION_NONEXISTENT'
|
@@ -51,7 +51,7 @@ module Flinks
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
-
# @param
|
54
|
+
# @param [HTTP::Response] response
|
55
55
|
# @return [Flinks::Error]
|
56
56
|
def self.error_for_403(response)
|
57
57
|
if response.parse['FlinksCode'] == 'TOO_MANY_REQUESTS'
|
@@ -61,7 +61,7 @@ module Flinks
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
-
# @param
|
64
|
+
# @param [HTTP::Response] response
|
65
65
|
# @return [Flinks::Error]
|
66
66
|
def initialize(response)
|
67
67
|
@response = response
|
data/lib/flinks/request.rb
CHANGED
@@ -10,26 +10,26 @@ module Flinks
|
|
10
10
|
|
11
11
|
# Performs a HTTP Get request
|
12
12
|
#
|
13
|
-
# @param
|
14
|
-
# @param
|
13
|
+
# @param [String] path
|
14
|
+
# @param [Hash] params
|
15
15
|
def get(path, params: {})
|
16
16
|
request(:get, path, params: params)
|
17
17
|
end
|
18
18
|
|
19
19
|
# Performs a HTTP Post request
|
20
20
|
#
|
21
|
-
# @param
|
22
|
-
# @param
|
23
|
-
# @param
|
21
|
+
# @param [String] path
|
22
|
+
# @param [Hash] params
|
23
|
+
# @param [Hash] body
|
24
24
|
def post(path, params: {}, body: {})
|
25
25
|
request(:post, path, params: params, body: body)
|
26
26
|
end
|
27
27
|
|
28
28
|
# Performs a HTTP Patch request
|
29
29
|
#
|
30
|
-
# @param
|
31
|
-
# @param
|
32
|
-
# @param
|
30
|
+
# @param [String] path
|
31
|
+
# @param [Hash] params
|
32
|
+
# @param [Hash] body
|
33
33
|
def patch(path, params: {}, body: {})
|
34
34
|
request(:patch, path, params: params, body: body)
|
35
35
|
end
|
@@ -74,7 +74,9 @@ module Flinks
|
|
74
74
|
data = response.parse
|
75
75
|
|
76
76
|
# Transform data
|
77
|
-
|
77
|
+
if raw
|
78
|
+
data
|
79
|
+
else
|
78
80
|
data.deep_transform_keys { |k| k.underscore }.with_indifferent_access
|
79
81
|
end
|
80
82
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flinks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Philippe Dionne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-07-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|