ibanity 0.5 → 1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rspec +1 -0
- data/.travis.yml +20 -0
- data/CHANGELOG.md +20 -0
- data/README.md +2 -0
- data/ibanity.gemspec +1 -2
- data/lib/ibanity.rb +68 -14
- data/lib/ibanity/api/base_resource.rb +45 -15
- data/lib/ibanity/api/consent/consent.rb +41 -0
- data/lib/ibanity/api/consent/processing_operation.rb +37 -0
- data/lib/ibanity/api/isabel_connect/access_token.rb +17 -0
- data/lib/ibanity/api/isabel_connect/account.rb +15 -0
- data/lib/ibanity/api/isabel_connect/account_report.rb +15 -0
- data/lib/ibanity/api/isabel_connect/balance.rb +11 -0
- data/lib/ibanity/api/isabel_connect/bulk_payment_initiation_request.rb +25 -0
- data/lib/ibanity/api/isabel_connect/intraday_transaction.rb +10 -0
- data/lib/ibanity/api/isabel_connect/refresh_token.rb +29 -0
- data/lib/ibanity/api/isabel_connect/transaction.rb +10 -0
- data/lib/ibanity/api/o_auth_resource.rb +19 -0
- data/lib/ibanity/api/ponto_connect/account.rb +15 -0
- data/lib/ibanity/api/ponto_connect/financial_institution.rb +15 -0
- data/lib/ibanity/api/ponto_connect/payment.rb +20 -0
- data/lib/ibanity/api/ponto_connect/sandbox/financial_institution_account.rb +21 -0
- data/lib/ibanity/api/ponto_connect/sandbox/financial_institution_transaction.rb +31 -0
- data/lib/ibanity/api/ponto_connect/synchronization.rb +15 -0
- data/lib/ibanity/api/ponto_connect/token.rb +53 -0
- data/lib/ibanity/api/ponto_connect/transaction.rb +15 -0
- data/lib/ibanity/api/ponto_connect/usage.rb +10 -0
- data/lib/ibanity/api/ponto_connect/user_info.rb +10 -0
- data/lib/ibanity/api/sandbox/financial_institution_account.rb +41 -0
- data/lib/ibanity/api/sandbox/financial_institution_holding.rb +45 -0
- data/lib/ibanity/api/sandbox/financial_institution_transaction.rb +45 -0
- data/lib/ibanity/api/sandbox/financial_institution_user.rb +32 -0
- data/lib/ibanity/api/xs2a/account.rb +33 -0
- data/lib/ibanity/api/xs2a/account_information_access_request.rb +27 -0
- data/lib/ibanity/api/xs2a/account_information_access_request_authorization.rb +21 -0
- data/lib/ibanity/api/xs2a/bulk_payment_initiation_request.rb +33 -0
- data/lib/ibanity/api/xs2a/customer.rb +10 -0
- data/lib/ibanity/api/xs2a/customer_access_token.rb +11 -0
- data/lib/ibanity/api/xs2a/financial_institution.rb +36 -0
- data/lib/ibanity/api/xs2a/holding.rb +21 -0
- data/lib/ibanity/api/xs2a/payment_initiation_request.rb +33 -0
- data/lib/ibanity/api/xs2a/payment_initiation_request_authorization.rb +21 -0
- data/lib/ibanity/api/xs2a/periodic_payment_initiation_request.rb +33 -0
- data/lib/ibanity/api/xs2a/synchronization.rb +17 -0
- data/lib/ibanity/api/xs2a/transaction.rb +21 -0
- data/lib/ibanity/client.rb +41 -30
- data/lib/ibanity/collection.rb +47 -0
- data/lib/ibanity/error.rb +9 -5
- data/lib/ibanity/http_signature.rb +4 -2
- data/lib/ibanity/util.rb +11 -4
- data/lib/ibanity/version.rb +1 -1
- data/spec/lib/ibanity/util_spec.rb +89 -0
- data/spec/spec_helper.rb +100 -0
- metadata +52 -30
- data/lib/ibanity/api/account.rb +0 -20
- data/lib/ibanity/api/account_information_access_request.rb +0 -17
- data/lib/ibanity/api/customer_access_token.rb +0 -9
- data/lib/ibanity/api/financial_institution.rb +0 -30
- data/lib/ibanity/api/financial_institution_account.rb +0 -39
- data/lib/ibanity/api/financial_institution_transaction.rb +0 -43
- data/lib/ibanity/api/financial_institution_user.rb +0 -30
- data/lib/ibanity/api/payment_initiation_request.rb +0 -24
- data/lib/ibanity/api/transaction.rb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d5ea78c3f968ec1967918962504dbd661add9787361dbabe58dcd0ffb2525e72
|
4
|
+
data.tar.gz: 1a65cf3247ce21a9ebd0582d4d17f5de0ada33dbaa2be9926d6328e6d8273e04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7c580727c8395a69625b2b6da2d881e968ff605d1f6d411897f7e2648e9f6b7c1af8b9c28cfaa10aaeedbe157e65c9ed4bb603ea0b80dc0fba717412919ff79
|
7
|
+
data.tar.gz: f0835e512b9ad4e546fe51e280df9038be9af32adf9f96cd166095a891e03741756a32e4a60dbea869adb5feef189904b806a47303f743d435d7ceeca35666bd
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--require spec_helper
|
data/.travis.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
language: ruby
|
2
|
+
script: bundle exec rspec
|
3
|
+
deploy:
|
4
|
+
provider: rubygems
|
5
|
+
api_key:
|
6
|
+
secure: pfXgGXH/AZEG3HMiaJPmJ7fck6Z3Hj0y7TU5TwvLAtKuBy6hlLT67ne/VfeBZQKa9d7eerr9PFP1hvLjZppScZMMOTtjBTvwpchkcUDwCxHx5GzS/jRnBF+uYHIza2p4Wq8yIPug7UrZ0qyq5VOG45R/nC/fPm2Ht2T7heqF5VgRaDGrN7Fq3zXn7duiYhTy02nDXorZ/kEAjnwdwDtXWyVFq8wr4inTExYrDP9/M57qx5TrkgWmcQ7JrvO2KfLDMJqAxI8lNoaPl5dAi7q1XWqqSVay7h9OAnP4UfvnvAc106lG6nHfTQig1krTfxRAvtHlPQjSlFkL+0qfBPBz1C/ex221O3NsNBYmI/mJ45lcNhqJbnkV2VEAEgUoe4ZFfKUUczLfnVxIPjoQmHMwLwfEO4g8/Hz/I3L7bvebgfzGGMDpmN6ERZRJmhutE6K5cL80ghoLs6ExJLoqHi1qvdBSkM2IyE4Yo+lob/hKU1IBL1w13T2h3EHapBh3kKn+jBzu/y5nXTEteBHbMP8j2zxFiihVBJEKPXhg/iU8WHLI6HZgWJkOc9ZH3hS7CN3VELK7fVZp9jaPAKaKihdvxQ0z3gCPFL+E6rYKsBPYqXE6qDsSQswhqTN15W0eVQqK8fDXkZmW0lSGvi2IJvL0CjIaahfB2GaapTtqOwar7sc=
|
7
|
+
on:
|
8
|
+
tags: true
|
9
|
+
gem: ibanity
|
10
|
+
skip_cleanup: true
|
11
|
+
notifications:
|
12
|
+
email: false
|
13
|
+
slack:
|
14
|
+
- rooms:
|
15
|
+
- secure: J06CK+muuVTW1SS1GmhSw7ZVo0vEMFpNWU5B9Cz94h5BZI3rPSxZFSCQG8OTQ/lBIrzPTlQj5JGzYgHpS5QRHGa4s1A1tYrZUfjUUgaZ7SIfoY8AgHH6cKF+jtwYy2z+kOJekBtfNLqfzAx+48QrxdbmBnXTG+r7UXczw0TAB7BMKh8107q7kqgjKiAnpGlXzC6rLWUwdRF/1qvDtYFCjoZ0OpYMnUUK+0/bgwVHxjYRl64DrPD3jC2XoaCTRCMyLbfqb9ZUXKVf27ByAQ/Ikj+qODdSH10vwPARXlbbVhpPfjAax42zC1OwSABdE00iJW1+TuoI69znjWg1d8Ti97raihV98OXMyqHXPKxX/gZp+0MSuYIE9GQWY791ulmQ+GwwkgB6v2LmXGCE8K+eUCc3zkGJWVUzBP+Wu49mDzDAQHBPl/G3u26RqmVQzWhk9ckHQ30cyIPFjz/eaMrda+wgQ6AKzfNq+XVL6hAO+Se28PRPhDu33ZzIKqgpk0dH77LcKPI/Uf1dCT+0oa+pvVx1T0Z93SNp0azh71rx9AOWBMZm7TcOYvMOw9QpVBZkoWy4NQo9PMT0Jo73qAnOTHadr8b5zeDoAu7jnlhCxIpmnrmIh4Dz6n6XF+c+d+C/MAQVQ0rKj7KzTYEsYat0NQ62lgBtHy5/Qmu736MaIVA=
|
16
|
+
if: (tag =~ ^v) AND (branch = master)
|
17
|
+
- rooms:
|
18
|
+
- secure: J06CK+muuVTW1SS1GmhSw7ZVo0vEMFpNWU5B9Cz94h5BZI3rPSxZFSCQG8OTQ/lBIrzPTlQj5JGzYgHpS5QRHGa4s1A1tYrZUfjUUgaZ7SIfoY8AgHH6cKF+jtwYy2z+kOJekBtfNLqfzAx+48QrxdbmBnXTG+r7UXczw0TAB7BMKh8107q7kqgjKiAnpGlXzC6rLWUwdRF/1qvDtYFCjoZ0OpYMnUUK+0/bgwVHxjYRl64DrPD3jC2XoaCTRCMyLbfqb9ZUXKVf27ByAQ/Ikj+qODdSH10vwPARXlbbVhpPfjAax42zC1OwSABdE00iJW1+TuoI69znjWg1d8Ti97raihV98OXMyqHXPKxX/gZp+0MSuYIE9GQWY791ulmQ+GwwkgB6v2LmXGCE8K+eUCc3zkGJWVUzBP+Wu49mDzDAQHBPl/G3u26RqmVQzWhk9ckHQ30cyIPFjz/eaMrda+wgQ6AKzfNq+XVL6hAO+Se28PRPhDu33ZzIKqgpk0dH77LcKPI/Uf1dCT+0oa+pvVx1T0Z93SNp0azh71rx9AOWBMZm7TcOYvMOw9QpVBZkoWy4NQo9PMT0Jo73qAnOTHadr8b5zeDoAu7jnlhCxIpmnrmIh4Dz6n6XF+c+d+C/MAQVQ0rKj7KzTYEsYat0NQ62lgBtHy5/Qmu736MaIVA=
|
19
|
+
on_success: change
|
20
|
+
on_failure: always
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## 1.3
|
4
|
+
|
5
|
+
### Enhancements
|
6
|
+
|
7
|
+
* [Ponto Connect] Add support for the /userinfo and /organizations/{id}/usage endpoints.
|
8
|
+
|
9
|
+
## 1.2
|
10
|
+
|
11
|
+
### Enhancements
|
12
|
+
|
13
|
+
* Add support for periodic and bulk payments
|
14
|
+
* Add snake-case transformation for deeply nested data structures
|
15
|
+
|
16
|
+
## 1.1.1
|
17
|
+
|
18
|
+
### Enhancements
|
19
|
+
|
20
|
+
* Improve debugging by logging the `ibanity_request_id` header from the response in case of error
|
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/ibanity/ibanity-ruby.svg?branch=master)](https://travis-ci.org/ibanity/ibanity-ruby)
|
2
|
+
|
1
3
|
# Ibanity Ruby Library
|
2
4
|
|
3
5
|
The Ibanity Ruby Library provides convenient wrappers around the Ibanity API. The object attributes are dynamically defined based on the API response, supporting minor API changes seamlessly.
|
data/ibanity.gemspec
CHANGED
@@ -19,6 +19,5 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_dependency "rest-client", ">= 1.8.0"
|
22
|
-
spec.add_development_dependency "rspec", "3.
|
23
|
-
spec.add_development_dependency "webmock", "1.24.2"
|
22
|
+
spec.add_development_dependency "rspec", "3.9.0"
|
24
23
|
end
|
data/lib/ibanity.rb
CHANGED
@@ -7,18 +7,48 @@ require "securerandom"
|
|
7
7
|
|
8
8
|
require_relative "ibanity/util"
|
9
9
|
require_relative "ibanity/error"
|
10
|
+
require_relative "ibanity/collection"
|
10
11
|
require_relative "ibanity/client"
|
11
12
|
require_relative "ibanity/http_signature"
|
12
13
|
require_relative "ibanity/api/base_resource"
|
13
|
-
require_relative "ibanity/api/account"
|
14
|
-
require_relative "ibanity/api/transaction"
|
15
|
-
require_relative "ibanity/api/
|
16
|
-
require_relative "ibanity/api/
|
17
|
-
require_relative "ibanity/api/
|
18
|
-
require_relative "ibanity/api/
|
19
|
-
require_relative "ibanity/api/
|
20
|
-
require_relative "ibanity/api/customer_access_token"
|
21
|
-
require_relative "ibanity/api/
|
14
|
+
require_relative "ibanity/api/xs2a/account"
|
15
|
+
require_relative "ibanity/api/xs2a/transaction"
|
16
|
+
require_relative "ibanity/api/xs2a/holding"
|
17
|
+
require_relative "ibanity/api/xs2a/financial_institution"
|
18
|
+
require_relative "ibanity/api/xs2a/account_information_access_request"
|
19
|
+
require_relative "ibanity/api/xs2a/account_information_access_request_authorization"
|
20
|
+
require_relative "ibanity/api/xs2a/payment_initiation_request_authorization"
|
21
|
+
require_relative "ibanity/api/xs2a/customer_access_token"
|
22
|
+
require_relative "ibanity/api/xs2a/customer"
|
23
|
+
require_relative "ibanity/api/xs2a/payment_initiation_request"
|
24
|
+
require_relative "ibanity/api/xs2a/bulk_payment_initiation_request"
|
25
|
+
require_relative "ibanity/api/xs2a/periodic_payment_initiation_request"
|
26
|
+
require_relative "ibanity/api/xs2a/synchronization"
|
27
|
+
require_relative "ibanity/api/o_auth_resource"
|
28
|
+
require_relative "ibanity/api/isabel_connect/account"
|
29
|
+
require_relative "ibanity/api/isabel_connect/balance"
|
30
|
+
require_relative "ibanity/api/isabel_connect/transaction"
|
31
|
+
require_relative "ibanity/api/isabel_connect/intraday_transaction"
|
32
|
+
require_relative "ibanity/api/isabel_connect/account_report"
|
33
|
+
require_relative "ibanity/api/isabel_connect/access_token"
|
34
|
+
require_relative "ibanity/api/isabel_connect/refresh_token"
|
35
|
+
require_relative "ibanity/api/isabel_connect/bulk_payment_initiation_request"
|
36
|
+
require_relative "ibanity/api/sandbox/financial_institution_account"
|
37
|
+
require_relative "ibanity/api/sandbox/financial_institution_transaction"
|
38
|
+
require_relative "ibanity/api/sandbox/financial_institution_holding"
|
39
|
+
require_relative "ibanity/api/sandbox/financial_institution_user"
|
40
|
+
require_relative "ibanity/api/ponto_connect/token"
|
41
|
+
require_relative "ibanity/api/ponto_connect/financial_institution"
|
42
|
+
require_relative "ibanity/api/ponto_connect/account"
|
43
|
+
require_relative "ibanity/api/ponto_connect/transaction"
|
44
|
+
require_relative "ibanity/api/ponto_connect/synchronization"
|
45
|
+
require_relative "ibanity/api/consent/consent"
|
46
|
+
require_relative "ibanity/api/consent/processing_operation"
|
47
|
+
require_relative "ibanity/api/ponto_connect/payment"
|
48
|
+
require_relative "ibanity/api/ponto_connect/user_info"
|
49
|
+
require_relative "ibanity/api/ponto_connect/usage"
|
50
|
+
require_relative "ibanity/api/ponto_connect/sandbox/financial_institution_account"
|
51
|
+
require_relative "ibanity/api/ponto_connect/sandbox/financial_institution_transaction"
|
22
52
|
|
23
53
|
module Ibanity
|
24
54
|
class << self
|
@@ -28,9 +58,13 @@ module Ibanity
|
|
28
58
|
end
|
29
59
|
|
30
60
|
def configure
|
31
|
-
@client
|
32
|
-
@
|
33
|
-
@
|
61
|
+
@client = nil
|
62
|
+
@xs2a_api_schema = nil
|
63
|
+
@isabel_connect_api_schema = nil
|
64
|
+
@consent_api_schema = nil
|
65
|
+
@ponto_connect_api_schema = nil
|
66
|
+
@sandbox_api_schema = nil
|
67
|
+
@configuration = nil
|
34
68
|
yield configuration
|
35
69
|
end
|
36
70
|
|
@@ -43,6 +77,10 @@ module Ibanity
|
|
43
77
|
:signature_certificate_id,
|
44
78
|
:signature_key,
|
45
79
|
:signature_key_passphrase,
|
80
|
+
:isabel_connect_client_id,
|
81
|
+
:isabel_connect_client_secret,
|
82
|
+
:ponto_connect_client_id,
|
83
|
+
:ponto_connect_client_secret,
|
46
84
|
:api_scheme,
|
47
85
|
:api_host,
|
48
86
|
:api_port,
|
@@ -50,8 +88,24 @@ module Ibanity
|
|
50
88
|
).new
|
51
89
|
end
|
52
90
|
|
53
|
-
def
|
54
|
-
@
|
91
|
+
def xs2a_api_schema
|
92
|
+
@xs2a_api_schema ||= client.get(uri: "#{client.base_uri}/xs2a")["links"]
|
93
|
+
end
|
94
|
+
|
95
|
+
def sandbox_api_schema
|
96
|
+
@sandbox_api_schema ||= client.get(uri: "#{client.base_uri}/sandbox")["links"]
|
97
|
+
end
|
98
|
+
|
99
|
+
def isabel_connect_api_schema
|
100
|
+
@isabel_connect_api_schema ||= client.get(uri: "#{client.base_uri}/isabel-connect")["links"]
|
101
|
+
end
|
102
|
+
|
103
|
+
def ponto_connect_api_schema
|
104
|
+
@ponto_connect_api_schema ||= client.get(uri: "#{client.base_uri}/ponto-connect")["links"]
|
105
|
+
end
|
106
|
+
|
107
|
+
def consent_api_schema
|
108
|
+
@consent_api_schema ||= client.get(uri: "#{client.base_uri}/consent")["links"]
|
55
109
|
end
|
56
110
|
|
57
111
|
def respond_to_missing?(method_name, include_private = false)
|
@@ -1,29 +1,38 @@
|
|
1
1
|
module Ibanity
|
2
2
|
class BaseResource < OpenStruct
|
3
|
-
def self.create_by_uri(uri:, resource_type:, attributes:, customer_access_token: nil, idempotency_key: nil)
|
3
|
+
def self.create_by_uri(uri:, resource_type:, attributes:, customer_access_token: nil, idempotency_key: nil, meta: nil)
|
4
4
|
payload = {
|
5
5
|
data: {
|
6
6
|
type: resource_type,
|
7
7
|
attributes: attributes
|
8
8
|
}
|
9
9
|
}
|
10
|
+
payload[:data][:meta] = meta if meta
|
10
11
|
raw_item = Ibanity.client.post(uri: uri, payload: payload, customer_access_token: customer_access_token, idempotency_key: idempotency_key)
|
11
12
|
new(raw_item["data"], customer_access_token)
|
12
13
|
end
|
13
14
|
|
14
|
-
def self.list_by_uri(uri:, query_params: {}, customer_access_token: nil)
|
15
|
-
|
16
|
-
|
15
|
+
def self.list_by_uri(uri:, query_params: {}, customer_access_token: nil, headers: nil)
|
16
|
+
raw_response = Ibanity.client.get(uri: uri, query_params: query_params, headers: headers, customer_access_token: customer_access_token)
|
17
|
+
items = raw_response["data"].map do |raw_item|
|
17
18
|
new(raw_item, customer_access_token)
|
18
19
|
end
|
20
|
+
Ibanity::Collection.new(
|
21
|
+
klass: self,
|
22
|
+
items: items,
|
23
|
+
links: raw_response["links"],
|
24
|
+
paging: raw_response.dig("meta", "paging"),
|
25
|
+
synchronized_at: raw_response.dig("meta", "synchronizedAt"),
|
26
|
+
latest_synchronization: raw_response.dig("meta", "latestSynchronization"),
|
27
|
+
)
|
19
28
|
end
|
20
29
|
|
21
|
-
def self.find_by_uri(uri:, customer_access_token: nil)
|
22
|
-
new(find_raw_by_uri(uri: uri, customer_access_token: customer_access_token), customer_access_token)
|
30
|
+
def self.find_by_uri(uri:, customer_access_token: nil, headers: nil)
|
31
|
+
new(find_raw_by_uri(uri: uri, customer_access_token: customer_access_token, headers: headers), customer_access_token)
|
23
32
|
end
|
24
33
|
|
25
|
-
def self.find_raw_by_uri(uri:, customer_access_token: nil)
|
26
|
-
raw_item = Ibanity.client.get(uri: uri, customer_access_token: customer_access_token)
|
34
|
+
def self.find_raw_by_uri(uri:, customer_access_token: nil, headers: nil)
|
35
|
+
raw_item = Ibanity.client.get(uri: uri, customer_access_token: customer_access_token, headers: headers)
|
27
36
|
raw_item["data"]
|
28
37
|
end
|
29
38
|
|
@@ -43,6 +52,15 @@ module Ibanity
|
|
43
52
|
new(raw_item["data"])
|
44
53
|
end
|
45
54
|
|
55
|
+
def self.find_file_by_uri(uri:, customer_access_token: nil, headers: nil)
|
56
|
+
Ibanity.client.get(uri: uri, customer_access_token: customer_access_token, headers: headers)
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.create_file_by_uri(uri:, resource_type:, raw_content:, customer_access_token: nil, idempotency_key: nil, headers: nil)
|
60
|
+
raw_item = Ibanity.client.post(uri: uri, payload: raw_content, customer_access_token: customer_access_token, idempotency_key: idempotency_key, json: false, headers: headers)
|
61
|
+
new(raw_item["data"], customer_access_token)
|
62
|
+
end
|
63
|
+
|
46
64
|
def initialize(raw, customer_access_token = nil)
|
47
65
|
attributes = prepare_attributes(raw)
|
48
66
|
super(attributes)
|
@@ -52,6 +70,8 @@ module Ibanity
|
|
52
70
|
|
53
71
|
links = raw["links"] || {}
|
54
72
|
setup_links(links)
|
73
|
+
|
74
|
+
meta = raw["meta"] || {}
|
55
75
|
end
|
56
76
|
|
57
77
|
def reload!
|
@@ -72,25 +92,25 @@ module Ibanity
|
|
72
92
|
attributes = raw["attributes"] || {}
|
73
93
|
meta = raw["meta"] || {}
|
74
94
|
params = base.merge(attributes).merge(meta)
|
75
|
-
Ibanity::Util.
|
95
|
+
Ibanity::Util.underscorize(params)
|
76
96
|
end
|
77
97
|
|
78
98
|
def setup_relationships(relationships, customer_access_token = nil)
|
79
99
|
relationships.each do |key, relationship|
|
80
100
|
if relationship["data"]
|
81
|
-
klass =
|
101
|
+
klass = relationship_klass(key)
|
82
102
|
method_name = Ibanity::Util.underscore(key)
|
83
|
-
define_singleton_method(method_name) do
|
84
|
-
klass.find_by_uri(uri: relationship["links"]["related"], customer_access_token: customer_access_token)
|
103
|
+
define_singleton_method(method_name) do |headers: nil|
|
104
|
+
klass.find_by_uri(uri: relationship["links"]["related"], headers: headers, customer_access_token: customer_access_token)
|
85
105
|
end
|
86
106
|
self[Ibanity::Util.underscore("#{key}_id")] = relationship["data"]["id"]
|
87
107
|
else
|
88
108
|
singular_key = key[0..-2]
|
89
|
-
klass =
|
109
|
+
klass = relationship_klass(singular_key)
|
90
110
|
method_name = Ibanity::Util.underscore(key)
|
91
|
-
define_singleton_method(method_name) do
|
111
|
+
define_singleton_method(method_name) do |headers: nil, **query_params|
|
92
112
|
uri = relationship["links"]["related"]
|
93
|
-
klass.list_by_uri(uri: uri, customer_access_token: customer_access_token)
|
113
|
+
klass.list_by_uri(uri: uri, headers: headers, query_params: query_params, customer_access_token: customer_access_token)
|
94
114
|
end
|
95
115
|
end
|
96
116
|
end
|
@@ -101,5 +121,15 @@ module Ibanity
|
|
101
121
|
self[Ibanity::Util.underscore("#{key}_link")] = link
|
102
122
|
end
|
103
123
|
end
|
124
|
+
|
125
|
+
def relationship_klass(name)
|
126
|
+
camelized_name = Ibanity::Util.camelize(name)
|
127
|
+
enclosing_module = if camelized_name == "FinancialInstitution"
|
128
|
+
Ibanity::Xs2a
|
129
|
+
else
|
130
|
+
Object.const_get(self.class.to_s.split("::")[0...-1].join("::"))
|
131
|
+
end
|
132
|
+
enclosing_module.const_get(camelized_name)
|
133
|
+
end
|
104
134
|
end
|
105
135
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Ibanity
|
2
|
+
module Consent
|
3
|
+
class Consent < Ibanity::BaseResource
|
4
|
+
def self.create(idempotency_key: nil, **attributes)
|
5
|
+
path = Ibanity.consent_api_schema["consents"].gsub("{consentId}", "")
|
6
|
+
uri = Ibanity.client.build_uri(path)
|
7
|
+
create_by_uri(uri: uri, resource_type: "consent", attributes: attributes, idempotency_key: idempotency_key)
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.list(**query_params)
|
11
|
+
path = Ibanity.consent_api_schema["consents"].gsub("{consentId}", "")
|
12
|
+
uri = Ibanity.client.build_uri(path)
|
13
|
+
list_by_uri(uri: uri, query_params: query_params)
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.find(id:)
|
17
|
+
path = Ibanity.consent_api_schema["consents"].gsub("{consentId}", id)
|
18
|
+
uri = Ibanity.client.build_uri(path)
|
19
|
+
find_by_uri(uri: uri)
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.validate(id:, idempotency_key: nil)
|
23
|
+
path = Ibanity.consent_api_schema["consent"]["validations"].gsub("{consentId}", id)
|
24
|
+
uri = Ibanity.client.build_uri(path)
|
25
|
+
create_by_uri(uri: uri, resource_type: "consent", attributes: [], idempotency_key: idempotency_key)
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.revoke(id:, idempotency_key: nil)
|
29
|
+
path = Ibanity.consent_api_schema["consent"]["revocations"].gsub("{consentId}", id)
|
30
|
+
uri = Ibanity.client.build_uri(path)
|
31
|
+
create_by_uri(uri: uri, resource_type: "consent", attributes: [], idempotency_key: idempotency_key)
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.delete(id:)
|
35
|
+
path = Ibanity.consent_api_schema["consents"].gsub("{consentId}", id)
|
36
|
+
uri = Ibanity.client.build_uri(path)
|
37
|
+
destroy_by_uri(uri: uri)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Ibanity
|
2
|
+
module Consent
|
3
|
+
class ProcessingOperation < Ibanity::BaseResource
|
4
|
+
def self.create(consent_id:, idempotency_key: nil, **attributes)
|
5
|
+
path = Ibanity.consent_api_schema["consent"]["processingOperations"]
|
6
|
+
.gsub("{consentId}", consent_id)
|
7
|
+
.gsub("{processingOperationId}", "")
|
8
|
+
uri = Ibanity.client.build_uri(path)
|
9
|
+
create_by_uri(uri: uri, resource_type: "processingOperation", attributes: attributes, idempotency_key: idempotency_key)
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.list(consent_id:, **query_params)
|
13
|
+
path = Ibanity.consent_api_schema["consent"]["processingOperations"]
|
14
|
+
.gsub("{consentId}", consent_id)
|
15
|
+
.gsub("{processingOperationId}", "")
|
16
|
+
uri = Ibanity.client.build_uri(path)
|
17
|
+
list_by_uri(uri: uri, query_params: query_params)
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.find(id:, consent_id:)
|
21
|
+
path = Ibanity.sandbox_api_schema["consent"]["processingOperations"]
|
22
|
+
.gsub("{consentId}", consent_id)
|
23
|
+
.gsub("{processingOperationId}", id)
|
24
|
+
uri = Ibanity.client.build_uri(path)
|
25
|
+
find_by_uri(uri: uri)
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.revoke(id:, consent_id:, idempotency_key: nil)
|
29
|
+
path = Ibanity.consent_api_schema["consent"]["processingOperation"]["revocations"]
|
30
|
+
.gsub("{consentId}", consent_id)
|
31
|
+
.gsub("{processingOperationId}", id)
|
32
|
+
uri = Ibanity.client.build_uri(path)
|
33
|
+
create_by_uri(uri: uri, resource_type: "processingOperation", attributes: [], idempotency_key: idempotency_key)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Ibanity
|
2
|
+
module IsabelConnect
|
3
|
+
class AccessToken < Ibanity::OAuthResource
|
4
|
+
def self.create(refresh_token:, idempotency_key: nil)
|
5
|
+
uri = Ibanity.isabel_connect_api_schema["oAuth2"]["accessTokens"]
|
6
|
+
arguments = [
|
7
|
+
["grant_type", "refresh_token"],
|
8
|
+
["refresh_token", refresh_token],
|
9
|
+
["client_id", Ibanity.client.isabel_connect_client_id],
|
10
|
+
["client_secret", Ibanity.client.isabel_connect_client_secret]
|
11
|
+
]
|
12
|
+
payload = URI.encode_www_form(arguments)
|
13
|
+
create_by_uri(uri: uri, payload: payload, idempotency_key: idempotency_key)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Ibanity
|
2
|
+
module IsabelConnect
|
3
|
+
class Account < Ibanity::BaseResource
|
4
|
+
def self.list(access_token:, headers: nil, **query_params)
|
5
|
+
uri = Ibanity.isabel_connect_api_schema["accounts"].sub("{accountId}", "")
|
6
|
+
list_by_uri(uri: uri, query_params: query_params, customer_access_token: access_token, headers: headers)
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.find(id:, access_token:, headers: nil)
|
10
|
+
uri = Ibanity.isabel_connect_api_schema["accounts"].sub("{accountId}", id)
|
11
|
+
find_by_uri(uri: uri, customer_access_token: access_token, headers: headers)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Ibanity
|
2
|
+
module IsabelConnect
|
3
|
+
class AccountReport < Ibanity::BaseResource
|
4
|
+
def self.list(access_token:, headers: nil, **query_params)
|
5
|
+
uri = Ibanity.isabel_connect_api_schema["accountReports"].sub("{accountReportId}", "")
|
6
|
+
list_by_uri(uri: uri, query_params: query_params, customer_access_token: access_token, headers: headers)
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.find(id:, access_token:)
|
10
|
+
uri = Ibanity.isabel_connect_api_schema["accountReports"].sub("{accountReportId}", id)
|
11
|
+
find_file_by_uri(uri: uri, customer_access_token: access_token, headers: { accept: "text/plain" })
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Ibanity
|
2
|
+
module IsabelConnect
|
3
|
+
class Balance < Ibanity::BaseResource
|
4
|
+
def self.list(account_id:, access_token:, headers: nil, **query_params)
|
5
|
+
Ibanity.isabel_connect_api_schema["accounts"]["balances"]
|
6
|
+
uri = Ibanity.isabel_connect_api_schema["account"]["balances"].sub("{accountId}", account_id)
|
7
|
+
list_by_uri(uri: uri, query_params: query_params, customer_access_token: access_token, headers: headers)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|