Class: Stretch::Index

Inherits:
Object
  • Object
show all
Defined in:
lib/stretch/index.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, connection) ⇒ Index

Returns a new instance of Index.

Raises:

  • (ArgumentError)


5
6
7
8
9
10
# File 'lib/stretch/index.rb', line 5

def initialize name, connection
  raise ArgumentError if name.nil? || name.empty?

  @name = name
  @connection = connection
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



3
4
5
# File 'lib/stretch/index.rb', line 3

def connection
  @connection
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/stretch/index.rb', line 3

def name
  @name
end

Instance Method Details

#closeObject



24
25
26
# File 'lib/stretch/index.rb', line 24

def close
  post "/_close"
end

#openObject



20
21
22
# File 'lib/stretch/index.rb', line 20

def open
  post "/_open"
end

#settings(options = {}) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/stretch/index.rb', line 12

def settings options = {}
  if options.any?
    put "/_settings", options
  else
    get("/_settings")[@name]["settings"]
  end
end