giraffi 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.yardopts +7 -0
- data/Gemfile +10 -0
- data/HISTORY.md +6 -0
- data/LICENSE.md +20 -0
- data/README.md +114 -0
- data/Rakefile +53 -0
- data/VERSION +1 -0
- data/examples/setup_http_monitoring.rb +88 -0
- data/giraffi.gemspec +155 -0
- data/lib/giraffi/client/applogs.rb +25 -0
- data/lib/giraffi/client/axions.rb +96 -0
- data/lib/giraffi/client/items.rb +102 -0
- data/lib/giraffi/client/logs.rb +23 -0
- data/lib/giraffi/client/media.rb +67 -0
- data/lib/giraffi/client/monitoringdata.rb +25 -0
- data/lib/giraffi/client/my_current_status.rb +19 -0
- data/lib/giraffi/client/regions.rb +15 -0
- data/lib/giraffi/client/services.rb +97 -0
- data/lib/giraffi/client/trends.rb +25 -0
- data/lib/giraffi/client/triggers.rb +94 -0
- data/lib/giraffi/client.rb +73 -0
- data/lib/giraffi/config.rb +60 -0
- data/lib/giraffi/version.rb +3 -0
- data/lib/giraffi.rb +26 -0
- data/test/applogs_test.rb +55 -0
- data/test/axions_test.rb +149 -0
- data/test/client_test.rb +52 -0
- data/test/fixtures/add_applogs_success_response.json +3 -0
- data/test/fixtures/add_monitroingdata.json +1 -0
- data/test/fixtures/add_service_to_item.json +12 -0
- data/test/fixtures/add_trigger_to_service.json +1 -0
- data/test/fixtures/create_axion.json +1 -0
- data/test/fixtures/create_item.json +15 -0
- data/test/fixtures/create_medium.json +1 -0
- data/test/fixtures/find_applogs_with_no_param.json +11 -0
- data/test/fixtures/find_applogs_with_params.json +2 -0
- data/test/fixtures/find_average_trends.json +6 -0
- data/test/fixtures/find_axion_by_id.json +9 -0
- data/test/fixtures/find_axion_by_trigger.json +11 -0
- data/test/fixtures/find_axion_logs_with_no_param.json +6 -0
- data/test/fixtures/find_axion_logs_with_params.json +5 -0
- data/test/fixtures/find_axions_by_trigger_with_axionkind.json +1 -0
- data/test/fixtures/find_axions_by_trigger_without_axionkind.json +1 -0
- data/test/fixtures/find_axions_with_no_param.json +1 -0
- data/test/fixtures/find_axions_with_params.json +11 -0
- data/test/fixtures/find_failure_trends.json +1 -0
- data/test/fixtures/find_item_by_id.json +15 -0
- data/test/fixtures/find_items_with_no_param.json +77 -0
- data/test/fixtures/find_items_with_params.json +17 -0
- data/test/fixtures/find_media_by_axion.json +13 -0
- data/test/fixtures/find_media_with_no_param.json +22 -0
- data/test/fixtures/find_media_with_params.json +1 -0
- data/test/fixtures/find_medium_by_id.json +1 -0
- data/test/fixtures/find_monitoringdata_with_no_param.json +4 -0
- data/test/fixtures/find_monitoringdata_with_params.json +3 -0
- data/test/fixtures/find_region_by_service.json +1 -0
- data/test/fixtures/find_regions.json +1 -0
- data/test/fixtures/find_service_by_id.json +12 -0
- data/test/fixtures/find_service_by_item_with_params.json +14 -0
- data/test/fixtures/find_services_by_item_with_no_param.json +14 -0
- data/test/fixtures/find_services_with_no_param.json +38 -0
- data/test/fixtures/find_services_with_params.json +14 -0
- data/test/fixtures/find_trigger_by_id.json +12 -0
- data/test/fixtures/find_triggers_by_service.json +1 -0
- data/test/fixtures/find_triggers_with_no_param.json +34 -0
- data/test/fixtures/find_triggers_with_params.json +14 -0
- data/test/fixtures/my_current_status_about_fake_uri.json +6 -0
- data/test/fixtures/my_current_status_about_real_uri.json +6 -0
- data/test/giraffi_test.rb +14 -0
- data/test/items_test.rb +170 -0
- data/test/logs_test.rb +60 -0
- data/test/media_test.rb +104 -0
- data/test/monitoringdata_test.rb +53 -0
- data/test/my_current_status_test.rb +29 -0
- data/test/regions_test.rb +20 -0
- data/test/services_test.rb +166 -0
- data/test/test_helper.rb +40 -0
- data/test/trends_test.rb +35 -0
- data/test/triggers_test.rb +151 -0
- metadata +271 -0
@@ -0,0 +1,166 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class ServicesTest < Test::Unit::TestCase
|
4
|
+
context "Testing Giraffi Ruby Gem for the Giraffi RESTful" do
|
5
|
+
setup do
|
6
|
+
@item_id = 3681
|
7
|
+
@service_id = 17972
|
8
|
+
@region_code = 'JP'
|
9
|
+
@trigger_id = '123'
|
10
|
+
|
11
|
+
@trigger_attrs = {
|
12
|
+
triggertype: "timeout",
|
13
|
+
axioninterval: "180",
|
14
|
+
options: {
|
15
|
+
time: "3"
|
16
|
+
}
|
17
|
+
}
|
18
|
+
|
19
|
+
@service_attrs = {
|
20
|
+
status: "0"
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'about the API related to the services' do
|
25
|
+
should 'return successfully the desired services with no param' do
|
26
|
+
stub_request(:get, "#{Giraffi.endpoint}/services.json?apikey=#{apikey}").
|
27
|
+
with(:query => {}, headers: Giraffi.request_headers).
|
28
|
+
to_return(body: fixture("find_services_with_no_param.json"), headers: Giraffi.request_headers)
|
29
|
+
|
30
|
+
giraffi = Giraffi.new({apikey: apikey})
|
31
|
+
response = giraffi.find_services({})
|
32
|
+
assert response.ok?
|
33
|
+
assert_equal JSON.parse(response.body).size, 3
|
34
|
+
end
|
35
|
+
|
36
|
+
should 'return successfully the desired service with params' do
|
37
|
+
stub_request(:get, "#{Giraffi.endpoint}/services.json?apikey=#{apikey}").
|
38
|
+
with(:query => {:item_id => @item_id.to_s}, headers: Giraffi.request_headers).
|
39
|
+
to_return(body: fixture("find_services_with_params.json"))
|
40
|
+
|
41
|
+
giraffi = Giraffi.new({apikey: apikey})
|
42
|
+
response = giraffi.find_services({item_id: "#{@item_id}"})
|
43
|
+
assert response.ok?
|
44
|
+
assert_equal JSON.parse(response.body)[0]['service']['item_id'], @item_id
|
45
|
+
end
|
46
|
+
|
47
|
+
should 'return successfully the desired service by the numerical ID' do
|
48
|
+
stub_request(:get, "#{Giraffi.endpoint}/services/#{@service_id}.json?apikey=#{apikey}").
|
49
|
+
with(headers: Giraffi.request_headers).
|
50
|
+
to_return(body: fixture("find_service_by_id.json"))
|
51
|
+
|
52
|
+
giraffi = Giraffi.new({apikey: apikey})
|
53
|
+
response = giraffi.find_service(@service_id)
|
54
|
+
assert response.ok?
|
55
|
+
assert_equal JSON.parse(response.body)['service']['id'], @service_id
|
56
|
+
end
|
57
|
+
|
58
|
+
should 'return successfully the region related to the service' do
|
59
|
+
stub_request(:get, "#{Giraffi.endpoint}/services/#{@service_id}/regions.json?apikey=#{apikey}").
|
60
|
+
with(headers: Giraffi.request_headers).
|
61
|
+
to_return(body: fixture("find_region_by_service.json"))
|
62
|
+
|
63
|
+
giraffi = Giraffi.new({apikey: apikey})
|
64
|
+
response = giraffi.find_region_by_service(@service_id)
|
65
|
+
assert response.ok?
|
66
|
+
assert_equal @region_code, JSON.parse(response.body)[0]['region']['code']
|
67
|
+
end
|
68
|
+
|
69
|
+
should 'return successfully the triggers related to the service' do
|
70
|
+
stub_request(:get, "#{Giraffi.endpoint}/services/#{@service_id}/triggers.json?apikey=#{apikey}").
|
71
|
+
with(headers: Giraffi.request_headers).
|
72
|
+
to_return(body: fixture("find_triggers_by_service.json"))
|
73
|
+
|
74
|
+
giraffi = Giraffi.new({apikey: apikey})
|
75
|
+
response = giraffi.find_triggers_by_service(@service_id)
|
76
|
+
assert response.ok?
|
77
|
+
assert_equal JSON.parse(response.body)[0]['trigger']['triggertype'], 'timeout'
|
78
|
+
end
|
79
|
+
|
80
|
+
should 'add successfully a trigger to the desired service' do
|
81
|
+
stub_request(:post, "#{Giraffi.endpoint}/services/#{@service_id}/triggers.json?apikey=#{apikey}").
|
82
|
+
with(:query => {:trigger => @trigger_attrs}, headers: Giraffi.request_headers).
|
83
|
+
to_return(body: fixture("add_trigger_to_service.json"))
|
84
|
+
|
85
|
+
giraffi = Giraffi.new({apikey: apikey})
|
86
|
+
response = giraffi.add_trigger_to_service(@service_id, @trigger_attrs)
|
87
|
+
assert response.ok?
|
88
|
+
assert_equal JSON.parse(response.body)['trigger']['triggertype'], 'timeout'
|
89
|
+
end
|
90
|
+
|
91
|
+
should 'update successfully the desired service' do
|
92
|
+
stub_request(:put, "#{Giraffi.endpoint}/services/#{@service_id}.json?apikey=#{apikey}").
|
93
|
+
with(:body => {}, :query => {:service => @service_attrs}, headers: Giraffi.request_headers).
|
94
|
+
to_return(body: {})
|
95
|
+
|
96
|
+
giraffi = Giraffi.new({apikey: apikey})
|
97
|
+
response = giraffi.update_service(@service_id, @service_attrs)
|
98
|
+
assert response.ok?
|
99
|
+
assert response.body == {}
|
100
|
+
end
|
101
|
+
|
102
|
+
should 'update successfully the region related to the service' do
|
103
|
+
stub_request(:put, "#{Giraffi.endpoint}/services/#{@service_id}/regions/JP.json?apikey=#{apikey}").
|
104
|
+
with(:body => {}, headers: Giraffi.request_headers).
|
105
|
+
to_return(body: {})
|
106
|
+
|
107
|
+
giraffi = Giraffi.new({apikey: apikey})
|
108
|
+
response = giraffi.update_region_of_service(@service_id, 'JP')
|
109
|
+
assert_nothing_raised ArgumentError do
|
110
|
+
giraffi.update_region_of_service(@service_id, 'JP')
|
111
|
+
end
|
112
|
+
assert response.ok?
|
113
|
+
assert response.body == {}
|
114
|
+
end
|
115
|
+
|
116
|
+
should 'raise an error when the number of arguments for `update_region_of_service` is not 2' do
|
117
|
+
giraffi = Giraffi.new({apikey: apikey})
|
118
|
+
assert_raise ArgumentError do
|
119
|
+
giraffi.update_region_of_service(@service_id)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
should 'not update the region related to the service with unknown regions code' do
|
124
|
+
stub_request(:put, "#{Giraffi.endpoint}/services/#{@service_id}/regions/US.json?apikey=#{apikey}").
|
125
|
+
with(:body => {}, headers: Giraffi.request_headers).
|
126
|
+
to_return(body: '{"error":"This id is not found."}')
|
127
|
+
|
128
|
+
giraffi = Giraffi.new({apikey: apikey})
|
129
|
+
response = giraffi.update_region_of_service(@service_id, 'US')
|
130
|
+
assert response.ok?
|
131
|
+
assert_equal JSON.parse(response.body)['error'], "This id is not found."
|
132
|
+
end
|
133
|
+
|
134
|
+
should 'delete successfully the service' do
|
135
|
+
stub_request(:delete, "#{Giraffi.endpoint}/services/#{@service_id}.json?apikey=#{apikey}").
|
136
|
+
to_return(:status => 200, :body => {})
|
137
|
+
|
138
|
+
giraffi = Giraffi.new({apikey: apikey})
|
139
|
+
response = giraffi.destroy_service(@service_id)
|
140
|
+
assert response.ok?
|
141
|
+
assert response.body == {}
|
142
|
+
end
|
143
|
+
|
144
|
+
should 'remove successfully a trigger from the service' do
|
145
|
+
stub_request(:delete, "#{Giraffi.endpoint}/services/#{@service_id}/triggers/#{@trigger_id}.json?apikey=#{apikey}").
|
146
|
+
to_return(:body => {})
|
147
|
+
|
148
|
+
giraffi = Giraffi.new({apikey: apikey})
|
149
|
+
response = giraffi.remove_trigger_from_service(@service_id, @trigger_id)
|
150
|
+
assert_nothing_raised ArgumentError do
|
151
|
+
giraffi.remove_trigger_from_service(@service_id, @trigger_id)
|
152
|
+
end
|
153
|
+
assert response.ok?
|
154
|
+
assert response.body == {}
|
155
|
+
end
|
156
|
+
|
157
|
+
should 'raise an error when the number of arguments for `remove_trigger_from_service` is not 2' do
|
158
|
+
giraffi = Giraffi.new({apikey: apikey})
|
159
|
+
assert_raise ArgumentError do
|
160
|
+
giraffi.remove_trigger_from_service(@service_id)
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
end
|
166
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
|
4
|
+
begin
|
5
|
+
Bundler.setup(:default, :development)
|
6
|
+
rescue Bundler::BundlerError => e
|
7
|
+
$stderr.puts e.message
|
8
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
9
|
+
exit e.status_code
|
10
|
+
end
|
11
|
+
|
12
|
+
require 'test/unit'
|
13
|
+
require 'json'
|
14
|
+
require 'shoulda'
|
15
|
+
require 'webmock/test_unit'
|
16
|
+
require 'vcr'
|
17
|
+
|
18
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
19
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
20
|
+
|
21
|
+
# VCR that records the test suite's HTTP interactions and replay them
|
22
|
+
VCR.config do |c|
|
23
|
+
c.cassette_library_dir = 'test/fixtures/vcr_cassettes'
|
24
|
+
c.stub_with :webmock
|
25
|
+
end
|
26
|
+
|
27
|
+
require 'giraffi'
|
28
|
+
|
29
|
+
def fixture(filename)
|
30
|
+
return '' if filename == ''
|
31
|
+
file_path = File.expand_path(File.dirname(__FILE__) + '/fixtures/' + filename)
|
32
|
+
File.read(file_path)
|
33
|
+
end
|
34
|
+
|
35
|
+
def apikey
|
36
|
+
'test_key'
|
37
|
+
end
|
38
|
+
|
39
|
+
class Test::Unit::TestCase
|
40
|
+
end
|
data/test/trends_test.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class TrendsTest < Test::Unit::TestCase
|
4
|
+
context "Testing Giraffi Ruby Gem for the Giraffi RESTful" do
|
5
|
+
setup do
|
6
|
+
@service_id = 17972
|
7
|
+
end
|
8
|
+
|
9
|
+
context 'about the API related to the trend data' do
|
10
|
+
should 'return the trend data about `average` related to the given service id' do
|
11
|
+
stub_request(:get, "#{Giraffi.endpoint}/trends/average.json?apikey=#{apikey}").
|
12
|
+
with(query: {service_id: @service_id.to_s}, headers: Giraffi.request_headers).
|
13
|
+
to_return(body: fixture('find_average_trends.json'))
|
14
|
+
|
15
|
+
giraffi = Giraffi.new({apikey: apikey})
|
16
|
+
response = giraffi.find_average_trends({service_id: @service_id.to_s})
|
17
|
+
assert response.ok?
|
18
|
+
assert_equal JSON.parse(response.body).size, 4
|
19
|
+
end
|
20
|
+
|
21
|
+
should 'return the trend data about `failure` related to the given service id' do
|
22
|
+
stub_request(:get, "#{Giraffi.endpoint}/trends/failure.json?apikey=#{apikey}").
|
23
|
+
with(query: {service_id: @service_id.to_s}, headers: Giraffi.request_headers).
|
24
|
+
to_return(body: fixture('find_failure_trends.json'))
|
25
|
+
|
26
|
+
giraffi = Giraffi.new({apikey: apikey})
|
27
|
+
response = giraffi.find_failure_trends({service_id: @service_id.to_s})
|
28
|
+
assert response.ok?
|
29
|
+
assert_equal JSON.parse(response.body).size, 2
|
30
|
+
assert_equal JSON.parse(response.body)[0]['failed_time'], 4515
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,151 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class TriggersGiraffi < Test::Unit::TestCase
|
4
|
+
context "Testing Giraffi Ruby Gem for the Giraffi RESTful" do
|
5
|
+
setup do
|
6
|
+
@axion_id = '425'
|
7
|
+
@trigger_id = '123'
|
8
|
+
end
|
9
|
+
|
10
|
+
context 'about the API related to the triggers' do
|
11
|
+
should 'return successfully the desired triggers with no param' do
|
12
|
+
stub_request(:get, "#{Giraffi.endpoint}/triggers.json?apikey=#{apikey}").
|
13
|
+
with(headers: Giraffi.request_headers).
|
14
|
+
to_return(body: fixture("find_triggers_with_no_param.json"))
|
15
|
+
|
16
|
+
giraffi = Giraffi.new({apikey: apikey})
|
17
|
+
response = giraffi.find_triggers
|
18
|
+
assert response.ok?
|
19
|
+
assert_equal JSON.parse(response.body).size, 3
|
20
|
+
assert_equal JSON.parse(response.body)[0]['trigger']['triggertype'], "timeout"
|
21
|
+
end
|
22
|
+
|
23
|
+
should 'return successfully the desired triggers with params' do
|
24
|
+
stub_request(:get, "#{Giraffi.endpoint}/triggers.json?apikey=#{apikey}").
|
25
|
+
with(query: {triggertype: "traffic"}, headers: Giraffi.request_headers).
|
26
|
+
to_return(body: fixture("find_triggers_with_params.json"))
|
27
|
+
|
28
|
+
giraffi = Giraffi.new({apikey: apikey})
|
29
|
+
response = giraffi.find_triggers({triggertype: "traffic"})
|
30
|
+
assert response.ok?
|
31
|
+
assert_equal JSON.parse(response.body).size, 1
|
32
|
+
assert_equal JSON.parse(response.body)[0]['trigger']['triggertype'], "traffic"
|
33
|
+
end
|
34
|
+
|
35
|
+
should 'return successfully the desired trigger by the numerical ID' do
|
36
|
+
stub_request(:get, "#{Giraffi.endpoint}/triggers/#{@trigger_id}.json?apikey=#{apikey}").
|
37
|
+
with(headers: Giraffi.request_headers).
|
38
|
+
to_return(body: fixture("find_trigger_by_id.json"))
|
39
|
+
|
40
|
+
giraffi = Giraffi.new({apikey: apikey})
|
41
|
+
response = giraffi.find_trigger(@trigger_id)
|
42
|
+
assert response.ok?
|
43
|
+
assert_equal JSON.parse(response.body).size, 1
|
44
|
+
assert_equal JSON.parse(response.body)['trigger']['id'], @trigger_id.to_i
|
45
|
+
end
|
46
|
+
|
47
|
+
should 'return successfully the axions related to the trigger without the `axionkind` param' do
|
48
|
+
stub_request(:get, "#{Giraffi.endpoint}/triggers/#{@trigger_id}/axions.json?apikey=#{apikey}").
|
49
|
+
with(headers: Giraffi.request_headers).
|
50
|
+
to_return(body: fixture("find_axions_by_trigger_without_axionkind.json"))
|
51
|
+
|
52
|
+
giraffi = Giraffi.new({apikey: apikey})
|
53
|
+
response = giraffi.find_axions_by_trigger(@trigger_id)
|
54
|
+
assert response.ok?
|
55
|
+
assert_equal JSON.parse(response.body).size, 1
|
56
|
+
assert_equal JSON.parse(response.body)[0]['axion']['id'], @axion_id.to_i
|
57
|
+
end
|
58
|
+
|
59
|
+
should 'return successfully the axions related to the trigger with the `axionkind` param' do
|
60
|
+
stub_request(:get, "#{Giraffi.endpoint}/triggers/#{@trigger_id}/axions.json?apikey=#{apikey}").
|
61
|
+
with(:query => {axionkind: "problem"}, headers: Giraffi.request_headers).
|
62
|
+
to_return(body: fixture("find_axions_by_trigger_with_axionkind.json"))
|
63
|
+
|
64
|
+
giraffi = Giraffi.new({apikey: apikey})
|
65
|
+
response = giraffi.find_axions_by_trigger(@trigger_id, "problem")
|
66
|
+
assert response.ok?
|
67
|
+
assert_equal JSON.parse(response.body).size, 1
|
68
|
+
assert_equal JSON.parse(response.body)[0]['axion']['id'], @axion_id.to_i
|
69
|
+
end
|
70
|
+
|
71
|
+
should 'raise an error when no argument is given to `find_axions_by_trigger`' do
|
72
|
+
giraffi = Giraffi.new({apikey: apikey})
|
73
|
+
assert_raise ArgumentError do
|
74
|
+
giraffi.find_axions_by_trigger
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
should 'execute successfully all the axions related to the triggers' do
|
79
|
+
stub_request(:post, "#{Giraffi.endpoint}/triggers/#{@trigger_id}/axions/execute.json?apikey=#{apikey}").
|
80
|
+
with(headers: Giraffi.request_headers).
|
81
|
+
to_return(status: 200, body: "[#{@axion_id}]\n")
|
82
|
+
|
83
|
+
giraffi = Giraffi.new({apikey: apikey})
|
84
|
+
response = giraffi.execute_axions_by_trigger(@trigger_id)
|
85
|
+
assert response.ok?
|
86
|
+
assert_equal response.body, "[#{@axion_id}]\n"
|
87
|
+
end
|
88
|
+
|
89
|
+
should 'update successfully the desired trigger' do
|
90
|
+
stub_request(:put, "#{Giraffi.endpoint}/triggers/#{@trigger_id}.json?apikey=#{apikey}").
|
91
|
+
with(body: {}, query: {trigger: {options: {time: "10"}}}, headers: Giraffi.request_headers).
|
92
|
+
to_return(status: 200, body: {})
|
93
|
+
|
94
|
+
giraffi = Giraffi.new({apikey: apikey})
|
95
|
+
response = giraffi.update_trigger(@trigger_id, {options: {time: "10"}})
|
96
|
+
assert response.ok?
|
97
|
+
assert response.body == {}
|
98
|
+
end
|
99
|
+
|
100
|
+
should 'update successfully the axion related to the trigger' do
|
101
|
+
stub_request(:put, "#{Giraffi.endpoint}/triggers/#{@trigger_id}/axions/#{@axion_id}.json?apikey=#{apikey}").
|
102
|
+
with(body: {}, query: { axionkind: "recovery" }, headers: Giraffi.request_headers).
|
103
|
+
to_return(status: 204, body: {})
|
104
|
+
|
105
|
+
giraffi = Giraffi.new({apikey: apikey})
|
106
|
+
response = giraffi.update_axion_of_trigger(@trigger_id, @axion_id, "recovery")
|
107
|
+
assert_equal response.code, 204
|
108
|
+
assert response.body == {}
|
109
|
+
end
|
110
|
+
|
111
|
+
should 'raise an error when the number of arguments for `update_axion_of_trigger` is not 3' do
|
112
|
+
giraffi = Giraffi.new({apikey: apikey})
|
113
|
+
assert_raise ArgumentError do
|
114
|
+
giraffi.update_axion_of_trigger(@trigger_id)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
should 'delete successfully the trigger' do
|
119
|
+
stub_request(:delete, "#{Giraffi.endpoint}/triggers/#{@trigger_id}.json?apikey=#{apikey}").
|
120
|
+
to_return(:status => 200, :body => {})
|
121
|
+
|
122
|
+
giraffi = Giraffi.new({apikey: apikey})
|
123
|
+
response = giraffi.destroy_trigger(@trigger_id)
|
124
|
+
assert response.ok?
|
125
|
+
assert response.body == {}
|
126
|
+
end
|
127
|
+
|
128
|
+
should 'remove successfully a axion from the trigger' do
|
129
|
+
stub_request(:delete, "#{Giraffi.endpoint}/triggers/#{@trigger_id}/axions/#{@axion_id}.json?apikey=#{apikey}").
|
130
|
+
with(headers: Giraffi.request_headers).
|
131
|
+
to_return(status: 200, body: {})
|
132
|
+
|
133
|
+
giraffi = Giraffi.new({apikey: apikey})
|
134
|
+
response = giraffi.remove_axion_from_trigger(@trigger_id, @axion_id)
|
135
|
+
assert_nothing_raised ArgumentError do
|
136
|
+
giraffi.remove_axion_from_trigger(@trigger_id, @axion_id)
|
137
|
+
end
|
138
|
+
assert response.ok?
|
139
|
+
assert response.body == {}
|
140
|
+
end
|
141
|
+
|
142
|
+
should 'raise an error when the number of arguments for `remove_axion_from_trigger` is not 2' do
|
143
|
+
giraffi = Giraffi.new({apikey: apikey})
|
144
|
+
assert_raise ArgumentError do
|
145
|
+
giraffi.remove_axion_from_trigger(@trigger_id)
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
end
|
151
|
+
end
|
metadata
ADDED
@@ -0,0 +1,271 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: giraffi
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.3
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- azukiwasher
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-12-09 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: multi_json
|
16
|
+
requirement: &8288920 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *8288920
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: httparty
|
27
|
+
requirement: &8287840 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0.8'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *8287840
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: shoulda
|
38
|
+
requirement: &8286500 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *8286500
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: jeweler
|
49
|
+
requirement: &8284200 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *8284200
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: bundler
|
60
|
+
requirement: &8281420 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *8281420
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rcov
|
71
|
+
requirement: &8278720 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *8278720
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: webmock
|
82
|
+
requirement: &8275780 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *8275780
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: vcr
|
93
|
+
requirement: &8273500 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
type: :development
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *8273500
|
102
|
+
- !ruby/object:Gem::Dependency
|
103
|
+
name: turn
|
104
|
+
requirement: &9239140 !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: *9239140
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: watchr
|
115
|
+
requirement: &9303940 !ruby/object:Gem::Requirement
|
116
|
+
none: false
|
117
|
+
requirements:
|
118
|
+
- - ! '>='
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
type: :development
|
122
|
+
prerelease: false
|
123
|
+
version_requirements: *9303940
|
124
|
+
- !ruby/object:Gem::Dependency
|
125
|
+
name: rb-fsevent
|
126
|
+
requirement: &9317760 !ruby/object:Gem::Requirement
|
127
|
+
none: false
|
128
|
+
requirements:
|
129
|
+
- - ! '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: *9317760
|
135
|
+
- !ruby/object:Gem::Dependency
|
136
|
+
name: redcarpet
|
137
|
+
requirement: &9328160 !ruby/object:Gem::Requirement
|
138
|
+
none: false
|
139
|
+
requirements:
|
140
|
+
- - ! '>='
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
type: :development
|
144
|
+
prerelease: false
|
145
|
+
version_requirements: *9328160
|
146
|
+
- !ruby/object:Gem::Dependency
|
147
|
+
name: yard
|
148
|
+
requirement: &10160740 !ruby/object:Gem::Requirement
|
149
|
+
none: false
|
150
|
+
requirements:
|
151
|
+
- - ! '>='
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0'
|
154
|
+
type: :development
|
155
|
+
prerelease: false
|
156
|
+
version_requirements: *10160740
|
157
|
+
description: A Ruby wrapper for the Giraffi API
|
158
|
+
email: azukiwasher@yahoo.co.jp
|
159
|
+
executables: []
|
160
|
+
extensions: []
|
161
|
+
extra_rdoc_files:
|
162
|
+
- LICENSE.md
|
163
|
+
- README.md
|
164
|
+
files:
|
165
|
+
- .document
|
166
|
+
- .yardopts
|
167
|
+
- Gemfile
|
168
|
+
- HISTORY.md
|
169
|
+
- LICENSE.md
|
170
|
+
- README.md
|
171
|
+
- Rakefile
|
172
|
+
- VERSION
|
173
|
+
- examples/setup_http_monitoring.rb
|
174
|
+
- giraffi.gemspec
|
175
|
+
- lib/giraffi.rb
|
176
|
+
- lib/giraffi/client.rb
|
177
|
+
- lib/giraffi/client/applogs.rb
|
178
|
+
- lib/giraffi/client/axions.rb
|
179
|
+
- lib/giraffi/client/items.rb
|
180
|
+
- lib/giraffi/client/logs.rb
|
181
|
+
- lib/giraffi/client/media.rb
|
182
|
+
- lib/giraffi/client/monitoringdata.rb
|
183
|
+
- lib/giraffi/client/my_current_status.rb
|
184
|
+
- lib/giraffi/client/regions.rb
|
185
|
+
- lib/giraffi/client/services.rb
|
186
|
+
- lib/giraffi/client/trends.rb
|
187
|
+
- lib/giraffi/client/triggers.rb
|
188
|
+
- lib/giraffi/config.rb
|
189
|
+
- lib/giraffi/version.rb
|
190
|
+
- test/applogs_test.rb
|
191
|
+
- test/axions_test.rb
|
192
|
+
- test/client_test.rb
|
193
|
+
- test/fixtures/add_applogs_success_response.json
|
194
|
+
- test/fixtures/add_monitroingdata.json
|
195
|
+
- test/fixtures/add_service_to_item.json
|
196
|
+
- test/fixtures/add_trigger_to_service.json
|
197
|
+
- test/fixtures/create_axion.json
|
198
|
+
- test/fixtures/create_item.json
|
199
|
+
- test/fixtures/create_medium.json
|
200
|
+
- test/fixtures/find_applogs_with_no_param.json
|
201
|
+
- test/fixtures/find_applogs_with_params.json
|
202
|
+
- test/fixtures/find_average_trends.json
|
203
|
+
- test/fixtures/find_axion_by_id.json
|
204
|
+
- test/fixtures/find_axion_by_trigger.json
|
205
|
+
- test/fixtures/find_axion_logs_with_no_param.json
|
206
|
+
- test/fixtures/find_axion_logs_with_params.json
|
207
|
+
- test/fixtures/find_axions_by_trigger_with_axionkind.json
|
208
|
+
- test/fixtures/find_axions_by_trigger_without_axionkind.json
|
209
|
+
- test/fixtures/find_axions_with_no_param.json
|
210
|
+
- test/fixtures/find_axions_with_params.json
|
211
|
+
- test/fixtures/find_failure_trends.json
|
212
|
+
- test/fixtures/find_item_by_id.json
|
213
|
+
- test/fixtures/find_items_with_no_param.json
|
214
|
+
- test/fixtures/find_items_with_params.json
|
215
|
+
- test/fixtures/find_media_by_axion.json
|
216
|
+
- test/fixtures/find_media_with_no_param.json
|
217
|
+
- test/fixtures/find_media_with_params.json
|
218
|
+
- test/fixtures/find_medium_by_id.json
|
219
|
+
- test/fixtures/find_monitoringdata_with_no_param.json
|
220
|
+
- test/fixtures/find_monitoringdata_with_params.json
|
221
|
+
- test/fixtures/find_region_by_service.json
|
222
|
+
- test/fixtures/find_regions.json
|
223
|
+
- test/fixtures/find_service_by_id.json
|
224
|
+
- test/fixtures/find_service_by_item_with_params.json
|
225
|
+
- test/fixtures/find_services_by_item_with_no_param.json
|
226
|
+
- test/fixtures/find_services_with_no_param.json
|
227
|
+
- test/fixtures/find_services_with_params.json
|
228
|
+
- test/fixtures/find_trigger_by_id.json
|
229
|
+
- test/fixtures/find_triggers_by_service.json
|
230
|
+
- test/fixtures/find_triggers_with_no_param.json
|
231
|
+
- test/fixtures/find_triggers_with_params.json
|
232
|
+
- test/fixtures/my_current_status_about_fake_uri.json
|
233
|
+
- test/fixtures/my_current_status_about_real_uri.json
|
234
|
+
- test/giraffi_test.rb
|
235
|
+
- test/items_test.rb
|
236
|
+
- test/logs_test.rb
|
237
|
+
- test/media_test.rb
|
238
|
+
- test/monitoringdata_test.rb
|
239
|
+
- test/my_current_status_test.rb
|
240
|
+
- test/regions_test.rb
|
241
|
+
- test/services_test.rb
|
242
|
+
- test/test_helper.rb
|
243
|
+
- test/trends_test.rb
|
244
|
+
- test/triggers_test.rb
|
245
|
+
homepage: http://github.com/giraffi/giraffi
|
246
|
+
licenses:
|
247
|
+
- MIT
|
248
|
+
post_install_message:
|
249
|
+
rdoc_options: []
|
250
|
+
require_paths:
|
251
|
+
- lib
|
252
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
253
|
+
none: false
|
254
|
+
requirements:
|
255
|
+
- - ! '>='
|
256
|
+
- !ruby/object:Gem::Version
|
257
|
+
version: '0'
|
258
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
259
|
+
none: false
|
260
|
+
requirements:
|
261
|
+
- - ! '>='
|
262
|
+
- !ruby/object:Gem::Version
|
263
|
+
version: '0'
|
264
|
+
requirements: []
|
265
|
+
rubyforge_project:
|
266
|
+
rubygems_version: 1.8.10
|
267
|
+
signing_key:
|
268
|
+
specification_version: 3
|
269
|
+
summary: A Ruby wrapper for the Giraffi API
|
270
|
+
test_files: []
|
271
|
+
has_rdoc:
|