billomat 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2d9fef7b349e89c146999e6725312eabdf22fd8e75a22ca8f388329d1297f2f9
4
- data.tar.gz: 3205b27c8a21272b9bb46cb4991a9460d36ef7a12832ae4ebaa83890ca7a83e9
3
+ metadata.gz: db8e1e9679da101e6935b9e7d39eb71b690cee55361fc044adaeea8f258035fd
4
+ data.tar.gz: c6b5715bfb71b6ba5195316fe159c943fc933c3c18f9beeb98dda8f61d365ded
5
5
  SHA512:
6
- metadata.gz: 88c96ee5c03eacfe8fce57523cac662771469aa716fd60ebb47686143ed20e3a4df30f912d84847b7c235d9b06db75a4ea6eff877f4a8e40f515205b7392d570
7
- data.tar.gz: f86c7a69e61f131a2bc778309226c2e9ef9e364853cee4c9369d53e73e5e220dd3060ac583c91e6ae0b1101ef84311de0d7e7e0b0c819a2ae2662c04199c12b2
6
+ metadata.gz: c3da6248dd1adea3abc0343694576f10ad31af6e3aba3f5bcf99473bc9ff08e00bdd33bf025cd1ef63a96b27fe581e4e042abc88ad31f6ac144f03b1cf4c5b2c
7
+ data.tar.gz: b7c8e90c897d16409c1ff61606c7f2d41fb8dd8ec439eaaade92641bb9d7956c059b41a39a7474868da08ff89d1bc2db8ad931377ebcab12dd1926df0741a887
@@ -12,19 +12,20 @@ jobs:
12
12
  runs-on: ubuntu-22.04
13
13
  timeout-minutes: 5
14
14
  steps:
15
- - uses: actions/checkout@v3
15
+ - uses: actions/checkout@v4
16
16
 
17
17
  - name: Install the correct Ruby version
18
18
  uses: ruby/setup-ruby@v1
19
19
  with:
20
- ruby-version: 2.5
20
+ ruby-version: 2.7
21
21
  bundler-cache: true
22
- rubygems: '3.3.26'
22
+ rubygems: '3.4.22'
23
23
 
24
24
  - name: Prepare the virtual environment
25
25
  uses: hausgold/actions/ci@master
26
26
  with:
27
27
  clone_token: '${{ secrets.CLONE_TOKEN }}'
28
+ settings_secret_key: '${{ secrets.SETTINGS_SECRET_KEY }}'
28
29
  settings: '${{ github.repository }}'
29
30
  target: ci/gem-test
30
31
 
@@ -18,19 +18,20 @@ jobs:
18
18
  runs-on: ubuntu-22.04
19
19
  timeout-minutes: 5
20
20
  steps:
21
- - uses: actions/checkout@v3
21
+ - uses: actions/checkout@v4
22
22
 
23
- - name: Install Ruby 2.5
23
+ - name: Install Ruby 2.7
24
24
  uses: ruby/setup-ruby@v1
25
25
  with:
26
- ruby-version: 2.5
26
+ ruby-version: 2.7
27
27
  bundler-cache: true
28
- rubygems: '3.3.26'
28
+ rubygems: '3.4.22'
29
29
 
30
30
  - name: Prepare the virtual environment
31
31
  uses: hausgold/actions/ci@master
32
32
  with:
33
33
  clone_token: '${{ secrets.CLONE_TOKEN }}'
34
+ settings_secret_key: '${{ secrets.SETTINGS_SECRET_KEY }}'
34
35
  settings: '${{ github.repository }}'
35
36
  target: ci/gem-test
36
37
 
@@ -18,21 +18,22 @@ jobs:
18
18
  strategy:
19
19
  fail-fast: false
20
20
  matrix:
21
- ruby: ['2.5', '2.7']
21
+ ruby: ['2.7']
22
22
  steps:
23
- - uses: actions/checkout@v3
23
+ - uses: actions/checkout@v4
24
24
 
25
25
  - name: Install the correct Ruby version
