Module: UVCService

Includes:
HttpRestClient, SpecPdfMapper, VinService
Included in:
BlackbookClient
Defined in:
lib/uvc_service.rb

Constant Summary collapse

VEHICLE_BY_UVC_URL =
"#{BASE_URL}/UsedCarWS/UsedCarWS/UsedVehicle/UVC".freeze
PDF_SPEC_BY_UVC_URL =
"#{BASE_URL}/UsedCarWS/UsedCarWS/PDFSpecs".freeze

Constants included from HttpRestClient

HttpRestClient::BASE_URL

Constants included from VinService

VinService::VEHICLE_BY_VIN_URL

Instance Method Summary collapse

Methods included from HttpRestClient

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

Methods included from VinService

#range_by_vin, #uvc_by_vin

Methods included from RangeValuesMapper

map_fields

Methods included from UvcMapper

map_fields

Methods included from SpecPdfMapper

map_fields

Instance Method Details

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

This method is used by web-system to generate vehicle spec pdfs for appraisers



32
33
34
35
36
# File 'lib/uvc_service.rb', line 32

def pdf_data_by_vin(vin, query_params = {})
  response = uvc_by_vin(vin, query_params)
  return response unless response.last == 200
  spec_pdf_data(response.first[:uvc], query_params)
end

#range_by_uvc(uvc_id, query_params = {}) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/uvc_service.rb', line 15

def range_by_uvc(uvc_id, query_params = {})
  url = "#{VEHICLE_BY_UVC_URL}/#{uvc_id}"

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

#spec_pdf_data(uvc, query_params = {}) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/uvc_service.rb', line 23

def spec_pdf_data(uvc, query_params = {})
  url = "#{PDF_SPEC_BY_UVC_URL}/#{uvc}"

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