Class: Stretch::Cluster

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ Cluster

Returns a new instance of Cluster.



5
6
7
# File 'lib/stretch/cluster.rb', line 5

def initialize connection
  @connection = connection
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



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

def connection
  @connection
end

Instance Method Details

#health(options = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/stretch/cluster.rb', line 9

def health options = {}
  indices = options.delete(:indices) if options.has_key? :indices

  path = "/health"

  if indices
    path << "/#{[indices].flatten.join(',')}"
    options[:level] = "indices"
  end

  get path, options
end

#settings(options = {}) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/stretch/cluster.rb', line 26

def settings options = {}
  if options.any?
    put "/settings", options
  else
    get "/settings"
  end
end

#state(options = {}) ⇒ Object



22
23
24
# File 'lib/stretch/cluster.rb', line 22

def state options = {}
  get "/state", options
end