class Stretch::Index

Attributes

connection[R]
name[R]

Public Class Methods

new(name, connection) click to toggle source
# File lib/stretch/index.rb, line 5
def initialize name, connection
  raise ArgumentError if name.nil? || name.empty?

  @name = name
  @connection = connection
end

Public Instance Methods

close() click to toggle source
# File lib/stretch/index.rb, line 24
def close
  post "/_close"
end
open() click to toggle source
# File lib/stretch/index.rb, line 20
def open
  post "/_open"
end
settings(options = {}) click to toggle source
# File lib/stretch/index.rb, line 12
def settings options = {}
  if options.any?
    put "/_settings", options
  else
    get("/_settings")[@name]["settings"]
  end
end

Private Instance Methods

get(path, options = {}) click to toggle source
# File lib/stretch/index.rb, line 29
def get path, options = {}
  @connection.request :get, "/#{@name}#{path}", options
end
post(path, options = {}) click to toggle source
# File lib/stretch/index.rb, line 37
def post path, options = {}
  @connection.request :post, "/#{@name}#{path}", options
end
put(path, options = {}) click to toggle source
# File lib/stretch/index.rb, line 33
def put path, options = {}
  @connection.request :put, "/#{@name}#{path}", options
end