redphone 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.org +9 -0
- data/lib/redphone/pagerduty.rb +2 -2
- data/lib/redphone/version.rb +1 -1
- data/test/pagerduty_test.rb +3 -6
- metadata +8 -7
data/.gitignore
CHANGED
data/README.org
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
* Redphone, the monitoring service ruby library
|
2
2
|
- Pagerduty support (integration, incidents)
|
3
|
+
[[https://github.com/portertech/redphone/raw/master/redphone.jpg]]
|
3
4
|
* Getting started
|
4
5
|
: gem install redphone
|
5
6
|
* Examples
|
6
7
|
** Pagerduty
|
8
|
+
: require "redphone/pagerduty"
|
7
9
|
: pagerduty = Redphone::Pagerduty.new(:service_key => SERVICE_KEY)
|
8
10
|
Trigger an incident
|
9
11
|
: pagerduty.trigger_incident(:description => "Testing Redphone Rubygem.", :incident_key => "redphone/test")
|
@@ -16,3 +18,10 @@
|
|
16
18
|
: :password => PASSWORD,
|
17
19
|
: :incident_key => "redphone/test"
|
18
20
|
: )
|
21
|
+
You can add the following options for a date range
|
22
|
+
: :since => "2011-08-01",
|
23
|
+
: :until => "2011-10-01"
|
24
|
+
Or if you only care about unresolved incidents
|
25
|
+
: :status => "triggered,acknowledged"
|
26
|
+
* Contributors
|
27
|
+
- [[http://portertech.ca][Sean Porter]]
|
data/lib/redphone/pagerduty.rb
CHANGED
@@ -14,7 +14,7 @@ module Redphone
|
|
14
14
|
:uri => "https://events.pagerduty.com/generic/2010-04-15/create_event.json",
|
15
15
|
:body => request_body.merge({:service_key => @service_key}).to_json
|
16
16
|
)
|
17
|
-
response.body
|
17
|
+
JSON.parse(response.body)
|
18
18
|
end
|
19
19
|
|
20
20
|
def trigger_incident(options={})
|
@@ -42,7 +42,7 @@ module Redphone
|
|
42
42
|
:ssl => true,
|
43
43
|
:uri => "https://#{options[:subdomain]}.pagerduty.com/api/v1/incidents?#{params}"
|
44
44
|
)
|
45
|
-
response.body
|
45
|
+
JSON.parse(response.body)
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
data/lib/redphone/version.rb
CHANGED
data/test/pagerduty_test.rb
CHANGED
@@ -16,25 +16,22 @@ class TestRedphonePagerduty < MiniTest::Unit::TestCase
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def test_trigger_incident
|
19
|
-
|
20
|
-
response = JSON.parse(trigger)
|
19
|
+
response = @pagerduty.trigger_incident(:description => "Testing Redphone Rubygem.", :incident_key => "redphone/test")
|
21
20
|
assert_equal 'success', response['status']
|
22
21
|
end
|
23
22
|
|
24
23
|
def test_resolve_incident
|
25
|
-
|
26
|
-
response = JSON.parse(resolve)
|
24
|
+
response = @pagerduty.resolve_incident(:incident_key => "redphone/test")
|
27
25
|
assert_equal 'success', response['status']
|
28
26
|
end
|
29
27
|
|
30
28
|
def test_incidents
|
31
|
-
|
29
|
+
response = Redphone::Pagerduty.incidents(
|
32
30
|
:subdomain => SUBDOMAIN,
|
33
31
|
:user => USER,
|
34
32
|
:password => PASSWORD,
|
35
33
|
:incident_key => "redphone/test"
|
36
34
|
)
|
37
|
-
response = JSON.parse(incidents)
|
38
35
|
assert response['total'] > 0
|
39
36
|
end
|
40
37
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redphone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-10-08 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|
16
|
-
requirement: &
|
16
|
+
requirement: &70118051461720 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70118051461720
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &70118051461080 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70118051461080
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: minitest
|
38
|
-
requirement: &
|
38
|
+
requirement: &70118051460460 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70118051460460
|
47
47
|
description: A rubygem for talking to monitoring service APIs
|
48
48
|
email:
|
49
49
|
- portertech@gmail.com
|
@@ -60,6 +60,7 @@ files:
|
|
60
60
|
- lib/redphone/pagerduty.rb
|
61
61
|
- lib/redphone/version.rb
|
62
62
|
- redphone.gemspec
|
63
|
+
- redphone.jpg
|
63
64
|
- test/pagerduty_test.rb
|
64
65
|
homepage: https://github.com/portertech/redphone
|
65
66
|
licenses: []
|