Skip to content

autoapicom/auto-api-ruby

Repository files navigation

auto-api-client-ruby

Gem Version Ruby License

Ruby gem for the auto-api.com car listings API — 8 marketplaces, one client.

encar, mobile.de, autoscout24, che168, dongchedi, guazi, dubicars, dubizzle. No dependencies beyond stdlib (net/http + json).

Installation

gem install auto-api-client

Or add to your Gemfile:

gem "auto-api-client"

Usage

client = AutoApi::Client.new("your-api-key", "https://api1.auto-api.com")

Get filters

filters = client.get_filters("encar")

Search offers

offers = client.get_offers("mobilede", page: 1, brand: "BMW", year_from: 2020)

# Pagination
puts offers["meta"]["page"]
puts offers["meta"]["next_page"]

Get single offer

offer = client.get_offer("encar", "40427050")

Track changes

change_id = client.get_change_id("encar", "2025-01-15")
changes = client.get_changes("encar", change_id)

# Next batch
next_batch = client.get_changes("encar", changes["meta"]["next_change_id"])

Get offer by URL

info = client.get_offer_by_url("https://encar.com/dc/dc_cardetailview.do?carid=40427050")

Decode offer data

The data hash structure depends on the source — each marketplace has its own set of fields:

offers["result"].each do |item|
  data = item["data"]
  puts "#{data['mark']} #{data['model']} #{data['year']} — $#{data['price']}"
end

Error handling

begin
  offers = client.get_offers("encar", page: 1)
rescue AutoApi::AuthError => e
  # 401/403 — invalid API key
  puts "#{e.status_code}: #{e.message}"
rescue AutoApi::ApiError => e
  # Any other API error
  puts "#{e.status_code}: #{e.message}"
  puts e.response_body
end

Supported sources

Source Platform Region
encar encar.com South Korea
mobilede mobile.de Germany
autoscout24 autoscout24.com Europe
che168 che168.com China
dongchedi dongchedi.com China
guazi guazi.com China
dubicars dubicars.com UAE
dubizzle dubizzle.com UAE

Other languages

Language Package
PHP autoapi/client
TypeScript @autoapicom/client
Python autoapicom-client
Go auto-api-go
C# AutoApi.Client
Java auto-api-client
Rust auto-api-client

Documentation

auto-api.com

About

Ruby gem for auto-api.com. Access car listings from encar, mobile.de, autoscout24 and 5 other marketplaces

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages