billomat 1.4.1 → 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/.github/workflows/test.yml +1 -1
- data/.rubocop.yml +2 -2
- data/CHANGELOG.md +29 -19
- 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 +3 -3
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/.github/workflows/test.yml
CHANGED
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,17 +2,27 @@
|
|
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
|
+
|
11
|
+
### 1.5.0 (30 January 2025)
|
12
|
+
|
13
|
+
* Added all versions up to Ruby 3.4 to the CI matrix ([#29](https://github.com/hausgold/billomat/pull/29))
|
14
|
+
|
5
15
|
### 1.4.1 (17 January 2025)
|
6
16
|
|
7
|
-
* Added the logger dependency (#28)
|
17
|
+
* Added the logger dependency ([#28](https://github.com/hausgold/billomat/pull/28))
|
8
18
|
|
9
19
|
### 1.4.0 (11 January 2025)
|
10
20
|
|
11
|
-
* Switched to Zeitwerk as autoloader (#27)
|
21
|
+
* Switched to Zeitwerk as autoloader ([#27](https://github.com/hausgold/billomat/pull/27))
|
12
22
|
|
13
23
|
### 1.3.0 (3 January 2025)
|
14
24
|
|
15
|
-
* Raised minimum supported Ruby/Rails version to 2.7/6.1 (#26)
|
25
|
+
* Raised minimum supported Ruby/Rails version to 2.7/6.1 ([#26](https://github.com/hausgold/billomat/pull/26))
|
16
26
|
|
17
27
|
### 1.2.5 (15 August 2024)
|
18
28
|
|
@@ -32,14 +42,14 @@
|
|
32
42
|
|
33
43
|
### 1.2.1 (9 August 2024)
|
34
44
|
|
35
|
-
* Added API docs building to continuous integration (#25)
|
45
|
+
* Added API docs building to continuous integration ([#25](https://github.com/hausgold/billomat/pull/25))
|
36
46
|
|
37
47
|
### 1.2.0 (8 July 2024)
|
38
48
|
|
39
|
-
* Moved the development dependencies from the gemspec to the Gemfile (#19)
|
40
|
-
* Introduce `after_response` callback (#22)
|
41
|
-
* Fix response parsing for responses exceeding the page size (#23)
|
42
|
-
* Dropped support for Ruby <2.7 (#24)
|
49
|
+
* Moved the development dependencies from the gemspec to the Gemfile ([#19](https://github.com/hausgold/billomat/pull/19))
|
50
|
+
* Introduce `after_response` callback ([#22](https://github.com/hausgold/billomat/pull/22))
|
51
|
+
* Fix response parsing for responses exceeding the page size ([#23](https://github.com/hausgold/billomat/pull/23))
|
52
|
+
* Dropped support for Ruby <2.7 ([#24](https://github.com/hausgold/billomat/pull/24))
|
43
53
|
|
44
54
|
### 1.1.0 (24 February 2023)
|
45
55
|
|
@@ -47,24 +57,24 @@
|
|
47
57
|
|
48
58
|
### 1.0.0 (18 January 2023)
|
49
59
|
|
50
|
-
* Bundler >= 2.3 is from now on required as minimal version (#18)
|
51
|
-
* Dropped support for Ruby < 2.5 (#18)
|
52
|
-
* Dropped support for Rails < 5.2 (#18)
|
60
|
+
* Bundler >= 2.3 is from now on required as minimal version ([#18](https://github.com/hausgold/billomat/pull/18))
|
61
|
+
* Dropped support for Ruby < 2.5 ([#18](https://github.com/hausgold/billomat/pull/18))
|
62
|
+
* Dropped support for Rails < 5.2 ([#18](https://github.com/hausgold/billomat/pull/18))
|
53
63
|
* Updated all development/runtime gems to their latest
|
54
|
-
Ruby 2.5 compatible version (#18)
|
64
|
+
Ruby 2.5 compatible version ([#18](https://github.com/hausgold/billomat/pull/18))
|
55
65
|
|
56
66
|
### 0.4.1 (27 June 2022)
|
57
67
|
|
58
|
-
* Added `InvoiceComment` models (#17)
|
68
|
+
* Added `InvoiceComment` models ([#17](https://github.com/hausgold/billomat/pull/17))
|
59
69
|
|
60
70
|
### 0.3.0 (11 October 2021)
|
61
71
|
|
62
72
|
* Improve error handling (breaking change, as we are now raising
|
63
73
|
`Billomat::GatewayError`s rather than just the client's
|
64
|
-
`RestClient::Exception`) (#15)
|
74
|
+
`RestClient::Exception`) ([#15](https://github.com/hausgold/billomat/pull/15))
|
65
75
|
* Added bang variants to API methods
|
66
|
-
(`Billomat::Models::Base#{save!,create!,update!,delete!}`) (#16)
|
67
|
-
* Added `CreditNote` and `CreditNoteItem` models (#14)
|
76
|
+
(`Billomat::Models::Base#{save!,create!,update!,delete!}`) ([#16](https://github.com/hausgold/billomat/pull/16))
|
77
|
+
* Added `CreditNote` and `CreditNoteItem` models ([#14](https://github.com/hausgold/billomat/pull/14))
|
68
78
|
* Moved to GitHub Actions
|
69
79
|
* Migrated to our own coverage reporting
|
70
80
|
|
@@ -73,14 +83,14 @@
|
|
73
83
|
* Add codeclimate test runner
|
74
84
|
* Update codeclimate reporter id
|
75
85
|
* Switched to SVG project teasers
|
76
|
-
* Updated Travis CI and Code Climate configs (#11)
|
86
|
+
* Updated Travis CI and Code Climate configs ([#11](https://github.com/hausgold/billomat/pull/11))
|
77
87
|
* Changed travis-ci.org to travis-ci.com links
|
78
|
-
* Adds templates and tags to models (#13)
|
88
|
+
* Adds templates and tags to models ([#13](https://github.com/hausgold/billomat/pull/13))
|
79
89
|
|
80
90
|
### 0.1.6 (16 May 2018)
|
81
91
|
|
82
92
|
* Support registered apps
|
83
|
-
* Added `app_id` and `app_secret` to configuration (#9)
|
93
|
+
* Added `app_id` and `app_secret` to configuration ([#9](https://github.com/hausgold/billomat/pull/9))
|
84
94
|
|
85
95
|
### 0.1.5 (14 November 2017)
|
86
96
|
|
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.
|
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
|
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
135
|
- !ruby/object:Gem::Version
|
136
136
|
version: '0'
|
137
137
|
requirements: []
|
138
|
-
rubygems_version: 3.
|
138
|
+
rubygems_version: 3.4.22
|
139
139
|
signing_key:
|
140
140
|
specification_version: 4
|
141
141
|
summary: Wrapper for the Billomat API
|