26
26
  uses: ruby/setup-ruby@v1
27
27
  with:
28
28
  ruby-version: ${{ matrix.ruby }}
29
29
  bundler-cache: true
30
- rubygems: '3.3.26'
30
+ rubygems: '3.4.22'
31
31
 
32
32
  - name: Prepare the virtual environment
33
33
  uses: hausgold/actions/ci@master
34
34
  with:
35
35
  clone_token: '${{ secrets.CLONE_TOKEN }}'
36
+ settings_secret_key: '${{ secrets.SETTINGS_SECRET_KEY }}'
36
37
  settings: '${{ github.repository }}'
37
38
  target: ci/gem-test
38
39
 
@@ -53,6 +54,7 @@ jobs:
53
54
  uses: hausgold/actions/ci@master
54
55
  with:
55
56
  clone_token: '${{ secrets.CLONE_TOKEN }}'
57
+ settings_secret_key: '${{ secrets.SETTINGS_SECRET_KEY }}'
56
58
  settings: '${{ github.repository }}'
57
59
  target: ci/noop
58
60
 
data/.gitignore CHANGED
@@ -7,6 +7,7 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ /log/
10
11
  /vendor/
11
12
  /gemfiles/vendor/
12
13
  /Gemfile.lock
data/.rubocop.yml CHANGED
@@ -12,7 +12,7 @@ AllCops:
12
12
  NewCops: enable
13
13
  SuggestExtensions: false
14
14
  DisplayCopNames: true
15
- TargetRubyVersion: 2.5
15
+ TargetRubyVersion: 2.7
16
16
  TargetRailsVersion: 5.2
17
17
  Exclude:
18
18
  - bin/**/*
data/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  * TODO: Replace this bullet point with an actual description of a change.
4
4
 
5
+ ### 1.2.0
6
+
7
+ * Moved the development dependencies from the gemspec to the Gemfile (#19)
8
+ * Introduce `after_response` callback (#22)
9
+ * Fix response parsing for responses exceeding the page size (#23)
10
+ * Dropped support for Ruby <2.7 (#24)
11
+
5
12
  ### 1.1.0
6
13
 
7
14
  * Added support for Gem release automation
data/Dockerfile CHANGED
@@ -1,8 +1,8 @@
1
- FROM hausgold/ruby:2.5
1
+ FROM hausgold/ruby:2.7
2
2
  MAINTAINER Hermann Mayer <hermann.mayer@hausgold.de>
3
3
 
4
4
  # Update system gem
5
- RUN gem update --system '3.3.26'
5
+ RUN gem update --system '3.4.22'
6
6
 
7
7
  # Install system packages and the latest bundler
8
8
  RUN apt-get update -yqqq && \
@@ -11,7 +11,7 @@ RUN apt-get update -yqqq && \
11
11
  ca-certificates \
12
12
  bash-completion inotify-tools && \
13
13
  echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen && /usr/sbin/locale-gen && \
14
- gem install bundler -v '~> 2.3.0' --no-document --no-prerelease
14
+ gem install bundler -v '~> 2.4.22' --no-document --no-prerelease
15
15
 
16
16
  # Add new web user
17
17
  RUN mkdir /app && \
data/Gemfile CHANGED
@@ -4,3 +4,17 @@ source 'https://rubygems.org'
4
4
 
5
5
  # Specify your gem's dependencies in billomat.gemspec
6
6
  gemspec
7
+
8
+ # Development dependencies
9
+ gem 'bundler', '~> 2.3'
10
+ gem 'countless', '~> 1.1'
11
+ gem 'guard-rspec', '~> 4.7'
12
+ gem 'irb', '~> 1.2'
13
+ gem 'rake', '~> 13.0'
14
+ gem 'rspec', '~> 3.12'
15
+ gem 'rubocop', '~> 1.28'
16
+ gem 'rubocop-rails', '~> 2.14'
17
+ gem 'rubocop-rspec', '~> 2.10'
18
+ gem 'simplecov', '>= 0.22'
19
+ gem 'yard', '>= 0.9.28'
20
+ gem 'yard-activesupport-concern', '>= 0.0.1'
data/Makefile CHANGED
@@ -23,6 +23,7 @@ GREP ?= grep
23
23
  ID ?= id
24
24
  MKDIR ?= mkdir
25
25
  RM ?= rm
26
+ TEST ?= test
26
27
  XARGS ?= xargs
27
28
 
28
29
  # Container binaries
@@ -33,6 +34,7 @@ RAKE ?= rake
33
34
  RSPEC ?= rspec
34
35
  RUBOCOP ?= rubocop
35
36
  YARD ?= yard
37
+ RUBY_VERSION := ruby-version
36
38
 
37
39
  # Define a generic shell run wrapper
38
40
  # $1 - The command to run
@@ -98,7 +100,8 @@ test-style: \
98
100
 
99
101
  test-style-ruby:
100
102
  # Run the static code analyzer (rubocop)
101
- @$(call run-shell,$(BUNDLE) exec $(RUBOCOP) -a)
103
+ @$(call run-shell,$(BUNDLE) exec $(RUBOCOP) -a \
104
+ || ($(TEST) $$($(RUBY_VERSION)) != '2.7' && true))
102
105
 
103
106
  clean:
104
107
  # Clean the dependencies
data/README.md CHANGED
@@ -60,6 +60,11 @@ Billomat.configure do |config|
60
60
  # https://www.billomat.com/en/api/basics/rate-limiting/
61
61
  config.app_id = '12345'
62
62
  config.app_secret = 'c3df...'
63
+
64
+ config.after_response = lambda do |response|
65
+ # API response callback, e.g. for inspecting the rate limit
66
+ # header via response.headers[:x_rate_limit_remaining]
67
+ end
63
68
  end
64
69
  ```
65
70
 
data/billomat.gemspec CHANGED
@@ -31,20 +31,7 @@ Gem::Specification.new do |spec|
31
31
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
32
32
  spec.require_paths = ['lib']
33
33
 
34
- spec.required_ruby_version = '>= 2.5'
35
-
36
- spec.add_dependency 'rest-client', '~> 2.1'
37
-
38
- spec.add_development_dependency 'bundler', '~> 2.3'
39
- spec.add_development_dependency 'countless', '~> 1.1'
40
- spec.add_development_dependency 'guard-rspec', '~> 4.7'
41
- spec.add_development_dependency 'irb', '~> 1.2'
42
- spec.add_development_dependency 'rake', '~> 13.0'
43
- spec.add_development_dependency 'rspec', '~> 3.12'
44
- spec.add_development_dependency 'rubocop', '~> 1.28'
45
- spec.add_development_dependency 'rubocop-rails', '~> 2.14'
46
- spec.add_development_dependency 'rubocop-rspec', '~> 2.10'
47
- spec.add_development_dependency 'simplecov', '>= 0.22'
48
- spec.add_development_dependency 'yard', '>= 0.9.28'
49
- spec.add_development_dependency 'yard-activesupport-concern', '>= 0.0.1'
34
+ spec.required_ruby_version = '>= 2.7'
35
+
36
+ spec.add_runtime_dependency 'rest-client', '~> 2.1'
50
37
  end
@@ -16,7 +16,9 @@ sudo sed -i 's/autostart=.*/autostart=false/g' /etc/supervisor/conf.d/*
16
16
  sudo supervisord >/dev/null 2>&1 &
17
17
 
18
18
  # Wait for supervisord
19
- while ! supervisorctl status >/dev/null 2>&1; do sleep 1; done
19
+ while ! (sudo supervisorctl status | grep avahi) >/dev/null 2>&1; do
20
+ sleep 1
21
+ done
20
22
 
21
23
  # Boot the mDNS stack
22
24
  echo '# Start the mDNS stack'
@@ -4,5 +4,17 @@ module Billomat
4
4
  # The +billomat+ gem configuration.
5
5
  class Configuration
6
6
  attr_accessor :api_key, :subdomain, :timeout, :app_id, :app_secret
7
+ attr_reader :after_response
8
+
9
+ # Sets a callback to be called for each API response
10
+ #
11
+ # @param [Proc] callback The callback
12
+ def after_response=(callback)
13
+ unless callback.respond_to?(:call)
14
+ raise ArgumentError, "callback must respond to `call'"
15
+ end
16
+
17
+ @after_response = callback
18
+ end
7
19
  end
8
20
  end
@@ -68,7 +68,7 @@ module Billomat
68
68
  timeout: timeout,
69
69
  headers: headers,
70
70
  payload: body.to_json
71
- )
71
+ ).tap { |response| Billomat.configuration.after_response&.call(response) }
72
72
  end
73
73
 
74
74
  # @return [String] the complete URL for the request
@@ -31,22 +31,20 @@ module Billomat
31
31
 
32
32
  # Corrects the response to always return an array.
33
33
  #
34
- # @todo Due to a strange API behaviour we have to fix the reponse here.
34
+ # @todo Due to a strange API behaviour we have to fix the response here.
35
35
  # This may be fixed in a new API version.
36
36
  #
37
37
  # @param [Hash] resp The response from the gateway
38
38
  # @return [Array<Billomat::Model::Base>]
39
39
  def to_array(resp)
40
- case count(resp)
41
- when 0
42
- []
43
- when 1
44
- # Necessary due to strange API behaviour
45
- [@resource.new(resp["#{name}s"][name])]
40
+ data = resp["#{name}s"][name]
41
+ case data
42
+ when Hash
43
+ [@resource.new(data)]
44
+ when Array
45
+ data.map { |d| @resource.new(d) }
46
46
  else
47
- resp["#{name}s"][name].map do |c|
48
- @resource.new(c)
49
- end
47
+ []
50
48
  end
51
49
  end
52
50
 
@@ -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.1.0'
6
+ VERSION = '1.2.0'
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.1.0
4
+ version: 1.2.0
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: 2023-02-24 00:00:00.000000000 Z
12
+ date: 2024-07-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
@@ -25,174 +25,6 @@ dependencies:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
27
  version: '2.1'
28
- - !ruby/object:Gem::Dependency
29
- name: bundler
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - "~>"
33
- - !ruby/object:Gem::Version
34
- version: '2.3'
35
- type: :development
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - "~>"
40
- - !ruby/object:Gem::Version
41
- version: '2.3'
42
- - !ruby/object:Gem::Dependency
43
- name: countless
44
- requirement: !ruby/object:Gem::Requirement
45
- requirements:
46
- - - "~>"
47
- - !ruby/object:Gem::Version
48
- version: '1.1'
49
- type: :development
50
- prerelease: false
51
- version_requirements: !ruby/object:Gem::Requirement
52
- requirements:
53
- - - "~>"
54
- - !ruby/object:Gem::Version
55
- version: '1.1'
56
- - !ruby/object:Gem::Dependency
57
- name: guard-rspec
58
- requirement: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - "~>"
61
- - !ruby/object:Gem::Version
62
- version: '4.7'
63
- type: :development
64
- prerelease: false
65
- version_requirements: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - "~>"
68
- - !ruby/object:Gem::Version
69
- version: '4.7'
70
- - !ruby/object:Gem::Dependency
71
- name: irb
72
- requirement: !ruby/object:Gem::Requirement
73
- requirements:
74
- - - "~>"
75
- - !ruby/object:Gem::Version
76
- version: '1.2'
77
- type: :development
78
- prerelease: false
79
- version_requirements: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - "~>"
82
- - !ruby/object:Gem::Version
83
- version: '1.2'
84
- - !ruby/object:Gem::Dependency
85
- name: rake
86
- requirement: !ruby/object:Gem::Requirement
87
- requirements:
88
- - - "~>"
89
- - !ruby/object:Gem::Version
90
- version: '13.0'
91
- type: :development
92
- prerelease: false
93
- version_requirements: !ruby/object:Gem::Requirement
94
- requirements:
95
- - - "~>"
96
- - !ruby/object:Gem::Version
97
- version: '13.0'
98
- - !ruby/object:Gem::Dependency
99
- name: rspec
100
- requirement: !ruby/object:Gem::Requirement
101
- requirements:
102
- - - "~>"
103
- - !ruby/object:Gem::Version
104
- version: '3.12'
105
- type: :development
106
- prerelease: false
107
- version_requirements: !ruby/object:Gem::Requirement
108
- requirements:
109
- - - "~>"
110
- - !ruby/object:Gem::Version
111
- version: '3.12'
112
- - !ruby/object:Gem::Dependency
113
- name: rubocop
114
- requirement: !ruby/object:Gem::Requirement
115
- requirements:
116
- - - "~>"
117
- - !ruby/object:Gem::Version
118
- version: '1.28'
119
- type: :development
120
- prerelease: false
121
- version_requirements: !ruby/object:Gem::Requirement
122
- requirements:
123
- - - "~>"
124
- - !ruby/object:Gem::Version
125
- version: '1.28'
126
- - !ruby/object:Gem::Dependency
127
- name: rubocop-rails
128
- requirement: !ruby/object:Gem::Requirement
129
- requirements:
130
- - - "~>"
131
- - !ruby/object:Gem::Version
132
- version: '2.14'
133
- type: :development
134
- prerelease: false
135
- version_requirements: !ruby/object:Gem::Requirement
136
- requirements:
137
- - - "~>"
138
- - !ruby/object:Gem::Version
139
- version: '2.14'
140
- - !ruby/object:Gem::Dependency
141
- name: rubocop-rspec
142
- requirement: !ruby/object:Gem::Requirement
143
- requirements:
144
- - - "~>"
145
- - !ruby/object:Gem::Version
146
- version: '2.10'
147
- type: :development
148
- prerelease: false
149
- version_requirements: !ruby/object:Gem::Requirement
150
- requirements:
151
- - - "~>"
152
- - !ruby/object:Gem::Version
153
- version: '2.10'
154
- - !ruby/object:Gem::Dependency
155
- name: simplecov
156
- requirement: !ruby/object:Gem::Requirement
157
- requirements:
158
- - - ">="
159
- - !ruby/object:Gem::Version
160
- version: '0.22'
161
- type: :development
162
- prerelease: false
163
- version_requirements: !ruby/object:Gem::Requirement
164
- requirements:
165
- - - ">="
166
- - !ruby/object:Gem::Version
167
- version: '0.22'
168
- - !ruby/object:Gem::Dependency
169
- name: yard
170
- requirement: !ruby/object:Gem::Requirement
171
- requirements:
172
- - - ">="
173
- - !ruby/object:Gem::Version
174
- version: 0.9.28
175
- type: :development
176
- prerelease: false
177
- version_requirements: !ruby/object:Gem::Requirement
178
- requirements:
179
- - - ">="
180
- - !ruby/object:Gem::Version
181
- version: 0.9.28
182
- - !ruby/object:Gem::Dependency
183
- name: yard-activesupport-concern
184
- requirement: !ruby/object:Gem::Requirement
185
- requirements:
186
- - - ">="
187
- - !ruby/object:Gem::Version
188
- version: 0.0.1
189
- type: :development
190
- prerelease: false
191
- version_requirements: !ruby/object:Gem::Requirement
192
- requirements:
193
- - - ">="
194
- - !ruby/object:Gem::Version
195
- version: 0.0.1
196
28
  description: Wrapper for the Billomat API
197
29
  email:
198
30
  - hermann.mayer92@gmail.com
@@ -268,7 +100,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
268
100
  requirements:
269
101
  - - ">="
270
102
  - !ruby/object:Gem::Version
271
- version: '2.5'
103
+ version: '2.7'
272
104
  required_rubygems_version: !ruby/object:Gem::Requirement
273
105
  requirements:
274
106
  - - ">="