nordigen_ob_client 0.0.2 → 0.0.3

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