Class: Elasticated::BulkActions::DeleteAction
- Inherits:
-
StandardAction
- Object
- StandardAction
- Elasticated::BulkActions::DeleteAction
- Defined in:
- lib/elasticated/bulk_actions/delete_action.rb
Instance Attribute Summary collapse
-
#document_id ⇒ Object
Returns the value of attribute document_id.
-
#params ⇒ Object
Returns the value of attribute params.
Attributes inherited from StandardAction
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(repository, document_id, params = {}) ⇒ DeleteAction
constructor
A new instance of DeleteAction.
Constructor Details
#initialize(repository, document_id, params = {}) ⇒ DeleteAction
7 8 9 10 11 |
# File 'lib/elasticated/bulk_actions/delete_action.rb', line 7 def initialize(repository, document_id, params={}) super repository self.document_id = document_id self.params = params end |
Instance Attribute Details
#document_id ⇒ Object
Returns the value of attribute document_id.
5 6 7 |
# File 'lib/elasticated/bulk_actions/delete_action.rb', line 5 def document_id @document_id end |
#params ⇒ Object
Returns the value of attribute params.
5 6 7 |
# File 'lib/elasticated/bulk_actions/delete_action.rb', line 5 def params @params end |
Instance Method Details
#build ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/elasticated/bulk_actions/delete_action.rb', line 13 def build original_params = Helpers.hash_deep_dup params # preparations prepared_params = repository.params_for_ids [document_id], original_params # verifications prepared_params[:index] || raise("A target index should be specified in a delete") prepared_params[:type] || raise("A target type should be specified in a delete") # the final command prepared_params[:_index] = prepared_params.delete :index prepared_params[:_type] = prepared_params.delete :type prepared_params[:_id] = document_id command = { delete: prepared_params } [command] end |