mackerel-client 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +1 -0
- data/CHANGELOG.md +9 -0
- data/VERSION +1 -1
- data/lib/mackerel/api_command.rb +9 -21
- data/lib/mackerel/client.rb +2 -0
- data/lib/mackerel/error.rb +4 -0
- data/lib/mackerel/version.rb +1 -1
- data/spec/mackerel/alert_spec.rb +2 -0
- data/spec/mackerel/annotation_spec.rb +4 -0
- data/spec/mackerel/api_commend_spec.rb +82 -0
- data/spec/mackerel/channel_spec.rb +1 -0
- data/spec/mackerel/client_spec.rb +13 -0
- data/spec/mackerel/dashboard_spec.rb +5 -0
- data/spec/mackerel/invitation_spec.rb +2 -0
- data/spec/mackerel/metric_spec.rb +6 -0
- data/spec/mackerel/monitor_spec.rb +4 -0
- data/spec/mackerel/monitoring_spec.rb +1 -0
- data/spec/mackerel/notification_group_spec.rb +4 -0
- data/spec/mackerel/organization_spec.rb +1 -0
- data/spec/mackerel/service_spec.rb +3 -0
- data/spec/mackerel/user_spec.rb +2 -0
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a8025a2dd9cbfd378bc719250d994bb31af4f047
|
4
|
+
data.tar.gz: fe92c27be56baefd72f2f1de9452075b9e520237
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61fd86ed9588edbe18390f187387239bd9bb9bc0741bbbe41f36feda23aab143f5187b78716a9dedf4b6c746121896081ae559163181545677a4399c80074cfb
|
7
|
+
data.tar.gz: 3ba6941136bfb4fa2eeb2a099dff83f385a786d71f0b5bdcb346533b8f0fd0bdbc2e8162a2ceaa6dd4191bc09405bed3b4cd26f4246388f6d0a5509bb1756e78
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## v0.8.0 (2019-06-26)
|
4
|
+
|
5
|
+
### Breaking change
|
6
|
+
|
7
|
+
Now mackerel-client raises `Mackerel::Error` when HTTP requests failed.
|
8
|
+
Previously various exceptions (mainly `RuntimeError` or `NoMethodError`) happened in such cases.
|
9
|
+
|
10
|
+
* Use Faraday::Response::RaiseError middleware #49 (onk)
|
11
|
+
|
3
12
|
## v0.7.0 (2018-10-22)
|
4
13
|
|
5
14
|
* fix unintended initializing http headers #47 (y_uuki)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.8.0
|
data/lib/mackerel/api_command.rb
CHANGED
@@ -33,32 +33,20 @@ module Mackerel
|
|
33
33
|
req.params = @params
|
34
34
|
req.body = @body
|
35
35
|
end
|
36
|
-
check_status(response.status)
|
37
|
-
|
38
36
|
JSON.parse(response.body)
|
37
|
+
rescue Faraday::Error::ClientError => e
|
38
|
+
begin
|
39
|
+
body = JSON.parse(e.response[:body])
|
40
|
+
message = body["error"].is_a?(Hash) ? body["error"]["message"] : body["error"]
|
41
|
+
raise Mackerel::Error, "#{@method.upcase} #{@path} failed: #{e.response[:status]} #{message}"
|
42
|
+
rescue JSON::ParserError
|
43
|
+
# raise Mackerel::Error with original response body
|
44
|
+
raise Mackerel::Error, "#{@method.upcase} #{@path} failed: #{e.response[:status]} #{e.response[:body]}"
|
45
|
+
end
|
39
46
|
end
|
40
47
|
|
41
48
|
private
|
42
49
|
|
43
|
-
def check_status(status)
|
44
|
-
case status
|
45
|
-
when 200...300
|
46
|
-
nil
|
47
|
-
when 400
|
48
|
-
message ="Invalid parameter"
|
49
|
-
raise "#{@method.upcase} #{@path} failed: #{status} #{message}"
|
50
|
-
when 403
|
51
|
-
message ="Not authorized"
|
52
|
-
raise "#{@method.upcase} #{@path} failed: #{status} #{message}"
|
53
|
-
when 404
|
54
|
-
message ="Resource not found"
|
55
|
-
raise "#{@method.upcase} #{@path} failed: #{status} #{message}"
|
56
|
-
when 409
|
57
|
-
message ="Already exists"
|
58
|
-
raise "#{@method.upcase} #{@path} failed: #{status} #{message}"
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
50
|
def make_escaped_query
|
63
51
|
@query.map{|k,v| "#{CGI.escape(k.to_s)}=#{CGI.escape(v.to_s)}"}.join("&")
|
64
52
|
end
|
data/lib/mackerel/client.rb
CHANGED
@@ -4,6 +4,7 @@ require 'uri'
|
|
4
4
|
require 'json' unless defined? ::JSON
|
5
5
|
|
6
6
|
require 'mackerel/api_command'
|
7
|
+
require 'mackerel/error'
|
7
8
|
|
8
9
|
require 'mackerel/role'
|
9
10
|
require 'mackerel/host'
|
@@ -54,6 +55,7 @@ module Mackerel
|
|
54
55
|
|
55
56
|
def http_client
|
56
57
|
Faraday.new(:url => @origin) do |faraday|
|
58
|
+
faraday.response :raise_error
|
57
59
|
faraday.response :logger if ENV['DEBUG']
|
58
60
|
faraday.adapter Faraday.default_adapter
|
59
61
|
faraday.options.params_encoder = Faraday::FlatParamsEncoder
|
data/lib/mackerel/version.rb
CHANGED
data/spec/mackerel/alert_spec.rb
CHANGED
@@ -13,6 +13,7 @@ RSpec.describe Mackerel::Client do
|
|
13
13
|
|
14
14
|
let(:test_client) {
|
15
15
|
Faraday.new do |builder|
|
16
|
+
builder.response :raise_error
|
16
17
|
builder.adapter :test do |stubs|
|
17
18
|
stubs.get(api_path) { stubbed_response }
|
18
19
|
end
|
@@ -62,6 +63,7 @@ RSpec.describe Mackerel::Client do
|
|
62
63
|
|
63
64
|
let(:test_client) {
|
64
65
|
Faraday.new do |builder|
|
66
|
+
builder.response :raise_error
|
65
67
|
builder.adapter :test do |stubs|
|
66
68
|
stubs.post(api_path) { stubbed_response }
|
67
69
|
end
|
@@ -13,6 +13,7 @@ RSpec.describe Mackerel::Client do
|
|
13
13
|
|
14
14
|
let(:test_client) {
|
15
15
|
Faraday.new do |builder|
|
16
|
+
builder.response :raise_error
|
16
17
|
builder.adapter :test do |stubs|
|
17
18
|
stubs.post(api_path) { stubbed_response }
|
18
19
|
end
|
@@ -58,6 +59,7 @@ RSpec.describe Mackerel::Client do
|
|
58
59
|
|
59
60
|
let(:test_client) {
|
60
61
|
Faraday.new do |builder|
|
62
|
+
builder.response :raise_error
|
61
63
|
builder.adapter :test do |stubs|
|
62
64
|
stubs.get(api_path) { stubbed_response }
|
63
65
|
end
|
@@ -118,6 +120,7 @@ RSpec.describe Mackerel::Client do
|
|
118
120
|
|
119
121
|
let(:test_client) {
|
120
122
|
Faraday.new do |builder|
|
123
|
+
builder.response :raise_error
|
121
124
|
builder.adapter :test do |stubs|
|
122
125
|
stubs.put(api_path) { stubbed_response }
|
123
126
|
end
|
@@ -165,6 +168,7 @@ RSpec.describe Mackerel::Client do
|
|
165
168
|
|
166
169
|
let(:test_client) {
|
167
170
|
Faraday.new do |builder|
|
171
|
+
builder.response :raise_error
|
168
172
|
builder.adapter :test do |stubs|
|
169
173
|
stubs.delete(api_path) { stubbed_response }
|
170
174
|
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
RSpec.describe Mackerel::ApiCommand do
|
2
|
+
let(:api_key) { "xxxxxxxx" }
|
3
|
+
let(:command) { Mackerel::ApiCommand.new(:get, "/api/v0/services", api_key) }
|
4
|
+
|
5
|
+
describe "#execute" do
|
6
|
+
let(:api_path) { "/api/v0/services" }
|
7
|
+
|
8
|
+
let(:test_client) {
|
9
|
+
Faraday.new do |builder|
|
10
|
+
builder.response :raise_error
|
11
|
+
builder.adapter :test do |stubs|
|
12
|
+
stubs.get(api_path) { stubbed_response }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
}
|
16
|
+
|
17
|
+
let(:services) {
|
18
|
+
{
|
19
|
+
"services" => [
|
20
|
+
{
|
21
|
+
"name" => "Web",
|
22
|
+
"memo" => "store",
|
23
|
+
"roles" => [
|
24
|
+
"normal role",
|
25
|
+
"special role"
|
26
|
+
]
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"name" => "Web",
|
30
|
+
"memo" => "store",
|
31
|
+
"roles" => [
|
32
|
+
"a role",
|
33
|
+
"the role"
|
34
|
+
]
|
35
|
+
}
|
36
|
+
]
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
context "when success" do
|
41
|
+
let(:stubbed_response) {
|
42
|
+
[
|
43
|
+
200,
|
44
|
+
{},
|
45
|
+
JSON.dump(services)
|
46
|
+
]
|
47
|
+
}
|
48
|
+
|
49
|
+
it {
|
50
|
+
expect(command.execute(test_client)).to eq(services)
|
51
|
+
}
|
52
|
+
end
|
53
|
+
|
54
|
+
context "when 404 Not Found" do
|
55
|
+
let(:stubbed_response) {
|
56
|
+
[
|
57
|
+
404,
|
58
|
+
{},
|
59
|
+
JSON.dump({"error" => { "message" => "Host Not Found."} })
|
60
|
+
]
|
61
|
+
}
|
62
|
+
|
63
|
+
it {
|
64
|
+
expect { command.execute(test_client) }.to raise_error Mackerel::Error, "GET /api/v0/services failed: 404 Host Not Found."
|
65
|
+
}
|
66
|
+
end
|
67
|
+
|
68
|
+
context "when 401 Unauthorized" do
|
69
|
+
let(:stubbed_response) {
|
70
|
+
[
|
71
|
+
401,
|
72
|
+
{},
|
73
|
+
JSON.dump({ "error" => "Authentication failed. Please try with valid Api Key." })
|
74
|
+
]
|
75
|
+
}
|
76
|
+
|
77
|
+
it {
|
78
|
+
expect { command.execute(test_client) }.to raise_error Mackerel::Error, "GET /api/v0/services failed: 401 Authentication failed. Please try with valid Api Key."
|
79
|
+
}
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -20,6 +20,7 @@ RSpec.describe Mackerel::Client do
|
|
20
20
|
|
21
21
|
let(:test_client) {
|
22
22
|
Faraday.new do |builder|
|
23
|
+
builder.response :raise_error
|
23
24
|
builder.adapter :test do |stubs|
|
24
25
|
stubs.post(api_path) { stubbed_response }
|
25
26
|
end
|
@@ -62,6 +63,7 @@ RSpec.describe Mackerel::Client do
|
|
62
63
|
|
63
64
|
let(:test_client) {
|
64
65
|
Faraday.new do |builder|
|
66
|
+
builder.response :raise_error
|
65
67
|
builder.adapter :test do |stubs|
|
66
68
|
stubs.put(api_path) { stubbed_response }
|
67
69
|
end
|
@@ -104,6 +106,7 @@ RSpec.describe Mackerel::Client do
|
|
104
106
|
|
105
107
|
let(:test_client) {
|
106
108
|
Faraday.new do |builder|
|
109
|
+
builder.response :raise_error
|
107
110
|
builder.adapter :test do |stubs|
|
108
111
|
stubs.get(api_path) { stubbed_response }
|
109
112
|
end
|
@@ -159,6 +162,7 @@ RSpec.describe Mackerel::Client do
|
|
159
162
|
|
160
163
|
let(:test_client) {
|
161
164
|
Faraday.new do |builder|
|
165
|
+
builder.response :raise_error
|
162
166
|
builder.adapter :test do |stubs|
|
163
167
|
stubs.post(api_path) { stubbed_response }
|
164
168
|
end
|
@@ -194,6 +198,7 @@ RSpec.describe Mackerel::Client do
|
|
194
198
|
|
195
199
|
let(:test_client) {
|
196
200
|
Faraday.new do |builder|
|
201
|
+
builder.response :raise_error
|
197
202
|
builder.adapter :test do |stubs|
|
198
203
|
stubs.put(api_path) { stubbed_response }
|
199
204
|
end
|
@@ -236,6 +241,7 @@ RSpec.describe Mackerel::Client do
|
|
236
241
|
|
237
242
|
let(:test_client) {
|
238
243
|
Faraday.new do |builder|
|
244
|
+
builder.response :raise_error
|
239
245
|
builder.adapter :test do |stubs|
|
240
246
|
stubs.post(api_path) { stubbed_response }
|
241
247
|
end
|
@@ -270,6 +276,7 @@ RSpec.describe Mackerel::Client do
|
|
270
276
|
|
271
277
|
let(:test_client) {
|
272
278
|
Faraday.new do |builder|
|
279
|
+
builder.response :raise_error
|
273
280
|
builder.adapter :test do |stubs|
|
274
281
|
stubs.post(api_path) { stubbed_response }
|
275
282
|
end
|
@@ -327,6 +334,7 @@ RSpec.describe Mackerel::Client do
|
|
327
334
|
|
328
335
|
let(:test_client) {
|
329
336
|
Faraday.new do |builder|
|
337
|
+
builder.response :raise_error
|
330
338
|
builder.adapter :test do |stubs|
|
331
339
|
stubs.get(api_path) { stubbed_response }
|
332
340
|
end
|
@@ -388,6 +396,7 @@ RSpec.describe Mackerel::Client do
|
|
388
396
|
|
389
397
|
let(:test_client) {
|
390
398
|
Faraday.new do |builder|
|
399
|
+
builder.response :raise_error
|
391
400
|
builder.adapter :test do |stubs|
|
392
401
|
stubs.post(api_path) { stubbed_response }
|
393
402
|
end
|
@@ -433,6 +442,7 @@ RSpec.describe Mackerel::Client do
|
|
433
442
|
|
434
443
|
let(:test_client) {
|
435
444
|
Faraday.new do |builder|
|
445
|
+
builder.response :raise_error
|
436
446
|
builder.adapter :test do |stubs|
|
437
447
|
stubs.get(api_path) { stubbed_response }
|
438
448
|
end
|
@@ -466,6 +476,7 @@ RSpec.describe Mackerel::Client do
|
|
466
476
|
|
467
477
|
let(:test_client) {
|
468
478
|
Faraday.new do |builder|
|
479
|
+
builder.response :raise_error
|
469
480
|
builder.adapter :test do |stubs|
|
470
481
|
stubs.get(api_path) { stubbed_response }
|
471
482
|
end
|
@@ -501,6 +512,7 @@ RSpec.describe Mackerel::Client do
|
|
501
512
|
|
502
513
|
let(:test_client) {
|
503
514
|
Faraday.new do |builder|
|
515
|
+
builder.response :raise_error
|
504
516
|
builder.adapter :test do |stubs|
|
505
517
|
stubs.put(api_path) { stubbed_response }
|
506
518
|
end
|
@@ -540,6 +552,7 @@ RSpec.describe Mackerel::Client do
|
|
540
552
|
|
541
553
|
let(:test_client) {
|
542
554
|
Faraday.new do |builder|
|
555
|
+
builder.response :raise_error
|
543
556
|
builder.adapter :test do |stubs|
|
544
557
|
stubs.delete(api_path) { stubbed_response }
|
545
558
|
end
|
@@ -13,6 +13,7 @@ RSpec.describe Mackerel::Client do
|
|
13
13
|
|
14
14
|
let(:test_client) {
|
15
15
|
Faraday.new do |builder|
|
16
|
+
builder.response :raise_error
|
16
17
|
builder.adapter :test do |stubs|
|
17
18
|
stubs.post(api_path) { stubbed_response }
|
18
19
|
end
|
@@ -61,6 +62,7 @@ RSpec.describe Mackerel::Client do
|
|
61
62
|
|
62
63
|
let(:test_client) {
|
63
64
|
Faraday.new do |builder|
|
65
|
+
builder.response :raise_error
|
64
66
|
builder.adapter :test do |stubs|
|
65
67
|
stubs.put(api_path) { stubbed_response }
|
66
68
|
end
|
@@ -110,6 +112,7 @@ RSpec.describe Mackerel::Client do
|
|
110
112
|
|
111
113
|
let(:test_client) {
|
112
114
|
Faraday.new do |builder|
|
115
|
+
builder.response :raise_error
|
113
116
|
builder.adapter :test do |stubs|
|
114
117
|
stubs.get(api_path) { stubbed_response }
|
115
118
|
end
|
@@ -160,6 +163,7 @@ RSpec.describe Mackerel::Client do
|
|
160
163
|
|
161
164
|
let(:test_client) {
|
162
165
|
Faraday.new do |builder|
|
166
|
+
builder.response :raise_error
|
163
167
|
builder.adapter :test do |stubs|
|
164
168
|
stubs.get(api_path) { stubbed_response }
|
165
169
|
end
|
@@ -208,6 +212,7 @@ RSpec.describe Mackerel::Client do
|
|
208
212
|
|
209
213
|
let(:test_client) {
|
210
214
|
Faraday.new do |builder|
|
215
|
+
builder.response :raise_error
|
211
216
|
builder.adapter :test do |stubs|
|
212
217
|
stubs.delete(api_path) { stubbed_response }
|
213
218
|
end
|
@@ -15,6 +15,7 @@ RSpec.describe Mackerel::Client do
|
|
15
15
|
|
16
16
|
let(:test_client) {
|
17
17
|
Faraday.new do |builder|
|
18
|
+
builder.response :raise_error
|
18
19
|
builder.adapter :test do |stubs|
|
19
20
|
stubs.post(api_path) { stubbed_response }
|
20
21
|
end
|
@@ -56,6 +57,7 @@ RSpec.describe Mackerel::Client do
|
|
56
57
|
|
57
58
|
let(:test_client) {
|
58
59
|
Faraday.new do |builder|
|
60
|
+
builder.response :raise_error
|
59
61
|
builder.adapter :test do |stubs|
|
60
62
|
stubs.post(api_path) { stubbed_response }
|
61
63
|
end
|
@@ -13,6 +13,7 @@ RSpec.describe Mackerel::Client do
|
|
13
13
|
|
14
14
|
let(:test_client) {
|
15
15
|
Faraday.new do |builder|
|
16
|
+
builder.response :raise_error
|
16
17
|
builder.adapter :test do |stubs|
|
17
18
|
stubs.post(api_path) { stubbed_response }
|
18
19
|
end
|
@@ -52,6 +53,7 @@ RSpec.describe Mackerel::Client do
|
|
52
53
|
|
53
54
|
let(:test_client) {
|
54
55
|
Faraday.new do |builder|
|
56
|
+
builder.response :raise_error
|
55
57
|
builder.adapter :test do |stubs|
|
56
58
|
stubs.get(api_path) { stubbed_response }
|
57
59
|
end
|
@@ -98,6 +100,7 @@ RSpec.describe Mackerel::Client do
|
|
98
100
|
|
99
101
|
let(:test_client) {
|
100
102
|
Faraday.new do |builder|
|
103
|
+
builder.response :raise_error
|
101
104
|
builder.adapter :test do |stubs|
|
102
105
|
stubs.get(api_path) { stubbed_response }
|
103
106
|
end
|
@@ -141,6 +144,7 @@ RSpec.describe Mackerel::Client do
|
|
141
144
|
|
142
145
|
let(:test_client) {
|
143
146
|
Faraday.new do |builder|
|
147
|
+
builder.response :raise_error
|
144
148
|
builder.adapter :test do |stubs|
|
145
149
|
stubs.post(api_path) { stubbed_response }
|
146
150
|
end
|
@@ -181,6 +185,7 @@ RSpec.describe Mackerel::Client do
|
|
181
185
|
|
182
186
|
let(:test_client) {
|
183
187
|
Faraday.new do |builder|
|
188
|
+
builder.response :raise_error
|
184
189
|
builder.adapter :test do |stubs|
|
185
190
|
stubs.get(api_path) { stubbed_response }
|
186
191
|
end
|
@@ -222,6 +227,7 @@ RSpec.describe Mackerel::Client do
|
|
222
227
|
|
223
228
|
let(:test_client) {
|
224
229
|
Faraday.new do |builder|
|
230
|
+
builder.response :raise_error
|
225
231
|
builder.adapter :test do |stubs|
|
226
232
|
stubs.post(api_path) { stubbed_response }
|
227
233
|
end
|
@@ -13,6 +13,7 @@ RSpec.describe Mackerel::Client do
|
|
13
13
|
|
14
14
|
let(:test_client) {
|
15
15
|
Faraday.new do |builder|
|
16
|
+
builder.response :raise_error
|
16
17
|
builder.adapter :test do |stubs|
|
17
18
|
stubs.post(api_path) { stubbed_response }
|
18
19
|
end
|
@@ -59,6 +60,7 @@ RSpec.describe Mackerel::Client do
|
|
59
60
|
|
60
61
|
let(:test_client) {
|
61
62
|
Faraday.new do |builder|
|
63
|
+
builder.response :raise_error
|
62
64
|
builder.adapter :test do |stubs|
|
63
65
|
stubs.get(api_path) { stubbed_response }
|
64
66
|
end
|
@@ -125,6 +127,7 @@ RSpec.describe Mackerel::Client do
|
|
125
127
|
|
126
128
|
let(:test_client) {
|
127
129
|
Faraday.new do |builder|
|
130
|
+
builder.response :raise_error
|
128
131
|
builder.adapter :test do |stubs|
|
129
132
|
stubs.put(api_path) { stubbed_response }
|
130
133
|
end
|
@@ -173,6 +176,7 @@ RSpec.describe Mackerel::Client do
|
|
173
176
|
|
174
177
|
let(:test_client) {
|
175
178
|
Faraday.new do |builder|
|
179
|
+
builder.response :raise_error
|
176
180
|
builder.adapter :test do |stubs|
|
177
181
|
stubs.delete(api_path) { stubbed_response }
|
178
182
|
end
|
@@ -13,6 +13,7 @@ RSpec.describe Mackerel::Client do
|
|
13
13
|
|
14
14
|
let(:test_client) {
|
15
15
|
Faraday.new do |builder|
|
16
|
+
builder.response :raise_error
|
16
17
|
builder.adapter :test do |stubs|
|
17
18
|
stubs.post(api_path) { stubbed_response }
|
18
19
|
end
|
@@ -76,6 +77,7 @@ RSpec.describe Mackerel::Client do
|
|
76
77
|
|
77
78
|
let(:test_client) {
|
78
79
|
Faraday.new do |builder|
|
80
|
+
builder.response :raise_error
|
79
81
|
builder.adapter :test do |stubs|
|
80
82
|
stubs.get(api_path) { stubbed_response }
|
81
83
|
end
|
@@ -159,6 +161,7 @@ RSpec.describe Mackerel::Client do
|
|
159
161
|
|
160
162
|
let(:test_client) {
|
161
163
|
Faraday.new do |builder|
|
164
|
+
builder.response :raise_error
|
162
165
|
builder.adapter :test do |stubs|
|
163
166
|
stubs.put(api_path) { stubbed_response }
|
164
167
|
end
|
@@ -219,6 +222,7 @@ RSpec.describe Mackerel::Client do
|
|
219
222
|
|
220
223
|
let(:test_client) {
|
221
224
|
Faraday.new do |builder|
|
225
|
+
builder.response :raise_error
|
222
226
|
builder.adapter :test do |stubs|
|
223
227
|
stubs.delete(api_path) { stubbed_response }
|
224
228
|
end
|
@@ -15,6 +15,7 @@ RSpec.describe Mackerel::Client do
|
|
15
15
|
|
16
16
|
let(:test_client) {
|
17
17
|
Faraday.new do |builder|
|
18
|
+
builder.response :raise_error
|
18
19
|
builder.adapter :test do |stubs|
|
19
20
|
stubs.get(api_path) { stubbed_response }
|
20
21
|
end
|
@@ -71,6 +72,7 @@ RSpec.describe Mackerel::Client do
|
|
71
72
|
|
72
73
|
let(:test_client) {
|
73
74
|
Faraday.new do |builder|
|
75
|
+
builder.response :raise_error
|
74
76
|
builder.adapter :test do |stubs|
|
75
77
|
stubs.get(api_path) { stubbed_response }
|
76
78
|
end
|
@@ -120,6 +122,7 @@ RSpec.describe Mackerel::Client do
|
|
120
122
|
|
121
123
|
let(:test_client) {
|
122
124
|
Faraday.new do |builder|
|
125
|
+
builder.response :raise_error
|
123
126
|
builder.adapter :test do |stubs|
|
124
127
|
stubs.get(api_path) { stubbed_response }
|
125
128
|
end
|
data/spec/mackerel/user_spec.rb
CHANGED
@@ -15,6 +15,7 @@ RSpec.describe Mackerel::Client do
|
|
15
15
|
|
16
16
|
let(:test_client) {
|
17
17
|
Faraday.new do |builder|
|
18
|
+
builder.response :raise_error
|
18
19
|
builder.adapter :test do |stubs|
|
19
20
|
stubs.get(api_path) { stubbed_response }
|
20
21
|
end
|
@@ -64,6 +65,7 @@ RSpec.describe Mackerel::Client do
|
|
64
65
|
|
65
66
|
let(:test_client) {
|
66
67
|
Faraday.new do |builder|
|
68
|
+
builder.response :raise_error
|
67
69
|
builder.adapter :test do |stubs|
|
68
70
|
stubs.delete(api_path) { stubbed_response }
|
69
71
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mackerel-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mackerel developer team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -101,6 +101,7 @@ files:
|
|
101
101
|
- lib/mackerel/client.rb
|
102
102
|
- lib/mackerel/client/helper.rb
|
103
103
|
- lib/mackerel/dashboard.rb
|
104
|
+
- lib/mackerel/error.rb
|
104
105
|
- lib/mackerel/host.rb
|
105
106
|
- lib/mackerel/invitation.rb
|
106
107
|
- lib/mackerel/metadata.rb
|
@@ -116,6 +117,7 @@ files:
|
|
116
117
|
- mackerel-client.gemspec
|
117
118
|
- spec/mackerel/alert_spec.rb
|
118
119
|
- spec/mackerel/annotation_spec.rb
|
120
|
+
- spec/mackerel/api_commend_spec.rb
|
119
121
|
- spec/mackerel/channel_spec.rb
|
120
122
|
- spec/mackerel/client/helper_spec.rb
|
121
123
|
- spec/mackerel/client_spec.rb
|
@@ -149,13 +151,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
151
|
version: '0'
|
150
152
|
requirements: []
|
151
153
|
rubyforge_project:
|
152
|
-
rubygems_version: 2.
|
154
|
+
rubygems_version: 2.5.2
|
153
155
|
signing_key:
|
154
156
|
specification_version: 4
|
155
157
|
summary: Mackerel client implemented by Ruby.
|
156
158
|
test_files:
|
157
159
|
- spec/mackerel/alert_spec.rb
|
158
160
|
- spec/mackerel/annotation_spec.rb
|
161
|
+
- spec/mackerel/api_commend_spec.rb
|
159
162
|
- spec/mackerel/channel_spec.rb
|
160
163
|
- spec/mackerel/client/helper_spec.rb
|
161
164
|
- spec/mackerel/client_spec.rb
|