Module: Parse::API::Objects
- Included in:
- Client
- Defined in:
- lib/parse/api/objects.rb
Overview
REST API methods for fetching CRUD operations on Parse objects.
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#create_object(className, body = {}, headers: {}, **opts) ⇒ Parse::Response
Create an object in a collection.
-
#delete_object(className, id, headers: {}, **opts) ⇒ Parse::Response
Delete an object in a collection.
-
#fetch_object(className, id, headers: {}, **opts) ⇒ Parse::Response
Fetch a specific object from a collection.
-
#find_objects(className, query = {}, headers: {}, **opts) ⇒ Parse::Response
Fetch a set of matching objects for a query.
-
#update_object(className, id, body = {}, headers: {}, **opts) ⇒ Parse::Response
Update an object in a collection.
-
#uri_path(className, id = nil) ⇒ String
Get the API path for this class.
Instance Method Details
#create_object(className, body = {}, headers: {}, **opts) ⇒ Parse::Response
Create an object in a collection.
63 64 65 66 67 |
# File 'lib/parse/api/objects.rb', line 63 def create_object(className, body = {}, headers: {}, **opts) response = request :post, uri_path(className) , body: body, headers: headers, opts: opts response.parse_class = className if response.present? response end |
#delete_object(className, id, headers: {}, **opts) ⇒ Parse::Response
Delete an object in a collection.
75 76 77 78 79 |
# File 'lib/parse/api/objects.rb', line 75 def delete_object(className, id, headers: {}, **opts) response = request :delete, uri_path(className, id), headers: headers, opts: opts response.parse_class = className if response.present? response end |
#fetch_object(className, id, headers: {}, **opts) ⇒ Parse::Response
Fetch a specific object from a collection.
87 88 89 90 91 |
# File 'lib/parse/api/objects.rb', line 87 def fetch_object(className, id, headers: {}, **opts) response = request :get, uri_path(className, id), headers: headers, opts: opts response.parse_class = className if response.present? response end |
#find_objects(className, query = {}, headers: {}, **opts) ⇒ Parse::Response
Fetch a set of matching objects for a query.
100 101 102 103 104 |
# File 'lib/parse/api/objects.rb', line 100 def find_objects(className, query = {}, headers: {}, **opts) response = request :get, uri_path(className), query: query, headers: headers, opts: opts response.parse_class = className if response.present? response end |
#update_object(className, id, body = {}, headers: {}, **opts) ⇒ Parse::Response
Update an object in a collection.
113 114 115 116 117 |
# File 'lib/parse/api/objects.rb', line 113 def update_object(className, id, body = {}, headers: {}, **opts) response = request :put, uri_path(className,id) , body: body, headers: headers, opts: opts response.parse_class = className if response.present? response end |
#uri_path(className, id = nil) ⇒ String
Get the API path for this class.
53 54 55 |
# File 'lib/parse/api/objects.rb', line 53 def uri_path(className, id = nil) self.class.uri_path(className, id) end |