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:


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

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:


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

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

#schemasParse::Response

Get all the schemas for the application.

Returns:


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

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:


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

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