Module: VehiclesDB

Defined in:
lib/vehiclesdb.rb,
lib/vehiclesdb/error.rb,
lib/vehiclesdb/client.rb,
lib/vehiclesdb/version.rb,
lib/vehiclesdb/configuration.rb

Overview

VehiclesDB — the official Ruby SDK for the VehiclesDB API (vehiclesdb.com): a hosted service for rich vehicle data — production years, model images (year- and color-accurate), market segments, specs, and more.

This is the low-level API wrapper. If you just want make/model dropdowns that work offline with zero setup, use the ‘vehicles` gem instead — it bundles the data locally and reaches for VehiclesDB only for optional hosted enrichment. The two are independent: `vehicles` works without this gem, and this gem works without `vehicles`.

VehiclesDB.configure { |c| c.api_key = ENV["VEHICLESDB_API_KEY"] }
VehiclesDB.client.configured?   # => true

NOTE: the VehiclesDB API is not public yet. This release reserves the gem and establishes its shape; resource methods land as the API ships.

Defined Under Namespace

Classes: ApiError, AuthenticationError, Client, Configuration, ConfigurationError, Error

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.clientObject

Memoized default client, built from the global configuration.



40
41
42
# File 'lib/vehiclesdb.rb', line 40

def client
  @client ||= Client.new
end

.configurationObject



25
26
27
# File 'lib/vehiclesdb.rb', line 25

def configuration
  @configuration ||= Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yields:



29
30
31
# File 'lib/vehiclesdb.rb', line 29

def configure
  yield(configuration)
end

.reset_configuration!Object

Reset config + the memoized default client. Mainly for tests.



34
35
36
37
# File 'lib/vehiclesdb.rb', line 34

def reset_configuration!
  @configuration = Configuration.new
  @client = nil
end