ibanity 1.10.0 → 2.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 55b04259d7e3e1f8cd8ee53b23d5b50fd4803d0a15822870b59b2e3bd78820a2
4
- data.tar.gz: 79003b1d051b9e517ea786dab240b19dca82bfcbf8379784eacccdd15a7e8481
3
+ metadata.gz: fc779e16b7658943269fa2f63e2682dc34ab7050bf2751dcdcfd10200b30b206
4
+ data.tar.gz: 92a9a49ddb5afddca15232d9e49690beaa209aba8c1c5957013bcf39a9a06f0b
5
5
  SHA512:
6
- metadata.gz: f11e1268e728697e6f75cdc0eb7a79358d8359ee4eada54ddf7e452ef7147b9f0c548724047a5d99454ca785840ab5e72c0b16448b587789d27f3b6ced89a47e
7
- data.tar.gz: 96132c499b4e33ed9681f6998d1f7923e260d715078777a503dfd13c98a4979fcf03854fa96f217d3527a0e248cec994710fdfe74b3816afc92302d91ab60316
6
+ metadata.gz: b64cd808868849afae6727dc0c6f2717840da42b875d8d033efacf46fdff5124792e5828fd4a9b7e9d5bd3979ecce12e5d93dd12df62282625db704466d2f4f0
7
+ data.tar.gz: 91267c064ce5bc62b438c422a258cc7c18186c3a035867b2734a756365bf6a65abd9ef2f4648815bc1e53b5c2c7ddd44b9bec06786ce83c029906c730df7af77
data/CHANGELOG.md CHANGED
@@ -1,8 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.0.1
4
+
5
+ * [Ponto Connect] Fix UpdatedTransactions relationship parsing for synchronization
6
+ * [XS2A] Fix initialAccountTransactionsSynchronizations relationship parsing for accountInformationAccessRequest
7
+
8
+ ## 2.0
9
+
10
+ * [Isabel Connect] Upgrade to version 2 of the API.
11
+
12
+ ## 1.11
13
+
14
+ * Allow to tweak RestClient's timeout.
15
+
3
16
  ## 1.10
4
17
 
5
- * [Ponto Connect] Add support for payment activation requests
18
+ * [Ponto Connect] Add support for payment activation requests.
6
19
 
7
20
  * [Webhooks] Add support for webhook signature validation, keys endpoint, and events.
8
21
 
data/README.md CHANGED
@@ -4,6 +4,17 @@
4
4
 
5
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.
6
6
 
7
+ Supported API version per product:
8
+
9
+ Product | Version
10
+ -- | --
11
+ XS2A | 1
12
+ Ponto Connect | 1
13
+ Isabel Connect | 2
14
+ Consent | 1
15
+
16
+ In case you need to connect to an older version of an API, please consult `CHANGELOG.md` for more info on which version of the gem supports which version of the API.
17
+
7
18
  ## Documentation
8
19
 
