Permalink
Browse files

working example to display series

  • Loading branch information...
1 parent a7161f7 commit ae2338411b2b53c243aab62bfcfe8c1d552ecc81 Andrew J Cronk committed Feb 29, 2012
Showing with 21 additions and 1 deletion.
  1. +5 −0 .env
  2. +1 −0 Gemfile
  3. +4 −0 Gemfile.lock
  4. +11 −1 web.rb
View
5 .env
@@ -0,0 +1,5 @@
+TEMPODB_API_KEY=myagley
+TEMPODB_API_SECRET=opensesame
+TEMPODB_API_HOST=api.tempo-db.com
+TEMPODB_API_PORT=443
+TEMPODB_API_SECURE=True
View
@@ -1,3 +1,4 @@
source :rubygems
gem 'sinatra', '1.1.0'
gem 'thin', '1.2.7'
+gem 'tempodb'
View
@@ -3,10 +3,13 @@ GEM
specs:
daemons (1.1.8)
eventmachine (0.12.10)
+ json (1.6.5)
rack (1.4.1)
sinatra (1.1.0)
rack (~> 1.1)
tilt (~> 1.1)
+ tempodb (0.1.0)
+ json
thin (1.2.7)
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
@@ -18,4 +21,5 @@ PLATFORMS
DEPENDENCIES
sinatra (= 1.1.0)
+ tempodb
thin (= 1.2.7)
View
12 web.rb
@@ -1,5 +1,15 @@
require 'sinatra'
+require 'tempodb'
get '/' do
- "Hello, world"
+ api_key = ENV['TEMPODB_API_KEY']
+ api_secret = ENV['TEMPODB_API_SECRET']
+ api_host = ENV['TEMPODB_API_HOST']
+ api_port = Integer(ENV['TEMPODB_API_PORT'])
+ api_secure = ENV['TEMPODB_API_SECURE'] == "False" ? false : true
+
+ client = TempoDB::Client.new( api_key, api_secret, api_host, api_port, api_secure )
+ out = ""
+ client.get_series().each{ |series| out += series.to_json + "<br/>" }
+ out
end

0 comments on commit ae23384

Please sign in to comment.