Class: Hinoki::Connection

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

Instance Method Summary collapse

Constructor Details

#initialize(host = nil, port = nil) ⇒ Connection

Returns a new instance of Connection.



10
11
12
13
# File 'lib/hinoki/connection.rb', line 10

def initialize(host=nil, port=nil)
  @config = Hinoki::Config.new
  @http = Net::HTTP.new(host || @config.host, port || @config.port)
end

Instance Method Details

#delete(path) ⇒ Object

Wrapper around Net::HTTP.delete



26
27
28
# File 'lib/hinoki/connection.rb', line 26

def delete(path)
  return interpret_response(@http.delete(path))
end

#get(path) ⇒ Object

Wrapper around Net::HTTP.get



16
17
18
# File 'lib/hinoki/connection.rb', line 16

def get(path)
  return interpret_response(@http.get(path))
end

#post(path) ⇒ Object

Wrapper around Net::HTTP.post



21
22
23
# File 'lib/hinoki/connection.rb', line 21

def post(path)
  return interpret_response(@http.post(path))
end

#request(req) ⇒ Object



30
31
32
# File 'lib/hinoki/connection.rb', line 30

def request(req)
  return interpret_response(@http.request(req))
end