nordigen_ob_client 0.0.2 → 0.0.4
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/lib/nordigen_ob_client.rb +121 -59
- 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: 31402b13055928acda8e67cb92102f5c7537905bd3003efc7ca33519e0b1ff83
|
|
4
|
+
data.tar.gz: 3f8468216d6cb6947ae0f6730a380e41de7717b007cb64dc8706321e9dd87222
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8e2c1c19962e6a4d911106ff67b57db74b01ee7852a6934e7d33181c2602d31aad7072d016fe0beedbdd5e364e2acfa0d6ef424317f8f1ee4bb493dc3d4f46d9
|
|
7
|
+
data.tar.gz: 8b9e0564a28ac0be990f2823439ecd5c96a8cd32b71f74bed545ae90ff67f03074a41a6e3c82fff09759132e3ea912ec939bc95e39b32710fefa7b0f2a366d7c
|
data/lib/nordigen_ob_client.rb
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
require 'json'
|
|
2
|
-
require 'net/http'
|
|
3
2
|
require 'rest-client'
|
|
4
3
|
|
|
5
4
|
class NordigenOBClient
|
|
@@ -34,6 +33,13 @@ class NordigenOBClient
|
|
|
34
33
|
{content_type: :json, accept: :json})
|
|
35
34
|
response = JSON.parse(response_json.body)
|
|
36
35
|
@access_token = response["access"]
|
|
36
|
+
|
|
37
|
+
@request_header = {
|
|
38
|
+
content_type: :json,
|
|
39
|
+
accept: :json,
|
|
40
|
+
authorization: "Bearer #{@access_token}"
|
|
41
|
+
}
|
|
42
|
+
|
|
37
43
|
@access_token
|
|
38
44
|
end
|
|
39
45
|
|
|
@@ -52,15 +58,9 @@ class NordigenOBClient
|
|
|
52
58
|
#
|
|
53
59
|
#############################################################################
|
|
54
60
|
def get_banks_by_country country
|
|
55
|
-
request_header = {
|
|
56
|
-
content_type: :json,
|
|
57
|
-
accept: :json,
|
|
58
|
-
authorization: "Bearer #{@access_token}"
|
|
59
|
-
}
|
|
60
|
-
|
|
61
61
|
response = RestClient.get(
|
|
62
62
|
"https://ob.nordigen.com/api/v2/institutions/?country=#{country}",
|
|
63
|
-
headers
|
|
63
|
+
headers=@request_header)
|
|
64
64
|
|
|
65
65
|
available_banks = JSON.parse(response.body,
|
|
66
66
|
:external_encoding => 'iso-8859-1')
|
|
@@ -83,80 +83,144 @@ class NordigenOBClient
|
|
|
83
83
|
#
|
|
84
84
|
#############################################################################
|
|
85
85
|
def list_accounts requisition_id
|
|
86
|
-
request_header = {
|
|
87
|
-
content_type: :json,
|
|
88
|
-
accept: :json,
|
|
89
|
-
authorization: "Bearer #{@access_token}"
|
|
90
|
-
}
|
|
91
|
-
|
|
92
86
|
response = RestClient.get(
|
|
93
87
|
"https://ob.nordigen.com/api/v2/requisitions/#{requisition_id}",
|
|
94
|
-
headers
|
|
88
|
+
headers=@request_header)
|
|
95
89
|
accounts = JSON.parse(response.body)
|
|
96
90
|
accounts
|
|
97
91
|
end
|
|
98
92
|
|
|
93
|
+
#############################################################################
|
|
94
|
+
#
|
|
95
|
+
# => Name: get_account_details
|
|
96
|
+
#
|
|
97
|
+
# => Description: Return's all the information available for the account.
|
|
98
|
+
#
|
|
99
|
+
# => Parameters: account_id: The id of the account (IBAN)
|
|
100
|
+
# for which the information will be returned.
|
|
101
|
+
#
|
|
102
|
+
#
|
|
103
|
+
# => Returns: The details available for the account. They can vary from bank
|
|
104
|
+
# to bank. The fields we see been returned always are:
|
|
105
|
+
# - IBAN
|
|
106
|
+
# - Currency
|
|
107
|
+
# - Owner Name
|
|
108
|
+
# - Product / account type (e.g. Savings, holding, etc.)
|
|
109
|
+
# - BIC
|
|
110
|
+
# - Usage: Private / Bureau
|
|
111
|
+
#
|
|
112
|
+
#############################################################################
|
|
99
113
|
def get_account_details account_id
|
|
100
|
-
request_header = {
|
|
101
|
-
content_type: :json,
|
|
102
|
-
accept: :json,
|
|
103
|
-
authorization: "Bearer #{@access_token}"
|
|
104
|
-
}
|
|
105
|
-
|
|
106
114
|
response = RestClient.get(
|
|
107
115
|
"https://ob.nordigen.com/api/v2/accounts/#{account_id}/details",
|
|
108
|
-
headers
|
|
116
|
+
headers=@request_header)
|
|
109
117
|
accounts = JSON.parse(response.body)
|
|
110
118
|
accounts
|
|
111
119
|
end
|
|
112
120
|
|
|
113
121
|
|
|
122
|
+
#############################################################################
|
|
123
|
+
#
|
|
124
|
+
# => Name: get_account_balances
|
|
125
|
+
#
|
|
126
|
+
# => Description: Return's the balances for the given account. The balances
|
|
127
|
+
# can be more than one, since accounts allow overdraft or
|
|
128
|
+
# might have frozen limits.
|
|
129
|
+
#
|
|
130
|
+
# => Parameters: account_id: The id of the account (IBAN)
|
|
131
|
+
# for which the balances will be returned.
|
|
132
|
+
#
|
|
133
|
+
#
|
|
134
|
+
# => Returns: The details available for the account. They can vary from bank
|
|
135
|
+
# to bank. The fields we see been returned always are:
|
|
136
|
+
# - Balance amount
|
|
137
|
+
# - Currency
|
|
138
|
+
# - Type of balances
|
|
139
|
+
# - Balance date
|
|
140
|
+
#
|
|
141
|
+
#############################################################################
|
|
114
142
|
def get_account_balances account_id
|
|
115
|
-
request_header = {
|
|
116
|
-
content_type: :json,
|
|
117
|
-
accept: :json,
|
|
118
|
-
authorization: "Bearer #{@access_token}"
|
|
119
|
-
}
|
|
120
|
-
|
|
121
143
|
response = RestClient.get(
|
|
122
144
|
"https://ob.nordigen.com/api/v2/accounts/#{account_id}/balances",
|
|
123
|
-
headers
|
|
145
|
+
headers=@request_header)
|
|
124
146
|
accounts = JSON.parse(response.body)
|
|
125
147
|
accounts
|
|
126
148
|
end
|
|
127
149
|
|
|
128
150
|
|
|
151
|
+
#############################################################################
|
|
152
|
+
#
|
|
153
|
+
# => Name: get_account_overview
|
|
154
|
+
#
|
|
155
|
+
# => Description: Return's the basic information available for the account.
|
|
156
|
+
#
|
|
157
|
+
# => Parameters: account_id: The id of the account (IBAN)
|
|
158
|
+
# for which the information will be returned.
|
|
159
|
+
#
|
|
160
|
+
#
|
|
161
|
+
# => Returns: A summaru available for the account. THe fields included are:
|
|
162
|
+
# - IBAN
|
|
163
|
+
# - Nordigen's institution ID
|
|
164
|
+
# - Status: ready, inactive
|
|
165
|
+
# - Owner's name
|
|
166
|
+
#
|
|
167
|
+
#############################################################################
|
|
129
168
|
def get_account_overview account_id
|
|
130
|
-
request_header = {
|
|
131
|
-
content_type: :json,
|
|
132
|
-
accept: :json,
|
|
133
|
-
authorization: "Bearer #{@access_token}"
|
|
134
|
-
}
|
|
135
|
-
|
|
136
169
|
response = RestClient.get(
|
|
137
170
|
"https://ob.nordigen.com/api/v2/accounts/#{account_id}",
|
|
138
|
-
headers
|
|
171
|
+
headers=@request_header)
|
|
139
172
|
accounts = JSON.parse(response.body)
|
|
140
173
|
accounts
|
|
141
174
|
end
|
|
142
175
|
|
|
143
176
|
|
|
177
|
+
#############################################################################
|
|
178
|
+
#
|
|
179
|
+
# => Name: get_account_transactions
|
|
180
|
+
#
|
|
181
|
+
# => Description: Return's the account statement for the last 90 days.
|
|
182
|
+
#
|
|
183
|
+
# => Parameters: account_id: The id of the account (IBAN)
|
|
184
|
+
# for which the information will be returned.
|
|
185
|
+
#
|
|
186
|
+
#
|
|
187
|
+
# => Returns: The list of transactions performed. THe fields included are:
|
|
188
|
+
# - Booking date, when the transaction was logged on the account.
|
|
189
|
+
# - Reference date, when it actually occured.
|
|
190
|
+
# - Transaction amount
|
|
191
|
+
# - Currency
|
|
192
|
+
# - Debitor BIC
|
|
193
|
+
# - Creditor BIC
|
|
194
|
+
#
|
|
195
|
+
#############################################################################
|
|
144
196
|
def get_account_transactions account_id
|
|
145
|
-
request_header = {
|
|
146
|
-
content_type: :json,
|
|
147
|
-
accept: :json,
|
|
148
|
-
authorization: "Bearer #{@access_token}"
|
|
149
|
-
}
|
|
150
|
-
|
|
151
197
|
response = RestClient.get(
|
|
152
198
|
"https://ob.nordigen.com/api/v2/accounts/#{account_id}/transactions",
|
|
153
|
-
headers
|
|
199
|
+
headers=@request_header)
|
|
154
200
|
accounts = JSON.parse(response.body)
|
|
155
201
|
accounts
|
|
156
202
|
end
|
|
157
203
|
|
|
158
204
|
|
|
159
|
-
|
|
205
|
+
#############################################################################
|
|
206
|
+
#
|
|
207
|
+
# => Name: create_requisition
|
|
208
|
+
#
|
|
209
|
+
# => Description: It creates a new requisition ID that will enable the user
|
|
210
|
+
# to connect his bank accounts.
|
|
211
|
+
#
|
|
212
|
+
# => Parameters: redirect_url: The URL to which the user will be redirected
|
|
213
|
+
# after logging in to his bank environment.
|
|
214
|
+
#
|
|
215
|
+
# selected_bank_id: The Nordigen ID of the bank the user
|
|
216
|
+
# will be redirected.
|
|
217
|
+
#
|
|
218
|
+
# reference: A unique user identifier that will associate
|
|
219
|
+
# the user who will log in with the new requisition ID.
|
|
220
|
+
#
|
|
221
|
+
# => Returns: The access token
|
|
222
|
+
#
|
|
223
|
+
#############################################################################
|
|
160
224
|
def create_requisition redirect_url, selected_bank_id, reference
|
|
161
225
|
request_body = {
|
|
162
226
|
"redirect" => redirect_url,
|
|
@@ -165,31 +229,29 @@ class NordigenOBClient
|
|
|
165
229
|
"reference" => reference
|
|
166
230
|
}.to_json
|
|
167
231
|
|
|
168
|
-
request_header = {
|
|
169
|
-
content_type: :json,
|
|
170
|
-
accept: :json,
|
|
171
|
-
authorization: "Bearer #{@access_token}"
|
|
172
|
-
}
|
|
173
|
-
|
|
174
232
|
response = RestClient.post(
|
|
175
233
|
"https://ob.nordigen.com/api/v2/requisitions/",
|
|
176
234
|
request_body,
|
|
177
|
-
headers
|
|
235
|
+
headers=@request_header)
|
|
178
236
|
JSON.parse(response.body)
|
|
179
237
|
end
|
|
180
238
|
|
|
181
239
|
|
|
240
|
+
#############################################################################
|
|
241
|
+
#
|
|
242
|
+
# => Name: delete_requisition
|
|
243
|
+
#
|
|
244
|
+
# => Description: It deletes the provided requisition ID.
|
|
245
|
+
#
|
|
246
|
+
# => Parameters: requisition_id: The requisition to delete.
|
|
247
|
+
#
|
|
248
|
+
# => Returns: The result of the operation
|
|
249
|
+
#
|
|
250
|
+
#############################################################################
|
|
182
251
|
def delete_requisition requisition_id
|
|
183
|
-
request_header = {
|
|
184
|
-
content_type: :json,
|
|
185
|
-
accept: :json,
|
|
186
|
-
authorization: "Bearer #{@access_token}"
|
|
187
|
-
}
|
|
188
|
-
|
|
189
252
|
response = RestClient.delete(
|
|
190
253
|
"https://ob.nordigen.com/api/v2/requisitions/#{requisition_id}",
|
|
191
|
-
|
|
192
|
-
headers=request_header)
|
|
254
|
+
headers=@request_header)
|
|
193
255
|
JSON.parse(response.body)
|
|
194
256
|
response
|
|
195
257
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: nordigen_ob_client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Angelos Kapsimanis
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2022-
|
|
11
|
+
date: 2022-12-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: A Ruby client for Nordigen's Open Banking v2.0 API. Look at https://nordigen.com/en/account_information_documenation/api-documention/overview/
|
|
14
14
|
for more details.
|