Class: Elasticated::BulkRequest::ResponseItem
- Inherits:
-
Object
- Object
- Elasticated::BulkRequest::ResponseItem
- Includes:
- Mixins::Inspectionable
- Defined in:
- lib/elasticated/bulk_request/response_item.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
Returns the value of attribute action.
-
#error ⇒ Object
Returns the value of attribute error.
-
#found ⇒ Object
Returns the value of attribute found.
-
#id ⇒ Object
Returns the value of attribute id.
-
#index ⇒ Object
Returns the value of attribute index.
-
#status ⇒ Object
Returns the value of attribute status.
-
#type ⇒ Object
Returns the value of attribute type.
-
#version ⇒ Object
Returns the value of attribute version.
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Mixins::Inspectionable
Instance Attribute Details
#action ⇒ Object
Returns the value of attribute action.
21 22 23 |
# File 'lib/elasticated/bulk_request/response_item.rb', line 21 def action @action end |
#error ⇒ Object
Returns the value of attribute error.
21 22 23 |
# File 'lib/elasticated/bulk_request/response_item.rb', line 21 def error @error end |
#found ⇒ Object
Returns the value of attribute found.
21 22 23 |
# File 'lib/elasticated/bulk_request/response_item.rb', line 21 def found @found end |
#id ⇒ Object
Returns the value of attribute id.
21 22 23 |
# File 'lib/elasticated/bulk_request/response_item.rb', line 21 def id @id end |
#index ⇒ Object
Returns the value of attribute index.
21 22 23 |
# File 'lib/elasticated/bulk_request/response_item.rb', line 21 def index @index end |
#status ⇒ Object
Returns the value of attribute status.
21 22 23 |
# File 'lib/elasticated/bulk_request/response_item.rb', line 21 def status @status end |
#type ⇒ Object
Returns the value of attribute type.
21 22 23 |
# File 'lib/elasticated/bulk_request/response_item.rb', line 21 def type @type end |
#version ⇒ Object
Returns the value of attribute version.
21 22 23 |
# File 'lib/elasticated/bulk_request/response_item.rb', line 21 def version @version end |
Class Method Details
.parse(partial_response) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/elasticated/bulk_request/response_item.rb', line 7 def self.parse(partial_response) item = new item.action = partial_response.first.first data = partial_response.first.last item.index = data['_index'] item.type = data['_type'] item.id = data['_id'] item.version = data['_version'] item.status = data['status'] item.found = data['found'] item.error = data['error'] item end |
Instance Method Details
#completed? ⇒ Boolean
27 28 29 |
# File 'lib/elasticated/bulk_request/response_item.rb', line 27 def completed? !error? end |
#error? ⇒ Boolean
23 24 25 |
# File 'lib/elasticated/bulk_request/response_item.rb', line 23 def error? !!error end |
#text_for_inspect ⇒ Object
31 32 33 34 35 |
# File 'lib/elasticated/bulk_request/response_item.rb', line 31 def text_for_inspect text = "#{action} #{index}/#{type}/#{id} (status #{status})" text = "#{text}, with error" if error? text end |