billomat 1.5.0 → 1.5.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 +4 -4
- data/.rubocop.yml +2 -2
- data/CHANGELOG.md +6 -0
- data/Dockerfile +1 -1
- data/Gemfile +3 -3
- data/gemfiles/rails_6.1.gemfile +3 -3
- data/gemfiles/rails_7.1.gemfile +3 -3
- data/lib/billomat/gateway.rb +16 -2
- data/lib/billomat/models/base.rb +2 -2
- data/lib/billomat/version.rb +1 -1
- 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: 6ee6ebd2cbd53ca2dbd1dee24eae4635a8c59659eb9dd582a74ea653476fc92b
|
4
|
+
data.tar.gz: 63806bba355815bc2268fba35da890892aeafcbb1433495b277e720aeb3cf722
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0111304b1914f53af9e8a309e61d7bcff6e1f5df88610f9862d684fbf1ae2e41eb49cd39735b890d26aa36508f90d63a59ddf0f7ef883545142b30968b8a0472
|
7
|
+
data.tar.gz: 3eb8e02713788b62695c9fb2484c75e174b4b8ef3262fd726dff6f641d9d0417e587a7967fb237aa0ab7e18b6bed90745673f948fc72a65a42668afb5dc195ee
|
data/.rubocop.yml
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
plugins:
|
2
2
|
- rubocop-rspec
|
3
3
|
- rubocop-rails
|
4
4
|
|
@@ -54,7 +54,7 @@ RSpec/NestedGroups:
|
|
54
54
|
Max: 4
|
55
55
|
|
56
56
|
# Disable regular Rails spec paths.
|
57
|
-
|
57
|
+
Rails/FilePath:
|
58
58
|
Enabled: false
|
59
59
|
|
60
60
|
# Because we just implemented the ActiveRecord API.
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
* TODO: Replace this bullet point with an actual description of a change.
|
4
4
|
|
5
|
+
### 1.5.1 (9 May 2025)
|
6
|
+
|
7
|
+
* Corrected some RuboCop glitches ([#30](https://github.com/hausgold/billomat/pull/30))
|
8
|
+
* Upgraded the rubocop dependencies ([#31](https://github.com/hausgold/billomat/pull/31))
|
9
|
+
* Gracefully deal with non-JSON gateway error bodies ([#32](https://github.com/hausgold/billomat/pull/32))
|
10
|
+
|
5
11
|
### 1.5.0 (30 January 2025)
|
6
12
|
|
7
13
|
* Added all versions up to Ruby 3.4 to the CI matrix ([#29](https://github.com/hausgold/billomat/pull/29))
|
data/Dockerfile
CHANGED
data/Gemfile
CHANGED
@@ -13,9 +13,9 @@ gem 'guard-rspec', '~> 4.7'
|
|
13
13
|
gem 'irb', '~> 1.2'
|
14
14
|
gem 'rake', '~> 13.0'
|
15
15
|
gem 'rspec', '~> 3.12'
|
16
|
-
gem 'rubocop'
|
17
|
-
gem 'rubocop-rails'
|
18
|
-
gem 'rubocop-rspec'
|
16
|
+
gem 'rubocop'
|
17
|
+
gem 'rubocop-rails'
|
18
|
+
gem 'rubocop-rspec'
|
19
19
|
gem 'simplecov', '>= 0.22'
|
20
20
|
gem 'yard', '>= 0.9.28'
|
21
21
|
gem 'yard-activesupport-concern', '>= 0.0.1'
|
data/gemfiles/rails_6.1.gemfile
CHANGED
@@ -9,9 +9,9 @@ gem "guard-rspec", "~> 4.7"
|
|
9
9
|
gem "irb", "~> 1.2"
|
10
10
|
gem "rake", "~> 13.0"
|
11
11
|
gem "rspec", "~> 3.12"
|
12
|
-
gem "rubocop"
|
13
|
-
gem "rubocop-rails"
|
14
|
-
gem "rubocop-rspec"
|
12
|
+
gem "rubocop"
|
13
|
+
gem "rubocop-rails"
|
14
|
+
gem "rubocop-rspec"
|
15
15
|
gem "simplecov", ">= 0.22"
|
16
16
|
gem "yard", ">= 0.9.28"
|
17
17
|
gem "yard-activesupport-concern", ">= 0.0.1"
|
data/gemfiles/rails_7.1.gemfile
CHANGED
@@ -9,9 +9,9 @@ gem "guard-rspec", "~> 4.7"
|
|
9
9
|
gem "irb", "~> 1.2"
|
10
10
|
gem "rake", "~> 13.0"
|
11
11
|
gem "rspec", "~> 3.12"
|
12
|
-
gem "rubocop"
|
13
|
-
gem "rubocop-rails"
|
14
|
-
gem "rubocop-rspec"
|
12
|
+
gem "rubocop"
|
13
|
+
gem "rubocop-rails"
|
14
|
+
gem "rubocop-rspec"
|
15
15
|
gem "simplecov", ">= 0.22"
|
16
16
|
gem "yard", ">= 0.9.28"
|
17
17
|
gem "yard-activesupport-concern", ">= 0.0.1"
|
data/lib/billomat/gateway.rb
CHANGED
@@ -11,8 +11,7 @@ module Billomat
|
|
11
11
|
def initialize(original_exception)
|
12
12
|
# Extract the error from the response if it is present. If no error
|
13
13
|
# could be extracted, use the whole body
|
14
|
-
|
15
|
-
response_error = JSON.parse(body).dig('errors', 'error') || body if body
|
14
|
+
response_error = unpack_error_message(original_exception)
|
16
15
|
|
17
16
|
# Use the default message and append our detailed error
|
18
17
|
message = original_exception.default_message
|
@@ -21,6 +20,21 @@ module Billomat
|
|
21
20
|
super(message)
|
22
21
|
@original_exception = original_exception
|
23
22
|
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
# Extract an error message from the response. If json, parse and extract.
|
27
|
+
# Otherwise, extract the first 128 bytes from the body; it's probably
|
28
|
+
# generic error HTML generated by a LoadBalancer
|
29
|
+
#
|
30
|
+
# @param original_exception [RestClient::Exception] the original exception
|
31
|
+
# @return [String, nil] the extracted error message
|
32
|
+
def unpack_error_message(original_exception)
|
33
|
+
body = original_exception.response&.body
|
34
|
+
JSON.parse(body).dig('errors', 'error') || body if body
|
35
|
+
rescue JSON::ParserError
|
36
|
+
body[0, 127] # probably HTML, thus only take the first few bytes
|
37
|
+
end
|
24
38
|
end
|
25
39
|
|
26
40
|
# This class can be used by the gem to communicate with the API.
|
data/lib/billomat/models/base.rb
CHANGED
@@ -31,7 +31,7 @@ module Billomat
|
|
31
31
|
# @param data [Hash] the attributes of the object
|
32
32
|
# @return [Billomat::Models::Base] the record as an object
|
33
33
|
#
|
34
|
-
# rubocop:disable Style/OpenStructUse because of the convenient
|
34
|
+
# rubocop:disable Style/OpenStructUse -- because of the convenient
|
35
35
|
# dynamic data access
|
36
36
|
def initialize(data = {})
|
37
37
|
@data = OpenStruct.new(data)
|
@@ -51,7 +51,7 @@ module Billomat
|
|
51
51
|
|
52
52
|
# @return [TrueClass]
|
53
53
|
#
|
54
|
-
# rubocop:disable Style/OpenStructUse because of the convenient
|
54
|
+
# rubocop:disable Style/OpenStructUse -- because of the convenient
|
55
55
|
# dynamic data access
|
56
56
|
def create
|
57
57
|
resp = Billomat::Gateway.new(
|
data/lib/billomat/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: billomat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hermann Mayer
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2025-
|
12
|
+
date: 2025-05-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|