Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update gitignore

  • Loading branch information...
commit 661b6d6fa201c6055820e1117aa23269db459904 1 parent 3ee007c
Kyle Conroy kyleconroy authored
35 .gitignore
View
@@ -1,5 +1,30 @@
-*.pyc
-.DS_Store
-.project
-.pydevproject
-*~
+*.py[co]
+
+# Packages
+*.egg
+*.egg-info
+dist
+build
+eggs
+parts
+bin
+var
+sdist
+develop-eggs
+.installed.cfg
+
+# Installer logs
+pip-log.txt
+
+# Unit test / coverage reports
+.coverage
+.tox
+
+#Translations
+*.mo
+
+#Mr Developer
+.mr.developer.cfg
+
+#Sphnix
+docs/_build
80 docs/examples/stashboard.php
View
@@ -1,80 +0,0 @@
-<?php
-
- require_once('OAuth.php');
-
- $consumer_key = 'anonymous';
- $consumer_secret = 'anonymous';
- $oauth_key = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
- $oauth_secret = 'YYYYYYYYYYYYYYYYYYYYYYYY'
-
- $consumer = new OAuthConsumer($consumer_key, $consumer_secret);
- $token = new OAuthToken($oauth_key, $oauth_secret);
-
-
- // Set up a request function
- function request($consumer, $token, $url, $method = "GET", $data = null){
-
- $sign = new OAuthSignatureMethod_HMAC_SHA1();
- $request = OAuthRequest::from_consumer_and_token(
- $consumer, $token, $method, $url, $data);
- $request->sign_request($sign, $consumer, $token);
-
- $ch = curl_init($request->get_normalized_http_url());
-
- if ($method == "POST") {
- curl_setopt($ch, CURLOPT_POST ,1);
- curl_setopt($ch, CURLOPT_POSTFIELDS , $request->to_postdata());
- }
-
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION ,1);
- curl_setopt($ch, CURLOPT_HEADER ,0); // DO NOT RETURN HTTP HEADERS
-
- return curl_exec($ch);
- }
-
- // Fill in your website
- $base_url = "https://stashboard.appspot.com/api/v1";
-
- $data = array(
- "name" => "An Example Service",
- "description" => "An example service, created using the StashBoard API",
- );
-
- $r = request($consumer, $token, $base_url . "/services", "POST", $data);
- $service = json_decode($r);
-
- // GET the list of possible status images
- $r = request($consumer, $token, $base_url . "/status-images", "GET");
- $data = json_decode($r);
- $images = $data->images;
-
-
-
- // Pick a the first image
- $image = $images[0];
-
- // POST to the Statuses Resources to create a new Status
- $data = array(
- "name" => "Example Status",
- "description" => "An example status, means nothing",
- "severity" => 10000,
- "image" => $image->name,
- );
-
- $r = request($consumer, $token, $base_url . "/statuses", "POST", $data);
- $status = json_decode($r);
-
- // Create a new event with the given status and given service
- $data = array(
- "message" => "Our first event! So exciting",
- "status" => $status->id,
- );
-
- $r = request($consumer, $token, $service->url . "/events", "POST", $data);
- $event = json_decode($r);
-
- print_r($event);
-
-
142 docs/examples/stashboard.py
View
@@ -1,142 +0,0 @@
-import oauth2 as oauth
-import json
-import urllib
-import unittest
-
-oauth_key = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
-oauth_secret = 'YYYYYYYYYYYYYYYYYYYYYYYY'
-
-# Create your consumer with the proper key/secret.
-# If you register your application with google, these values won't be
-# anonymous and anonymous.
-consumer = oauth.Consumer(key='anonymous', secret='anonymous')
-token = oauth.Token(oauth_key, oauth_secret)
-
-# Fill in your website
-base_url = "https://stashboard.appspot.com/api/v1"
-
-# Create our client.
-client = oauth.Client(consumer, token=token)
-
-class ServicesTest(unittest.TestCase):
-
- def testMissingServiceName(self):
- "should return 400 Bad Data"
- data = urllib.urlencode({
- "description": "An example service API",
- })
-
- resp, content = client.request(base_url + "/services",
- "POST", body=data)
-
- self.assertEquals(resp.status, 400)
-
- def testMissingServiceDescription(self):
- "should return 400 Bad Data"
- data = urllib.urlencode({
- "name": "Some Random Name",
- })
-
- resp, content = client.request(base_url + "/services",
- "POST", body=data)
-
- self.assertEquals(resp.status, 400)
-
- def testMissingServiceData(self):
- "should return 400 Bad Data"
- resp, content = client.request(base_url + "/services", "POST")
- self.assertEquals(resp.status, 400)
-
- def testDelete(self):
- "should return 405 Method Not Allowed"
- resp, content = client.request(base_url + "/services", "DELETE")
- self.assertEquals(resp.status, 405)
-
- def testPut(self):
- "should return 411 Content Length Required"
- resp, content = client.request(base_url + "/services", "PUT")
- self.assertEquals(resp.status, 411)
-
- def testPutWithData(self):
- "should return 405 Method Not Allowed"
- data = urllib.urlencode({
- "name": "Some Random Name",
- })
- resp, content = client.request(base_url + "/services",
- "PUT", body=data)
- self.assertEquals(resp.status, 405)
-
- def testServiceLifeCycle(self):
- "should return 200 and a newly created status"
- data = urllib.urlencode({
- "name": "What a service",
- "description": "An example service API",
- })
-
- resp, content = client.request(base_url + "/services", "POST", body=data)
- service = json.loads(content)
-
- self.assertEquals(resp.status, 200)
- self.assertEquals(service["name"], "What a service")
- self.assertEquals(service["description"], "An example service API")
-
- resp, content = client.request(base_url + "/services/" + service["id"], "GET")
- service = json.loads(content)
-
- self.assertEquals(resp.status, 200)
- self.assertEquals(service["name"], "What a service")
- self.assertEquals(service["description"], "An example service API")
-
- # Update service
- data = urllib.urlencode({
- "description": "An example service API woohoo",
- })
-
- resp, content = client.request(base_url + "/services/" + service["id"],
- "POST", body=data)
- service = json.loads(content)
-
- self.assertEquals(resp.status, 200)
- self.assertEquals(service["name"], "What a service")
- self.assertEquals(service["description"], "An example service API woohoo")
-
- # Delete service
- resp, content = client.request(base_url + "/services/" + service["id"],
- "DELETE")
- service = json.loads(content)
-
- self.assertEquals(resp.status, 200)
- self.assertEquals(service["name"], "What a service")
- self.assertEquals(service["description"], "An example service API woohoo")
-
-if __name__ == '__main__':
- unittest.main()
-
-# GET the list of possible status images
-resp, content = client.request(base_url + "/status-images", "GET")
-data = json.loads(content)
-images = data["images"]
-
-# Pick a random image for our status
-image = images[0]
-
-# POST to the Statuses Resources to create a new Status
-data = urllib.urlencode({
- "name": "Example Status",
- "description": "An example status, means nothing",
- "severity": 10000,
- "image": image["name"],
-})
-
-resp, content = client.request(base_url + "/statuses", "POST", body=data)
-status = json.loads(content)
-
-# Create a new event with the given status and given service
-data = urllib.urlencode({
- "message": "Our first event! So exciting",
- "status": status["id"],
-})
-
-resp, content = client.request(service["url"] + "/events", "POST", body=data)
-event = json.loads(content)
-
50 docs/examples/stashboard.rb
View
@@ -1,50 +0,0 @@
-require 'rubygems'
-require 'oauth'
-require 'json'
-
-oauth_key = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
-oauth_secret = 'YYYYYYYYYYYYYYYYYYYYYYYY'
-
-# Fill in your website
-base = "https://stashboard.appspot.com"
-
-@consumer=OAuth::Consumer.new "anonymous",
- "anonymous",
- {:site=>base}
-
-@token = OAuth::AccessToken.new(@consumer, oauth_key, oauth_secret)
-
-# POST to the Services Resource to create a new service. Save the response for
-# later
-@response = @token.post("/api/v1/services", {
- :name => "An Example Service",
- :description => "An example service, created using the StashBoard API",
-})
-srvice = JSON.parse(@response.body)
-
-# GET the list of possible status images
-@response = @token.get("/api/v1/status-images")
-data = JSON.parse(@response.body)
-images = data['images']
-
-# Pick a random image for our status
-image = images[rand(images.length)]
-
-
-# POST to the Statuses Resources to create a new Status
-@response = @token.post("/api/v1/statuses", {
- :name => "Example Status",
- :description => "An example status, means nothing",
- :severity => 10000,
- :image => image["name"],
-})
-
-status = JSON.parse(@response.body)
-
-@response = @token.post("/api/v1/services/" + srvice["id"] + "/events", {
- :message => "Our first event! So exciting",
- :status => status["id"],
-})
-event = JSON.parse(@response.body)
-
-puts event
11 docs/examples/widget/example.html
View
@@ -1,11 +0,0 @@
-<!DOCTYPE html>
-<html>
-
- <head>
- <title>HellO!</title>
- <script type="text/javascript" src="../static/js/stashboard.js"></script>
- </head>
- <body>
- </body>
-
-</html>
35 docs/examples/widget/output.html
View
@@ -1,35 +0,0 @@
-<!DOCTYPE html>
-<html>
-
- <head>
- <title>HellO!</title>
- <style>
- #outer {
- position: absolute;
- top: 0px;
- height: 45px;
- right: 20px;
- padding: 0px 105px 0 15px;
- line-height: 45px;
- -moz-box-shadow: 0px 0px 8px rgb(204, 204, 204);
- -moz-border-radius-bottomleft: 15px;
- -moz-border-radius-bottomright: 15px;
- border-bottom: 1px solid #ccc;
- border-left: 1px solid #ccc;
- border-right: 1px solid #ccc;
- background: #eee;
- z-index: 99;
- }
- </style>
- </head>
- <body>
- <div id="outer">
- <img style="float: left; margin: 14px 15px 0 0;"src="http://localhost:8080/images/status/cross.png" />
- <strong>Service:</strong> message
- </div>
- <div style="width: 65px; height: 70px; position: absolute; top: 0px; right: 45px; background: none repeat scroll 0% 0% rgb(204, 204, 204); -moz-border-radius-bottomleft: 15px; -moz-border-radius-bottomright: 15px; border-bottom: 1px solid rgb(153, 153, 153); border-left: 1px solid rgb(153, 153, 153); border-right: 1px solid rgb(153, 153, 153); -moz-box-shadow: 0px 0px 10px rgb(204, 204, 204);z-index: 9999;">
- <img src="http://localhost:8080/images/widget/yellow.png" style="width: 64px;">
- </div>
- </body>
-
-</html>
Please sign in to comment.
Something went wrong with that request. Please try again.