Skip to content

Instantly share code, notes, and snippets.

@jwo
Created February 18, 2016 13:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwo/4bebcdfb7828712d92c8 to your computer and use it in GitHub Desktop.
Save jwo/4bebcdfb7828712d92c8 to your computer and use it in GitHub Desktop.
parse2 guide.rb
## Post Object
Http.with_headers("X-Parse-Application-Id" => $parse_application_id).post("http://$yourserver.herokuapp.com/parse/classes/GameScore", json: {score:1337,playerName:"Sean Plott",cheatMode: false}
=> {"results"=>[{"objectId"=>"We2so7njJV", "score"=>1337, "playerName"=>"Sean Plott", "cheatMode"=>false, "updatedAt"=>"2016-02-18T11:55:37.367Z", "createdAt"=>"2016-02-18T11:55:37.367Z"}]}
## Get object
Http.with_headers("X-Parse-Application-Id" => $parse_application_id).get("http://$yourserver.herokuapp.com/parse/classes/GameScore")
=> same
## Post file
Http.with_headers("X-Parse-Application-Id" => $parse_application_id, "Content-Type" => "text/plain").post("http://$yourserver.herokuapp.com/parse/files/hello.txt", body: 'Hello, World!')
=>
"{\"url\":\"http://$yourserver.herokuapp.com/parse/files/4a963287ef5a1126/edf2ea468cf9e4aff5b8707df7a01853_hello.txt\",\"name\":\"edf2ea468cf9e4aff5b8707df7a01853_hello.txt\"}"
## Create User
Http.with_headers("X-Parse-Application-Id" => $parse_application_id).post("http://$yourserver.herokuapp.com/parse/users", json: {username: "jwo", password: "12345678"})
=>
"{\"objectId\":\"OA4l8o6WDO\",\"createdAt\":\"2016-02-18T13:28:36.347Z\",\"sessionToken\":\"r:3575ef0e7e205ce39c31281fabd650b5\"}"
## Verify token
Http.with_headers("X-Parse-Application-Id" => $parse_application_id, "X-Parse-Session-Token" => "r:3575ef0e7e205ce39c31281fabd650b5").get("http://$yourserver.herokuapp.com/parse/users/me")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment