Class: IndexTank::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/indextank/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_url) ⇒ Client

Returns a new instance of Client.



8
9
10
11
12
13
# File 'lib/indextank/client.rb', line 8

def initialize(api_url)
  @uri = api_url
  @conn = IndexTank.setup_connection(api_url) do |faraday|
    faraday.use ClientResponseMiddleware
  end
end

Instance Attribute Details

#uriObject (readonly)

Returns the value of attribute uri.



6
7
8
# File 'lib/indextank/client.rb', line 6

def uri
  @uri
end

Instance Method Details

#indexes(name = nil) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/indextank/client.rb', line 15

def indexes(name = nil)
  if name.nil?
    list_indexes
  else
    get_index(name)
  end
end