Sha256: 54d379eb0c9e1294e369d9c9f33eaf8d663b39f6660b2c38f98523e61e4def12

Contents?: true

Size: 779 Bytes

Versions: 3

Compression:

Stored size: 779 Bytes

Contents

require 'http_rest_client'
require 'mappers/uvc_mapper'
require 'mappers/range_values_mapper'

module VinService
  include UvcMapper
  include RangeValuesMapper
  include HttpRestClient

  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

3 entries across 3 versions & 1 rubygems

Version Path
blackbook_client-1.0.1 lib/vin_service.rb
blackbook_client-1.0.0 lib/vin_service.rb
blackbook_client-0.2.1 lib/vin_service.rb