Created
April 6, 2012 15:06
-
-
Save rodriguezartav/2320647 to your computer and use it in GitHub Desktop.
PARSE JS FROM SINATRA
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
#headers = Hash['Content-Type' => 'application/json; charset=utf-8' , 'X-Parse-Application-Id' => "XXXXXXXXXXXXXXXX" , | |
#'X-Parse-REST-API-Key' => "XXXXXXXXXXXXX"] | |
#parse_result = https("api.parse.com").get('/1/classes/Cierre?where={"fecha":{"$ne":"' + fecha + '"}}&order=-createdAt&limit=1',headers).body | |
#parse_result = JSON.parse parse_result | |
post "/cierre" do | |
headers = Hash['Content-Type' => 'application/json; charset=utf-8' , 'X-Parse-Application-Id' => "XXXXXXXXXXXXX" , | |
'X-Parse-REST-API-Key' => "XXXXXXXXXXXXXXXX"] | |
cierre_raw = params[:cierre] | |
cierre = JSON.parse cierre_raw | |
fecha = cierre["fecha"] | |
object = {'cierre' => cierre_raw , 'fecha' => fecha }.to_json | |
result_raw = https("api.parse.com").post('/1/classes/CLASSNAME', object ,headers).body | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment