Hi,
I'm using your api
and some things are not working in the ruby gem. My main concerns are:
Getting the poll
results
Starting and
stopping the poll
Here is a sample of
my code to illuminate my understanding of the api documentation
require 'rubygems'
require 'sinatra'
require 'polleverywhere'
require 'json'
require 'sinatra/jsonp'
PollEverywhere.config do
username "redacted@redacted.com"
password "redacted"
# Get a list of your polls
end
def clean(str)
# remove underscores
s = str.gsub(/_|\./, " ")
return s
end
get '/' do
"Welcome to Search solutions' poll everywhere api"
end
get '/find/polls' do
polls = PollEverywhere::Poll.all
"#{polls}"
end
get '/get/polls/results/:perma' do
@results = PollEverywhere::MultipleChoicePoll.from_hash(
:permalink => "#{params[:perma]}"
).save
@results.results
end
get '/find/poll/:permalink/:action' do
@mcp = PollEverywhere::MultipleChoicePoll.from_hash(
:permalink => "#{params[:permalink]}"
).save
if params[:action] == "stop"
@mcp.stop
@mcp.save
"The Poll #{params[:permalink]} has been sucessfully #{params[:action]}ped"
elsif params[:action] == "start"
@mcp.start
@mcp.save
"The Poll #{params[:permalink]} has been sucessfully #{params[:action]}ed"
end
end
Any help you can
provide would be greatly appreciated as my client has a paid account and
would like to get this up and running asap