Skip to content

Instantly share code, notes, and snippets.

@superfeedr
Created May 12, 2010 20:47
Show Gist options
  • Save superfeedr/399103 to your computer and use it in GitHub Desktop.
Save superfeedr/399103 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'sinatra'
# Accepts subscriptions vcerification and unsubscription verification
get '/ok' do
params['hub.challenge']
end
# Refuses subscriptions vcerification and unsubscription verification
get '/ko' do
params['hub.challenge'] + "ko"
end
post '/ok' do
puts params.inspect
puts request.inspect
puts request.body.read
end
# Accepts subscriptions vcerification but refuses unsubscription verification
get '/okko' do
if params['hub.mode'] == "subscribe"
params['hub.challenge']
else
"somethingunrelated"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment