Class: Gizmo::Delete

Inherits:
BaseOperation show all
Defined in:
lib/gizmo/delete.rb

Instance Attribute Summary

Attributes inherited from BaseOperation

#context

Instance Method Summary collapse

Methods inherited from BaseOperation

#create_response, #default_status, #initialize, #set_response_headers

Constructor Details

This class inherits a constructor from Gizmo::BaseOperation

Instance Method Details

#call(criteria, id) ⇒ Gizmo::Response

Delete a single item using the provided criteria.

Parameters:

  • criteria (Mongoid::Criteria)

    the criteria to use for deleting a single item

  • id (String, Moped::BSON::ObjectId)

    the ID of the item being deleted

Returns:



10
11
12
13
14
15
# File 'lib/gizmo/delete.rb', line 10

def call(criteria, id)
  response = create_response
  criteria.find(id).delete
  response.data = {}
  response
end