Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

111 lines (78 sloc) 3.13 KB

The original creator of parse-ruby-client, aalpern, has decided to stop work on the project. I'm going to give the project new life, first by maintaining the project as a gem, and second by eventually making it power parse_resource under the hood.

Ruby Client for REST API

This file implements a simple Ruby client library for using Parse's REST API. Rather than try to implement an ActiveRecord-compatible library, it tries to match the structure of the iOS and Android SDKs from Parse.

So far it supports simple GET, PUT, and POST operations on objects. Enough to read & write simple data.


This currently depends on the gems 'json' and 'patron' for JSON support and HTTP, respectively.

Getting Started

To get started, load the parse.rb file and call Parse.init to initialize the client object with your application ID and API key values, which you can obtain from the dashboard.

Parse.init :application_id => "<your_app_id>",
           :api_key        => "<your_api_key>"

Creating and Saving Objects

Create an instance of Parse::Object with your class name supplied as a string, set some keys, and call save().

game_score = "GameScore"
game_score["score"]         = 1337
game_score["playerName"]    = "Sean Plott"
game_score["cheatMode"]     = false

Alternatively, you can initialize the object's initial values with a hash.

game_score = "GameScore", {
    "score" => 1337, "playerName" => "Sean Plott", "cheatMode" => false

Or if you prefer, you can use symbols for the hash keys - they will be converted to strings by Parse::Object.initialize().

game_score = "GameScore", {
        :score => 1337, :playerName => "Sean Plott", :cheatMode => false

Retrieving Objects

Individual objects can be retrieved with a single call to Parse.get() supplying the class and object id.

game_score = Parse.get "GameScore", "xWMyZ4YEGZ"

All the objects in a given class can be retrieved by omitting the object ID. Use caution if you have lots and lots of objects of that class though.

all_scores = Parse.get "GameScore"


Queries are supported by the Parse::Query class.

# Create some simple objects to query
(1..100).each { |i|
  score = "GameScore"
  score["score"] = i

# Retrieve all scores between 10 & 20 inclusive"GameScore")   \
  .greater_eq("score", 10)      \
  .less_eq("score", 20)         \

# Retrieve a set of specific scores"GameScore")           \
  .value_in("score", [10, 20, 30, 40])  \


  • Add some form of debug logging
  • Support for Date, Pointer, and Bytes API data types
  • Users
  • ACLs
  • Login


Jump to Line
Something went wrong with that request. Please try again.