bootic_client 0.0.32 → 0.0.33
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/lib/bootic_client/client.rb +6 -6
- data/lib/bootic_client/errors.rb +8 -1
- data/lib/bootic_client/version.rb +1 -1
- data/spec/client_spec.rb +24 -0
- metadata +5 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 355d7cbacb5e60ff2c051cc0f48452d01d4c099f0038dc5c0334a41811e8f5d3
|
|
4
|
+
data.tar.gz: fffcba9efcee1e1662e3337fd7ee25c1dbbe713f1153ed305f415a8a7c96e8a6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d8ffddf4c0a8825b5bad13e21a35c5b978d5629bf3025783c6fa42dab246dda845ab14e98694d949907698d7d81e01f779849e19c36421b471ecd6bc4d4d0c3c
|
|
7
|
+
data.tar.gz: fe5c3912de3febdb6ba374472e3a0996eb63f83504f8a5af266563f5b9cc46ed16b7a006fd22e66f83447669aef722893f1b24d4efd896f91638804d4a151be7
|
data/lib/bootic_client/client.rb
CHANGED
|
@@ -108,15 +108,15 @@ module BooticClient
|
|
|
108
108
|
yield req if block_given?
|
|
109
109
|
end
|
|
110
110
|
|
|
111
|
-
raise_if_invalid! resp
|
|
111
|
+
raise_if_invalid! resp, "#{verb.upcase} #{href}"
|
|
112
112
|
resp
|
|
113
113
|
end
|
|
114
114
|
|
|
115
|
-
def raise_if_invalid!(resp)
|
|
116
|
-
raise ServerError
|
|
117
|
-
raise NotFoundError
|
|
118
|
-
raise UnauthorizedError
|
|
119
|
-
raise AccessForbiddenError
|
|
115
|
+
def raise_if_invalid!(resp, url = nil)
|
|
116
|
+
raise ServerError.new("Server Error", url) if resp.status > 499
|
|
117
|
+
raise NotFoundError.new("Not Found", url) if resp.status == 404
|
|
118
|
+
raise UnauthorizedError.new("Unauthorized Request", url) if resp.status == 401
|
|
119
|
+
raise AccessForbiddenError.new("Access Forbidden", url) if resp.status == 403
|
|
120
120
|
end
|
|
121
121
|
|
|
122
122
|
def sanitized(payload)
|
data/lib/bootic_client/errors.rb
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module BooticClient
|
|
4
|
-
class TransportError < StandardError
|
|
4
|
+
class TransportError < StandardError
|
|
5
|
+
attr_reader :url
|
|
6
|
+
def initialize(msg = nil, url = nil)
|
|
7
|
+
super(msg)
|
|
8
|
+
@url = url
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
5
12
|
class ServerError < TransportError; end
|
|
6
13
|
class NotFoundError < ServerError; end
|
|
7
14
|
class AuthorizationError < ServerError; end
|
data/spec/client_spec.rb
CHANGED
|
@@ -140,6 +140,12 @@ describe BooticClient::Client do
|
|
|
140
140
|
expect{
|
|
141
141
|
client.get(root_url)
|
|
142
142
|
}.to raise_error(BooticClient::ServerError)
|
|
143
|
+
|
|
144
|
+
begin
|
|
145
|
+
client.get(root_url)
|
|
146
|
+
rescue BooticClient::ServerError => e
|
|
147
|
+
expect(e.url).to eq("GET #{root_url}")
|
|
148
|
+
end
|
|
143
149
|
end
|
|
144
150
|
end
|
|
145
151
|
|
|
@@ -153,6 +159,12 @@ describe BooticClient::Client do
|
|
|
153
159
|
expect{
|
|
154
160
|
client.get(root_url)
|
|
155
161
|
}.to raise_error(BooticClient::NotFoundError)
|
|
162
|
+
|
|
163
|
+
begin
|
|
164
|
+
client.get(root_url)
|
|
165
|
+
rescue BooticClient::NotFoundError => e
|
|
166
|
+
expect(e.url).to eq("GET #{root_url}")
|
|
167
|
+
end
|
|
156
168
|
end
|
|
157
169
|
end
|
|
158
170
|
|
|
@@ -166,6 +178,12 @@ describe BooticClient::Client do
|
|
|
166
178
|
expect{
|
|
167
179
|
client.get(root_url)
|
|
168
180
|
}.to raise_error(BooticClient::UnauthorizedError)
|
|
181
|
+
|
|
182
|
+
begin
|
|
183
|
+
client.get(root_url)
|
|
184
|
+
rescue BooticClient::UnauthorizedError => e
|
|
185
|
+
expect(e.url).to eq("GET #{root_url}")
|
|
186
|
+
end
|
|
169
187
|
end
|
|
170
188
|
end
|
|
171
189
|
|
|
@@ -179,6 +197,12 @@ describe BooticClient::Client do
|
|
|
179
197
|
expect{
|
|
180
198
|
client.get(root_url)
|
|
181
199
|
}.to raise_error(BooticClient::AccessForbiddenError)
|
|
200
|
+
|
|
201
|
+
begin
|
|
202
|
+
client.get(root_url)
|
|
203
|
+
rescue BooticClient::AccessForbiddenError => e
|
|
204
|
+
expect(e.url).to eq("GET #{root_url}")
|
|
205
|
+
end
|
|
182
206
|
end
|
|
183
207
|
end
|
|
184
208
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bootic_client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.33
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ismael Celis
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2025-11-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|
|
@@ -205,7 +205,7 @@ homepage: https://developers.bootic.net
|
|
|
205
205
|
licenses:
|
|
206
206
|
- MIT
|
|
207
207
|
metadata: {}
|
|
208
|
-
post_install_message:
|
|
208
|
+
post_install_message:
|
|
209
209
|
rdoc_options: []
|
|
210
210
|
require_paths:
|
|
211
211
|
- lib
|
|
@@ -221,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
221
221
|
version: '0'
|
|
222
222
|
requirements: []
|
|
223
223
|
rubygems_version: 3.4.6
|
|
224
|
-
signing_key:
|
|
224
|
+
signing_key:
|
|
225
225
|
specification_version: 4
|
|
226
226
|
summary: Official Ruby client for the Bootic API
|
|
227
227
|
test_files:
|