Module: VinService

Includes:
HttpRestClient, RangeValuesMapper, UvcMapper
Included in:
BlackbookClient, UVCService
Defined in:
lib/vin_service.rb

Constant Summary collapse

VEHICLE_BY_VIN_URL =
"#{BASE_URL}/UsedCarWS/UsedCarWS/UsedVehicle/VIN".freeze

Constants included from HttpRestClient

HttpRestClient::BASE_URL

Instance Method Summary collapse

Methods included from HttpRestClient

#headers, #make_request, #map_fields, #message_with_error, #process_response

Methods included from RangeValuesMapper

map_fields

Methods included from UvcMapper

map_fields

Instance Method Details

#range_by_vin(vin, query_params = {}) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/vin_service.rb', line 12

def range_by_vin(vin, query_params = {})
  url = "#{VEHICLE_BY_VIN_URL}/#{vin}"

  response = make_request(:get, url, query_params)
  return response unless response.last == 200
  [RangeValuesMapper.map_fields(response.first), response.last]
end

#uvc_by_vin(vin, query_params = {}) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/vin_service.rb', line 20

def uvc_by_vin(vin, query_params = {})
  url = "#{VEHICLE_BY_VIN_URL}/#{vin}"

  response = make_request(:get, url, query_params)
  return response unless response.last == 200
  [UvcMapper.map_fields(response.first), response.last]
end