Module: Montage::Client::Documents
- Included in:
- Montage::Client
- Defined in:
- lib/montage/client/documents.rb
Instance Method Summary collapse
-
#create_or_update_documents(schema, documents) ⇒ Object
Public: Create or update a set of documents.
-
#delete_document(schema, document_uuid) ⇒ Object
Public: Delete a document.
-
#document(schema, document_uuid) ⇒ Object
Public: Fetch a document.
-
#documents(schema, query = {}) ⇒ Object
Public: Get a list of documents.
-
#update_document(schema, document) ⇒ Object
Public: Update a document.
Instance Method Details
#create_or_update_documents(schema, documents) ⇒ Object
Public: Create or update a set of documents
Params:
schema - *Required* The name of the schema to add the document to
document - *Required* The Hash representation of the document you would like to create
The document must conform to the schema definition
Returns a Montage::Response
49 50 51 |
# File 'lib/montage/client/documents.rb', line 49 def create_or_update_documents(schema, documents) post("schemas/#{schema}/save/", "document", documents) end |
#delete_document(schema, document_uuid) ⇒ Object
Public: Delete a document
Params:
schema - *Required* The name of the schema the document belongs to
document_uuid - *Required* The uuid of the document you widh to delete
Returns a Montage::Response
74 75 76 |
# File 'lib/montage/client/documents.rb', line 74 def delete_document(schema, document_uuid) delete("schemas/#{schema}/#{document_uuid}/", "document") end |
#document(schema, document_uuid) ⇒ Object
Public: Fetch a document
Params:
schema - *Required* The name of the schema to fetch the document from
document_uuid - *Required* The uuid of the document to fetch
Returns a Montage::Response
24 25 26 |
# File 'lib/montage/client/documents.rb', line 24 def document(schema, document_uuid) get("schemas/#{schema}/#{document_uuid}/", "document") end |
#documents(schema, query = {}) ⇒ Object
Public: Get a list of documents
Params:
schema - *Required* The name of the schema to run the query against
query - *Optional* A Montage::Query object to pass along with the request
Returns a Montage::Response
12 13 14 |
# File 'lib/montage/client/documents.rb', line 12 def documents(schema, query = {}) post("schemas/#{schema}/query/", "document", query) end |
#update_document(schema, document) ⇒ Object
Public: Update a document
Params:
schema - *Required* The name of the schema the document belongs to
document_uuid - *Required* The uuid of the document you wish to update
document - *Required* The Hash representation of the document you would like to update
The document must conform to the schema definition
Returns a Montage::Response
63 64 65 |
# File 'lib/montage/client/documents.rb', line 63 def update_document(schema, document) post("schemas/#{schema}/save/", "document", document) end |