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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aa8065de1ae3aa281d75f0021aec499e7ee218e3e768a54f2571011073f76d9d
4
- data.tar.gz: 9a4a6f26d77652b6ac0e242cb84b24ab01f5089a9d1dae9b7317934b9aecb344
3
+ metadata.gz: 6ee6ebd2cbd53ca2dbd1dee24eae4635a8c59659eb9dd582a74ea653476fc92b
4
+ data.tar.gz: 63806bba355815bc2268fba35da890892aeafcbb1433495b277e720aeb3cf722
5
5
  SHA512:
6
- metadata.gz: 1f7a148260094d9c89f828ae8adde9dcb7205fea54828aeb8e00b708aeed30238def5f9fc0661c6a205f1e959c1d29771738c57582e2bea2bbba5e67920a2921
7
- data.tar.gz: 315670b263e80f5d665e50e1cc9aee5a3d4153977555093d0d2264b1c4a145cbeea81ac1bdb3f70195111e2904df6b9b3bfdaf82b6912b4ea51be9e77c04d7a2
6
+ metadata.gz: 0111304b1914f53af9e8a309e61d7bcff6e1f5df88610f9862d684fbf1ae2e41eb49cd39735b890d26aa36508f90d63a59ddf0f7ef883545142b30968b8a0472
7
+ data.tar.gz: 3eb8e02713788b62695c9fb2484c75e174b4b8ef3262fd726dff6f641d9d0417e587a7967fb237aa0ab7e18b6bed90745673f948fc72a65a42668afb5dc195ee
data/.rubocop.yml CHANGED
@@ -1,4 +1,4 @@
1
- require:
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
- RSpec/FilePath:
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
@@ -1,5 +1,5 @@
1
1
  FROM hausgold/ruby:2.7
2
- MAINTAINER Hermann Mayer <hermann.mayer@hausgold.de>
2
+ LABEL org.opencontainers.image.authors="containers@hausgold.de"
3
3
 
4
4
  # Update system gem
5
5
  RUN gem update --system '3.4.22'
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', '~> 1.28'
17
- gem 'rubocop-rails', '~> 2.14'
18
- gem 'rubocop-rspec', '~> 2.10'
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'
@@ -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", "~> 1.28"
13
- gem "rubocop-rails", "~> 2.14"
14
- gem "rubocop-rspec", "~> 2.10"
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"
@@ -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", "~> 1.28"
13
- gem "rubocop-rails", "~> 2.14"
14
- gem "rubocop-rspec", "~> 2.10"
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"
@@ -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
- body = original_exception.response&.body
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.
@@ -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(
@@ -3,7 +3,7 @@
3
3
  # The gem version details.
4
4
  module Billomat
5
5
  # The version of the +billomat+ gem
6
- VERSION = '1.5.0'
6
+ VERSION = '1.5.1'
7
7
 
8
8
  class << self
9
9
  # Returns the version of gem as a string.
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.0
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-01-30 00:00:00.000000000 Z
12
+ date: 2025-05-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport