Class: Tire::DeleteByQuery
- Inherits:
-
Object
- Object
- Tire::DeleteByQuery
- Defined in:
- lib/tire/delete_by_query.rb
Defined Under Namespace
Classes: DeleteByQueryRequestFailed
Instance Attribute Summary collapse
-
#indices ⇒ Object
readonly
Returns the value of attribute indices.
-
#json ⇒ Object
readonly
Returns the value of attribute json.
-
#query ⇒ Object
readonly
Returns the value of attribute query.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#types ⇒ Object
readonly
Returns the value of attribute types.
Instance Method Summary collapse
-
#initialize(indices = nil, options = {}, &block) ⇒ DeleteByQuery
constructor
A new instance of DeleteByQuery.
- #perform ⇒ Object
Constructor Details
#initialize(indices = nil, options = {}, &block) ⇒ DeleteByQuery
Returns a new instance of DeleteByQuery.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/tire/delete_by_query.rb', line 7 def initialize(indices=nil, ={}, &block) @indices = Array(indices) @types = Array([:type]).flatten @options = if block_given? @query = Search::Query.new block.arity < 1 ? @query.instance_eval(&block) : block.call(@query) else raise "no query given for #{self.class}" end end |
Instance Attribute Details
#indices ⇒ Object (readonly)
Returns the value of attribute indices.
5 6 7 |
# File 'lib/tire/delete_by_query.rb', line 5 def indices @indices end |
#json ⇒ Object (readonly)
Returns the value of attribute json.
5 6 7 |
# File 'lib/tire/delete_by_query.rb', line 5 def json @json end |
#query ⇒ Object (readonly)
Returns the value of attribute query.
5 6 7 |
# File 'lib/tire/delete_by_query.rb', line 5 def query @query end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
5 6 7 |
# File 'lib/tire/delete_by_query.rb', line 5 def response @response end |
#types ⇒ Object (readonly)
Returns the value of attribute types.
5 6 7 |
# File 'lib/tire/delete_by_query.rb', line 5 def types @types end |
Instance Method Details
#perform ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/tire/delete_by_query.rb', line 20 def perform @response = Configuration.client.delete url if @response.failure? STDERR.puts "[REQUEST FAILED] #{self.to_curl}\n" raise DeleteByQueryRequestFailed, @response.to_s end @json = MultiJson.decode(@response.body) true ensure logged end |