Ruby Quickstart Guide
Get started with CarsXE's Ruby gem to integrate comprehensive vehicle data into your Ruby applications.
The CarsXE Ruby gem provides a simple and powerful way to integrate vehicle data into your Ruby applications. This guide will help you get started quickly.
For more information, see the gem on RubyGems.
Installation
Install the CarsXE Ruby gem using gem or bundler:
gem install carsxe
Or add it to your Gemfile:
Gemfile
gem 'carsxe' Then run bundle install.
Setup
First, require the CarsXE client and initialize it with your API key:
app.rb
require 'carsxe' # Initialize the client
API_KEY = 'YOUR_API_KEY_HERE'
carsxe = Carsxe::CarsXE.new(api_key: API_KEY)Basic Usage
VIN Specifications
app.rb
vin = 'WBAFR7C57CC811956'
begin
vehicle = carsxe.specs('vin' => vin)
puts vehicle['input']['vin']
rescue StandardError => error
puts "Error: #{error.message}"
endInternational VIN Decoder
app.rb
begin
intvin = carsxe.int_vin_decoder('vin' => 'WF0MXXGBWM8R43240')
puts intvin
rescue StandardError => error
puts "Error: #{error.message}"
endMarket Value
app.rb
begin
marketvalue = carsxe.market_value('vin' => 'WBAFR7C57CC811956')
puts marketvalue
rescue StandardError => error
puts "Error: #{error.message}"
endVehicle History
app.rb
begin
history = carsxe.history('vin' => 'WBAFR7C57CC811956')
puts history
rescue StandardError => error
puts "Error: #{error.message}"
endLicense Plate Decoder
app.rb
begin
decoded_plate = carsxe.plate_decoder('plate' => '7XER187', 'state' => 'CA', 'country' => 'US')
puts decoded_plate
rescue StandardError => error
puts "Error: #{error.message}"
endVehicle Images
app.rb
begin
images = carsxe.images('make' => 'BMW', 'model' => 'X5', 'year' => '2019')
puts images
rescue StandardError => error
puts "Error: #{error.message}"
endVehicle Recalls
app.rb
begin
recalls = carsxe.recalls('vin' => '1C4JJXR64PW696340')
puts recalls
rescue StandardError => error
puts "Error: #{error.message}"
endPlate Image Recognition
app.rb
begin
plateimg = carsxe.plate_image_recognition('upload_url' =>
'https://api.carsxe.com/img/apis/plate_recognition.JPG')
puts plateimg
rescue StandardError => error
puts "Error: #{error.message}"
endVIN OCR from Image
app.rb
begin
vinocr = carsxe.vin_ocr('upload_url' => 'https://api.carsxe.com/img/apis/plate_recognition.JPG')
puts vinocr
rescue StandardError => error
puts "Error: #{error.message}"
endYear-Make-Model Search
app.rb
begin
yymm = carsxe.year_make_model('year' => '2012', 'make' => 'BMW', 'model' => '5 Series')
puts yymm
rescue StandardError => error
puts "Error: #{error.message}"
endOBD Code Decoder
app.rb
begin
obdcode = carsxe.obd_codes_decoder('code' => 'P0115')
puts obdcode
rescue StandardError => error
puts "Error: #{error.message}"
endLien and Theft
app.rb
begin
lien_and_theft = carsxe.lien_and_theft('vin' => '2C3CDXFG1FH762860')
puts lien_and_theft
rescue StandardError => error
puts "Error: #{error.message}"
endStart building powerful automotive applications with CarsXE's Ruby gem!