Created
January 20, 2012 03:30
-
-
Save superfeedr/1644799 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
require 'rack-superfeedr' | |
use Rack::Superfeedr, { :host => "plant-leg.showoff.io", :login => "demo", :password => "demo", :format => "json", :async => false } do |superfeedr| | |
set :superfeedr, superfeedr # so that we can use `settings.superfeedr` to access the superfeedr object in our application. | |
superfeedr.on_notification do |notification| | |
puts notification.to_s # You probably want to persist that data in some kind of data store... | |
end | |
end | |
get '/hi' do | |
"Hello World!" # Maybe serve the data you saved from Superfeedr's handler. | |
end | |
get '/subscribe' do | |
settings.superfeedr.subscribe("http://push-pub.appspot.com/feed") | |
end | |
get '/unsubscribe' do | |
settings.superfeedr.unsubscribe("http://push-pub.appspot.com/feed") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment