module Parse::Protocol

A module which encapsulates the specifics of Parse’s REST API.

Constants

BATCH_REQUEST_URI
CLASS_INSTALLATION
CLASS_USER

The class name for User objects, when referenced by a Pointer.

CLOUD_FUNCTIONS_PATH
DELETE_OP
ERROR_EXCEEDED_BURST_LIMIT
ERROR_INTERNAL
ERROR_OBJECT_NOT_FOUND_FOR_GET
ERROR_TIMEOUT
HEADER_API_KEY

The HTTP header used for passing your API key to the Parse API.

HEADER_APP_ID

The HTTP header used for passing your application ID to the Parse API.

HEADER_MASTER_KEY

The HTTP header used for passing your API Master key to the Parse API.

HEADER_SESSION_TOKEN

The HTTP header used for passing your authenticated session

HOST

The default hostname for communication with the Parse API.

KEY_ADD
KEY_ADD_RELATION
KEY_ADD_UNIQUE
KEY_AMOUNT

The JSON key used to specify the numerical value in the increment/decrement API call.

KEY_CLASS_NAME

The JSON key used to store the class name of an object in a Pointer datatype.

KEY_CREATED_AT

The JSON key used to store the creation timestamp of Parse objects in their JSON representation.

KEY_DELETE
KEY_INCREMENT
KEY_OBJECTS

array ops

KEY_OBJECT_ID

The JSON key used to store the ID of Parse objects in their JSON representation.

KEY_OP

The JSON key used to identify an operator

KEY_REMOVE
KEY_RESULTS
KEY_TYPE

The JSON key used to identify the datatype of a special value.

KEY_UPDATED_AT

The JSON key used to store the last modified timestamp of Parse objects in their JSON representation.

KEY_USER_SESSION_TOKEN
OP_INCREMENT

Operation name for incrementing an objects field value remotely

PASSWORD_RESET_URI
RESERVED_KEYS
RESPONSE_KEY_RESULTS

The JSON key used in the top-level response object to indicate that the response contains an array of objects.

TYPE_BYTES

The data type name for special JSON objects containing an array of encoded bytes.

TYPE_DATE

The data type name for special JSON objects representing a date/time.

TYPE_FILE

The data type name for special JSON objects representing a file.

TYPE_GEOPOINT

The data type name for special JSON objects representing a location specified as a latitude/longitude pair.

TYPE_OBJECT

The data type name for special JSON objects representing a full object

TYPE_POINTER

The data type name for special JSON objects representing a reference to another Parse object.

TYPE_RELATION

The data type name for special JSON objects representing a Relation.

USER_LOGIN_URI
VERSION

The version of the REST API implemented by this module.

Public Class Methods

batch_request_uri() click to toggle source
# File lib/parse/protocol.rb, line 178
def Protocol.batch_request_uri
  "/#{VERSION}/#{BATCH_REQUEST_URI}"
end
class_uri(class_name, object_id = nil) click to toggle source

Construct a uri referencing a given Parse object class or instance (of object_id is non-nil).

# File lib/parse/protocol.rb, line 136
def Protocol.class_uri(class_name, object_id = nil)
  if object_id
    "/#{VERSION}/classes/#{class_name}/#{object_id}"
  else
    "/#{VERSION}/classes/#{class_name}"
  end
end
cloud_function_uri(function_name) click to toggle source
# File lib/parse/protocol.rb, line 174
def Protocol.cloud_function_uri(function_name)
  "/#{VERSION}/#{CLOUD_FUNCTIONS_PATH}/#{function_name}"
end
file_uri(file_name) click to toggle source

Construct a uri referencing a file stored by the API.

# File lib/parse/protocol.rb, line 165
def Protocol.file_uri(file_name)
  "/#{VERSION}/files/#{file_name}"
end
installation_uri(object_id = nil) click to toggle source

Construct a uri referencing a given Parse installation class or instance (of object_id is non-nil).

# File lib/parse/protocol.rb, line 146
def Protocol.installation_uri(object_id = nil)
  if object_id
    "/#{VERSION}/installations/#{object_id}"
  else
    "/#{VERSION}/installations"
  end
end
push_uri() click to toggle source

Construct a uri to send a push notification via the API.

# File lib/parse/protocol.rb, line 170
def Protocol.push_uri
  "/#{VERSION}/push"
end
user_uri(user_id = nil) click to toggle source

Construct a uri referencing a given Parse user instance or the users category.

# File lib/parse/protocol.rb, line 156
def Protocol.user_uri(user_id = nil)
  if user_id
    "/#{VERSION}/users/#{user_id}"
  else
    "/#{VERSION}/users"
  end
end