class EsHttpOperation

Public Instance Methods

call_own_http_method() click to toggle source
# File lib/wukong-migrate/elasticsearch_operations.rb, line 17
def call_own_http_method
  http_options = body ? { body: json_body } : {}
  self.class.send(verb, path, http_options)
end
configure_with(options) click to toggle source
# File lib/wukong-migrate/elasticsearch_operations.rb, line 7
def configure_with options
  uri = [options[:host], options[:port]].join(':')
  self.class.base_uri uri
end
execute() click to toggle source
# File lib/wukong-migrate/elasticsearch_operations.rb, line 12
def execute
  response = call_own_http_method
  response
end
json_body() click to toggle source
# File lib/wukong-migrate/elasticsearch_operations.rb, line 28
def json_body
  MultiJson.encode(body)
end
raw_curl_string() click to toggle source
# File lib/wukong-migrate/elasticsearch_operations.rb, line 22
def raw_curl_string
  "curl -X #{verb.to_s.upcase} '#{self.class.base_uri}#{path}'".tap do |raw|
    raw << " -d '#{json_body}'" if body
  end
end