ibanity 1.1 → 1.1.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: c4c8a4922493c2c96b3fc29688986ea3bee83f57487e3bd1d76bce47cfacd29b
4
- data.tar.gz: 334a138123b6b2b3b99fa2137e1f14ba573a6cdf45302106b6606ffbd1e63cd1
3
+ metadata.gz: 58760dd2b572c44765101af4d96b7549a8af0403d161690c43e6ca61630f3903
4
+ data.tar.gz: 6d12cec2d46f49470c7e5a30d381bd4d1685e74d65407c1cfd47c059efeb7c25
5
5
  SHA512:
6
- metadata.gz: 927a526c9c065a5a7a2a8e7b3a4f00cc21ee82b0a634dafb58d4ec7368d900037e8098d40ff7f4175b93412389baee9180681be9c46392ba45a6a8716d5d63ce
7
- data.tar.gz: d87b8b3f5865b3999dbf4d57b7aa297f4f6d272ab2fe8bf176edb137823e17a9c9605b0f8cc566a06dce850f54a73bee6d0cd0876859d25cea5bf30d88ba3157
6
+ metadata.gz: fe4f9a8a9a267d188a6e8276d55d3775f4873007c04bd3e9974db9622b17192c9e03047bf35828932cf7c0d0ca33dd1fa97305d4b47ea0d1701e2c79cb8c9fc8
7
+ data.tar.gz: 481aa49242a63f94a2a4494bd4f645cbb891b129260bfe10b334585cd283e2cbdb0d7d8ea439495eb914ef43e0e88e84f127788544e84496705b7321bcd9da75
data/.travis.yml ADDED
@@ -0,0 +1,10 @@
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
data/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # Changelog
2
+
3
+ ## 1.1.1
4
+
5
+ ### Enhancements
6
+
7
+ * 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.
@@ -6,7 +6,7 @@ module Ibanity
6
6
  list_by_uri(uri: uri, query_params: query_params, customer_access_token: access_token)
7
7
  end
8
8
 
9
- def self.find(access_token:, id:)
9
+ def self.find(access_token: nil, id:)
10
10
  uri = Ibanity.ponto_connect_api_schema["financialInstitutions"].sub("{financialInstitutionId}", id)
11
11
  find_by_uri(uri: uri, customer_access_token: access_token)
12
12
  end
@@ -70,8 +70,9 @@ module Ibanity
70
70
  }
71
71
  raw_response = RestClient::Request.execute(query) do |response, request, result, &block|
72
72
  if response.code >= 400
73
+ ibanity_request_id = response.headers[:ibanity_request_id]
73
74
  body = JSON.parse(response.body)
74
- raise Ibanity::Error.new(body["errors"] || body), "Ibanity request failed."
75
+ raise Ibanity::Error.new(body["errors"] || body, ibanity_request_id), "Ibanity request failed."
75
76
  else
76
77
  response.return!(&block)
77
78
  end
data/lib/ibanity/error.rb CHANGED
@@ -2,13 +2,14 @@ module Ibanity
2
2
  class Error < StandardError
3
3
  attr_reader :errors
4
4
 
5
- def initialize(errors)
5
+ def initialize(errors, ibanity_request_id)
6
6
  @errors = errors
7
+ @ibanity_request_id = ibanity_request_id
7
8
  end
8
9
 
9
10
  def to_s
10
11
  if @errors.is_a?(Array) && @errors.size > 0
11
- @errors.map do |error|
12
+ formatted_errors = @errors.map do |error|
12
13
  if error["meta"] && error["meta"]["attribute"]
13
14
  "* #{error["code"]}: '#{error["meta"]["attribute"]}' #{error["detail"]}"
14
15
  elsif error["meta"] && error["meta"]["resource"]
@@ -16,9 +17,11 @@ module Ibanity
16
17
  else
17
18
  "* #{error["code"]}: #{error["detail"]}"
18
19
  end
19
- end.join("\n")
20
+ end
21
+ formatted_errors << "* ibanity_request_id: #{@ibanity_request_id}"
22
+ formatted_errors.join("\n")
20
23
  elsif @errors.is_a?(Hash)
21
- "* #{@errors["error"]}: #{@errors["error_description"]}"
24
+ "* #{@errors["error"]}: #{@errors["error_description"]}\n * Error hint: #{@errors["error_hint"]}\n * ibanity_request_id: #{@ibanity_request_id}"
22
25
  else
23
26
  super
24
27
  end
@@ -1,3 +1,3 @@
1
1
  module Ibanity
2
- VERSION = "1.1"
2
+ VERSION = "1.1.1"
3
3
  end
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.1'
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ibanity
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-18 00:00:00.000000000 Z
11
+ date: 2020-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -61,6 +61,8 @@ extra_rdoc_files: []
61
61
  files:
62
62
  - ".gitignore"
63
63
  - ".gitkeep"
64
+ - ".travis.yml"
65
+ - CHANGELOG.md
64
66
  - Gemfile
65
67
  - LICENSE.txt
66
68
  - README.md
@@ -125,7 +127,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
127
  - !ruby/object:Gem::Version
126
128
  version: '0'
127
129
  requirements: []
128
- rubygems_version: 3.0.3
130
+ rubyforge_project:
131
+ rubygems_version: 2.7.7
129
132
  signing_key:
130
133
  specification_version: 4
131
134
  summary: Ibanity Ruby Client