Class: IndexTank::RestClient

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

Direct Known Subclasses

ApiClient, IndexClient

Instance Method Summary collapse

Instance Method Details

#DELETE(path, params = {}) ⇒ Object



25
26
27
28
29
30
# File 'lib/indextank_client.rb', line 25

def DELETE(path, params={})
    path = "#{path}?#{to_query(params)}" if params
    request = Net::HTTP::Delete.new "#{@uri.path}#{path}"
    authorize request
    return execute(request)
end

#GET(path, params = {}) ⇒ Object



11
12
13
14
15
16
# File 'lib/indextank_client.rb', line 11

def GET(path, params={})
    path = "#{path}?#{to_query(params)}" if params
    request = Net::HTTP::Get.new "#{@uri.path}#{path}"
    authorize request
    return execute(request)
end

#PUT(path, body = {}) ⇒ Object



18
19
20
21
22
23
# File 'lib/indextank_client.rb', line 18

def PUT(path, body={})
    request = Net::HTTP::Put.new "#{@uri.path}#{path}"
    authorize request
    request.body = body.to_json if body
    return execute(request)
end