Class: ProxES::Request::Bulk
- Inherits:
-
ProxES::Request
- Object
- Rack::Request
- ProxES::Request
- ProxES::Request::Bulk
- Defined in:
- lib/proxes/request/bulk.rb
Constant Summary collapse
- REGEX =
/"(index|delete|create|update)".*"_index"\s*:\s*"(.*?)"/
Constants inherited from ProxES::Request
Instance Attribute Summary collapse
-
#index ⇒ Object
Returns the value of attribute index.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
Methods inherited from ProxES::Request
#detail, #duration, from_env, #html?, #initialize, path_endpoint, #user, #user_id
Constructor Details
This class inherits a constructor from ProxES::Request
Instance Attribute Details
#index ⇒ Object
Returns the value of attribute index.
9 10 11 |
# File 'lib/proxes/request/bulk.rb', line 9 def index @index end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
9 10 11 |
# File 'lib/proxes/request/bulk.rb', line 9 def type @type end |
Instance Method Details
#bulk_indices ⇒ Object
13 14 15 16 17 |
# File 'lib/proxes/request/bulk.rb', line 13 def bulk_indices @bulk_indices ||= begin body.read.scan(REGEX).tap { |_r| body.rewind } end.map { |e| e[1] }.uniq end |
#endpoint ⇒ Object
26 27 28 |
# File 'lib/proxes/request/bulk.rb', line 26 def endpoint '_bulk' end |
#indices? ⇒ Boolean
35 36 37 |
# File 'lib/proxes/request/bulk.rb', line 35 def indices? !@index.nil? end |
#parse ⇒ Object
30 31 32 33 |
# File 'lib/proxes/request/bulk.rb', line 30 def parse @index ||= check_part(path_parts[0]) unless path_parts[0] == endpoint @type ||= check_part(path_parts[1]) unless path_parts[1] == endpoint end |