9
20
  Visit our [Ruby API docs](https://documentation.ibanity.com/api/ruby).
@@ -130,8 +130,8 @@ module Ibanity
130
130
  resource = relationship.dig("links", "meta", "type")
131
131
  klass = relationship_klass(resource)
132
132
  method_name = Ibanity::Util.underscore(key)
133
- define_singleton_method(method_name) do |headers: nil|
134
- klass.list_by_uri(uri: url, headers: headers, customer_access_token: customer_access_token)
133
+ define_singleton_method(method_name) do |headers: nil, **query_params|
134
+ klass.list_by_uri(uri: url, headers: headers, query_params: query_params, customer_access_token: customer_access_token)
135
135
  end
136
136
  else
137
137
  resource = key
@@ -7,32 +7,39 @@ module Ibanity
7
7
  if refresh_token
8
8
  [
9
9
  ["grant_type", "refresh_token"],
10
- ["refresh_token", refresh_token],
11
- ["client_id", Ibanity.client.isabel_connect_client_id],
12
- ["client_secret", Ibanity.client.isabel_connect_client_secret]
10
+ ["refresh_token", refresh_token]
13
11
  ]
14
12
  elsif authorization_code
15
13
  [
16
14
  ["grant_type", "authorization_code"],
17
15
  ["code", authorization_code],
18
- ["client_id", Ibanity.client.isabel_connect_client_id],
19
- ["client_secret", Ibanity.client.isabel_connect_client_secret],
20
16
  ["redirect_uri", redirect_uri]
21
17
  ]
22
18
  end
23
- payload = URI.encode_www_form(arguments)
24
- create_by_uri(uri: uri, payload: payload, idempotency_key: idempotency_key)
19
+ create_by_uri(
20
+ uri: uri,
21
+ payload: URI.encode_www_form(arguments),
22
+ idempotency_key: idempotency_key,
23
+ headers: self.headers
24
+ )
25
25
  end
26
26
 
27
- def self.delete(token:)
27
+ def self.delete(refresh_token:)
28
28
  uri = Ibanity.isabel_connect_api_schema["oAuth2"]["revoke"]
29
29
  arguments = [
30
- ["token", token],
31
- ["client_id", Ibanity.client.isabel_connect_client_id],
32
- ["client_secret", Ibanity.client.isabel_connect_client_secret]
30
+ ["token", refresh_token]
33
31
  ]
34
32
  payload = URI.encode_www_form(arguments)
35
- create_by_uri(uri: uri, payload: payload)
33
+ create_by_uri(uri: uri, payload: payload, headers: self.headers)
34
+ end
35
+
36
+ private
37
+
38
+ def self.headers
39
+ {
40
+ "Authorization": "Basic " + Base64.strict_encode64("#{Ibanity.client.isabel_connect_client_id}:#{Ibanity.client.isabel_connect_client_secret}"),
41
+ "Content-Type": "application/x-www-form-urlencoded"
42
+ }
36
43
  end
37
44
  end
38
45
  end
@@ -1,8 +1,15 @@
1
1
  module Ibanity
2
2
  module PontoConnect
3
3
  class Transaction < Ibanity::BaseResource
4
- def self.list(access_token:, account_id:, **query_params)
5
- uri = Ibanity.ponto_connect_api_schema["account"]["transactions"].sub("{accountId}", account_id).sub("{transactionId}", "")
4
+ def self.list(access_token:, account_id: nil, synchronization_id: nil, **query_params)
5
+ uri = if synchronization_id
6
+ Ibanity.ponto_connect_api_schema["synchronization"]["updatedTransactions"]
7
+ .sub("{synchronizationId}", synchronization_id)
8
+ else
9
+ Ibanity.ponto_connect_api_schema["account"]["transactions"]
10
+ .sub("{accountId}", account_id)
11
+ .sub("{transactionId}", "")
12
+ end
6
13
  list_by_uri(uri: uri, query_params: query_params, customer_access_token: access_token)
7
14
  end
8
15
 
@@ -1,6 +1,13 @@
1
1
  module Ibanity
2
2
  module Xs2a
3
3
  class Synchronization < Ibanity::BaseResource
4
+ def self.list(financial_institution_id:, account_information_access_request_id:, customer_access_token:, headers: nil, **query_params)
5
+ uri = Ibanity.xs2a_api_schema["customer"]["financialInstitution"]["accountInformationAccessRequest"]["initialAccountTransactionsSynchronizations"]
6
+ .sub("{financialInstitutionId}", financial_institution_id)
7
+ .sub("{accountInformationAccessRequestId}", account_information_access_request_id)
8
+ list_by_uri(uri: uri, query_params: query_params, customer_access_token: customer_access_token, headers: headers)
9
+ end
10
+
4
11
  def self.create(customer_access_token:, **attributes)
5
12
  uri = Ibanity.xs2a_api_schema["customer"]["synchronizations"]
6
13
  .sub("{synchronizationId}", "")
@@ -14,12 +14,14 @@ module Ibanity
14
14
  api_scheme: "https",
15
15
  api_host: "api.ibanity.com",
16
16
  ssl_ca_file: nil,
17
- isabel_connect_client_id: "valid_client_id",
18
- isabel_connect_client_secret: "valid_client_secret",
17
+ isabel_connect_client_id: nil,
18
+ isabel_connect_client_secret: nil,
19
19
  ponto_connect_client_id: nil,
20
20
  ponto_connect_client_secret: nil,
21
21
  application_id: nil,
22
- debug_http_requests: false)
22
+ debug_http_requests: false,
23
+ timeout: 60
24
+ )
23
25
  @isabel_connect_client_id = isabel_connect_client_id
24
26
  @isabel_connect_client_secret = isabel_connect_client_secret
25
27
  @ponto_connect_client_id = ponto_connect_client_id
@@ -35,6 +37,7 @@ module Ibanity
35
37
  @base_uri = "#{api_scheme}://#{api_host}"
36
38
  @ssl_ca_file = ssl_ca_file
37
39
  @application_id = application_id
40
+ @timeout = timeout
38
41
  end
39
42
 
40
43
  def get(uri:, query_params: {}, customer_access_token: nil, headers: nil, json: true)
@@ -94,7 +97,8 @@ module Ibanity
94
97
  payload: payload,
95
98
  ssl_client_cert: @certificate,
96
99
  ssl_client_key: @key,
97
- ssl_ca_file: @ssl_ca_file
100
+ ssl_ca_file: @ssl_ca_file,
101
+ timeout: @timeout
98
102
  }
99
103
 
100
104
  log("HTTP Request", query) if @http_debug
@@ -120,7 +124,7 @@ module Ibanity
120
124
 
121
125
  def build_headers(customer_access_token: nil, idempotency_key: nil, extra_headers: nil, json:, payload: nil)
122
126
  headers = {
123
- accept: :json,
127
+ accept: :json
124
128
  }
125
129
  headers["Transfer-Encoding"] = "chunked" if payload.is_a?(Pathname)
126
130
  headers[:content_type] = :json if json
@@ -1,3 +1,3 @@
1
1
  module Ibanity
2
- VERSION = "1.10.0"
2
+ VERSION = "2.0.1"
3
3
  end
data/lib/ibanity.rb CHANGED
@@ -99,7 +99,8 @@ module Ibanity
99
99
  :api_host,
100
100
  :ssl_ca_file,
101
101
  :application_id,
102
- :debug_http_requests
102
+ :debug_http_requests,
103
+ :timeout
103
104
  ).new
104
105
  end
105
106
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ibanity
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ibanity
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-03 00:00:00.000000000 Z
11
+ date: 2022-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client