Module: Parse::API::Schema

Included in:
Client
Defined in:
lib/parse/api/schema.rb

Overview

Defines the Schema interface for the Parse REST API

Instance Method Summary collapse

Instance Method Details

#create_schema(className, schema) ⇒ Parse::Response

Create a new collection with the specific schema.

Parameters:

  • className (String)

    the name of the remote Parse collection.

  • schema (Hash)

    the schema hash. This is a specific format specified by Parse.

Returns:


32
33
34
# File 'lib/parse/api/schema.rb', line 32

def create_schema(className, schema)
  request :post, "#{SCHEMAS_PATH}/#{className}", body: schema
end

#schema(className) ⇒ Parse::Response

Get the schema for a collection.

Parameters:

  • className (String)

    the name of the remote Parse collection.

Returns:


22
23
24
25
# File 'lib/parse/api/schema.rb', line 22

def schema(className)
  opts = {cache: false}
  request :get, "#{SCHEMAS_PATH}/#{className}", opts: opts
end

#schemasParse::Response

Get all the schemas for the application.

Returns:


14
15
16
17
# File 'lib/parse/api/schema.rb', line 14

def schemas
  opts = {cache: false}
  request :get, SCHEMAS_PATH, opts: opts
end

#update_schema(className, schema) ⇒ Parse::Response

Update the schema for a collection.

Parameters:

  • className (String)

    the name of the remote Parse collection.

  • schema (Hash)

    the schema hash. This is a specific format specified by Parse.

Returns:


41
42
43
# File 'lib/parse/api/schema.rb', line 41

def update_schema(className, schema)
  request :put, "#{SCHEMAS_PATH}/#{className}", body: schema
end