Skip to content
Browse files

Initial Commit and Setup

  • Loading branch information...
0 parents commit ea94b9c6c43c95a7cc439130a049a13f1855aebc @aspires committed May 28, 2012
Showing with 65 additions and 0 deletions.
  1. +6 −0 .gitignore
  2. +1 −0 Gemfile
  3. +10 −0 README.md
  4. +40 −0 lib/pagerduty_incidents.rb
  5. +4 −0 pagerduty_incidents.gemspec
  6. +4 −0 test/pagerduty_incidents_test.rb
6 .gitignore
@@ -0,0 +1,6 @@
+#Redcar Editor
+.redcar
+./redcar
+
+#DS_Store
+.DS_Store
1 Gemfile
@@ -0,0 +1 @@
+gem "httparty", "~>0.8.3"
10 README.md
@@ -0,0 +1,10 @@
+# Pagerduty Incident Notification API Wrapper
+
+A Ruby Wrapper for [PagerDuty's Incident API](http://www.pagerduty.com/docs/rest-api/incidents).
+
+## Status: Incomplete
+
+Watch away for real-time updates as I move this along. It should be done relatively soon.
+
+You can also contact me directly at <austinspires@gmail.com>.
+
40 lib/pagerduty_incidents.rb
@@ -0,0 +1,40 @@
+require "httparty"
+require "pp"
+class Pagerduty
+ include HTTParty
+
+ def initialize(s,u,p)
+ # should pass in siteurl, username, and password
+ self.class.base_uri "#{s.strip}.pagerduty.com/api/v1"
+ self.class.basic_auth(u.strip, p.strip)
+ end
+
+ def incidents()
+ self.class.get("/incidents")["incidents"]
+ end
+
+ def unresolved
+ self.class.get("/incidents?status=unresolved")["incidents"]
+ end
+
+ def resolved
+ self.class.get("/incidents?status=resolved")["incidents"]
+ end
+end
+
+test = Pagerduty.new("aspires", "austinspires@gmail.com", "pagerdutypassword")
+
+test.incidents.each do |f|
+ pp f
+ puts "------incident-----------------"
+end
+
+test.unresolved.each do |d|
+ pp d
+ puts "------unresolved-------------------"
+end
+
+test.resolved.each do |r|
+ pp r
+ puts "------resolved----------------------------"
+end
4 pagerduty_incidents.gemspec
@@ -0,0 +1,4 @@
+Gem::Specification.new do |s|
+#TBD
+
+end
4 test/pagerduty_incidents_test.rb
@@ -0,0 +1,4 @@
+require_relative "../lib/pagerduty_incidents.rb"
+
+
+#Tests TBD

0 comments on commit ea94b9c

Please sign in to comment.
Something went wrong with that request. Please try again.