Module: Edmunds::Request

Included in:
Api
Defined in:
lib/edmunds/request.rb

Constant Summary collapse

API_URL =
'https://api.edmunds.com/api'
API_VERSION =
Edmunds.configuration.api_version.to_s
DEFAULT_TIMEOUT =
15

Instance Method Summary collapse

Instance Method Details

#api_call(api_path, path, options = {}) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/edmunds/request.rb', line 8

def api_call(api_path, path, options={})
  url = build_api_url api_path, path
  request_params = merge_required_params options
  raise 'No api_key found' if request_params[:api_key].empty?
  response = HTTP.timeout(*timeout).headers(http_headers).get(url, params: request_params)
  parse_response response
end