Module: Whatser::Http

Includes:
HTTParty
Included in:
Client
Defined in:
lib/whatser/net/http.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
# File 'lib/whatser/net/http.rb', line 5

def self.included(base)
  base_uri base.api_uri
end

Instance Method Details

#request(verb, path, params = {}, options = {}) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/whatser/net/http.rb', line 9

def request(verb, path, params={}, options={})
  log("Whatser API Request: #{verb} @ #{path} with : #{params.to_s}")
  response = HTTParty.send( verb, compose_url(path), request_options( params ) )
  log("Whatser API Response: #{response.code} with : #{response.body.to_s}")
  
  Whatser::Response.new( response.body, {:code => response.code}.merge(options) ) 
end