Skip to content

Instantly share code, notes, and snippets.

@brettclanton001
Created November 8, 2012 12:41
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brettclanton001/4038571 to your computer and use it in GitHub Desktop.
Save brettclanton001/4038571 to your computer and use it in GitHub Desktop.
Ruby on Rails > REST API for Parse (parse.com)
gem "nestful"
module ParseHelper
def parseHeader
{
"X-Parse-Application-Id" => "YOUR_APP_ID",
"X-Parse-REST-API-Key" => "YOUR_REST_KEY"
}
end
def parseDomain(ext)
"https://api.parse.com/1/#{ext}"
end
def createObject( objectType, objectData )
Nestful.post parseDomain("classes/#{objectType}"), :format => :json, :headers => parseHeader, :params => objectData
end
end
class YourController < ApplicationController
include ParseHelper
def index
@results = createObject('TestObject', {
"foo" => "bar"
})
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment