Class: BlackBook::UsedCars

Inherits:
BaseRequest show all
Defined in:
lib/black_book/used_cars.rb

Class Method Summary collapse

Methods inherited from BaseRequest

client, credentials, operations, request

Class Method Details

.current_valuation_for(vin, mileage, state, options = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/black_book/used_cars.rb', line 8

def current_valuation_for(vin, mileage, state, options={})
  response = request(:get_current_vin_values, {
    "sCountryCode" => "U",
    "sFrequencyCode" => "W",
    "sVIN" => vin,
    "iMileage" => mileage,
    "sState" => state,
    "iExtraCleanAddDeductAdj" => (options[:extra_clean_adjustment] || 0),
    "iCleanAddDeductAdj" => (options[:clean_adjustment] || 0),
    "iAverageAddDeductAdj" => (options[:average_adjustment] || 0),
    "iRoughAddDeductAdj" => (options[:rough_adjustment] || 0),
    "bFillDrilldown" => "false",
    "bReturnMileage" => "true",
    "bReturnAddDeducts" => "true"
  })

  envelope = response.hash[:envelope]

  raise VinNotFound if envelope[:header][:user_credentials][:returncode] == "20"
  raise BlackBookError if envelope[:header][:user_credentials][:returncode] != "0"

  envelope[:body][:current_vin_values_response][:current_vin_values_result]
rescue Savon::SOAPFault => e
  raise BlackBookError.new e
end

.wsdl_urlObject



4
5
6
# File 'lib/black_book/used_cars.rb', line 4

def wsdl_url
  "https://www.blackbookws.com/UsedCarWSX.asmx?WSDL"
end