require 'rest_client' require 'mappers/uvc_mapper' require 'mappers/range_values_mapper' module VinService include RestClient include UvcMapper include RangeValuesMapper VEHICLE_BY_VIN_URL = "#{BASE_URL}/UsedCarWS/UsedCarWS/UsedVehicle/VIN".freeze 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 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 end