views:

100

answers:

2

I'm building a sinatra Ruby app that interacts with Jambool Social Gold API (a virtual currency platform).

After a transaction is complete (the user purchases points) Jambool sends a "postback" to "foo.com/postback?signature=foo".

The API documentation says that it expects an OK response in the body of the postback (after I validate the transaction). I am not sure how to do this, is this for Net::Http class? This is what I've tried so far:

get "/postback" do
    signature = params[:signature]
    if signature is valid
       # HTTP okay here
    else
       # error
    end
end

What is the API expecting as a successful response? and how do I generate it?

UPDATE: The solution is to use the HTTP verb POST and not GET:

post "/postback" do 
   "OK"
end
+1  A: 

All you have to do is just send the string "OK" back in the response like so:

render_text "OK"

A: 

I think in rails 2+ you would want that to be

render :text => "OK"
Matt