Sha256: 9340967805074c7a3d0a1ed2d23be13784c7619e1bb375a95f5da327224dcb5e

Contents?: true

Size: 770 Bytes

Versions: 1

Compression:

Stored size: 770 Bytes

Contents

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
blackbook_client-0.2.0 lib/vin_service.rb