lib/lieu/request.rb
# Make a HTTP GET request.
#
# @param path [String] The path, relative to api_endpoint
# @param options [Hash] query params for request
# @return [Hashie::Mash]
Make a HTTP GET request.
Make a HTTP GET request .
def request(method, path, options)
      path = "#{path}/json" unless options.delete(:json) == false
      response = connection.send(method) do |request|
        request.params['key'] = self.api_key
        request.params['sensor'] = options.delete(:sensor) || self.sensor
        case method
        when :get
          request.url(path, options)
        when :post
          request.path = path
          request.body = MultiJson.dump(options) unless options.empty?
        end
      end
      response.body
    end
def request ( method , path , options ) path = "#{path}/json" unless options . delete ( :json ) == false response = connection . send ( method ) do | request | request . params [ 'key' ] = self . api_key request . params [ 'sensor' ] = options . delete ( :sensor ) || self . sensor case method when :get request . url ( path , options ) when :post request . path = path request . body = MultiJson . dump ( options ) unless options . empty? end end response . body end
Make a HTTP GET request.
Make a HTTP GET request .
None
Hashie::Mash
method
path
The path, relative to api_endpoint
The path relative to api_endpoint
options
query params for request
query params for request