vehiclesdb 0.1.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ddd74fa0a497549ce1320d4859903850c50194a49cd6066f8f085d23fc6b02fb
4
- data.tar.gz: bc0cc1609d2f8d7cf129b3f64fb85b99fd2c7d0c7e8a139e6c3580d125c1fac6
3
+ metadata.gz: dde2ac5c435c6df12e8818caa6f350f9f54412798a4894b8e62101a129febaab
4
+ data.tar.gz: 0fc2895e7d6613cec3875b502e72309564d9d78eaa89018a52b601b82ce9dd6a
5
5
  SHA512:
6
- metadata.gz: 70fd6c47778a661e5d124aa4cae9507d755758912d9e80a250cbb7545c00e9ef6fcdd97eac6faf83476aef5a04467cc9c78d8944234133c1033e38a7cd2fdb76
7
- data.tar.gz: 361c00023f83304dce6106cf0a78528f2473f342e5d090c716292cb53f4facf9b8423d5d375cb71120d443a9738d7326f36bfe67c966be8180b75f124f03abc9
6
+ metadata.gz: ca2865c531d54eaf107eb637b489453010cdc583c787509dd79b0d1257b7b5847f78133ca21a98601f98d2ecf917b6ae5b98301f113b1b365f57a458d1c6286f
7
+ data.tar.gz: 99f2ced3f37b437a8015b31afc6c6bd46dcbf266b7b828c36c684e53ced4ed14b566fd7ae8734842f0ded7e7a1c21aaf5bad09edbf303aa8bbaf74503f957274
data/CHANGELOG.md CHANGED
@@ -1,25 +1,15 @@
1
1
  # Changelog
2
2
 
3
- All notable changes to this project are documented in this file.
3
+ ## [0.4.1] - 2026-07-26
4
4
 
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
+ Jump to track `vehicles ~> 0.4` (the alias mirrors the minor it wraps —
6
+ 0.2.0 was prepared but never published, and rubygems still served 0.1.0
7
+ with the old dataset). Brings the 2026.07.4 correction-pass data and the
8
+ 0.3/0.4 API additions: continent filters, rarity tiers, alternate names,
9
+ and the "Other / not in the list" escape hatch.
7
10
 
8
- ## [Unreleased]
11
+ ## [0.2.0] - 2026-07-05
9
12
 
10
- ## [0.1.0] - 2026-06-23
11
-
12
- Initial release — the shell. Reserves the gem and establishes its shape ahead of
13
- the VehiclesDB API going public.
14
-
15
- ### Added
16
- - `VehiclesDB.configure` + `VehiclesDB::Configuration` (api_key — defaults from
17
- `ENV["VEHICLESDB_API_KEY"]` — api_base_url, timeout, user_agent).
18
- - `VehiclesDB::Client` with auth/JSON/timeout request plumbing and a
19
- `configured?` check; `VehiclesDB.client` memoized default client.
20
- - Error hierarchy: `VehiclesDB::Error` < `ConfigurationError` / `AuthenticationError` / `ApiError`.
21
-
22
- Resource methods (model, image, …) land as the API ships.
23
-
24
- [Unreleased]: https://github.com/rameerez/vehiclesdb-ruby/compare/v0.1.0...HEAD
25
- [0.1.0]: https://github.com/rameerez/vehiclesdb-ruby/releases/tag/v0.1.0
13
+ `vehiclesdb` becomes the official alias of the `vehicles` gem (same API,
14
+ `VehiclesDB` constant). The previous unreleased API-client shell is gone —
15
+ the hosted-API seam lives inside `vehicles` itself.
data/README.md CHANGED
@@ -1,82 +1,29 @@
1
- # 🚗 `vehiclesdb` Official Ruby SDK for the VehiclesDB API
1
+ # `vehiclesdb` official alias of [`vehicles`](https://github.com/vehiclesdb/vehicles)
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/vehiclesdb.svg)](https://badge.fury.io/rb/vehiclesdb) [![Build Status](https://github.com/rameerez/vehiclesdb-ruby/workflows/Tests/badge.svg)](https://github.com/rameerez/vehiclesdb-ruby/actions)
4
-
5
- > [!TIP]
6
- > **🚀 Ship your next Rails app 10x faster!** I've built **[RailsFast](https://railsfast.com/?ref=vehiclesdb)**, a production-ready Rails boilerplate template that comes with everything you need to launch a software business in days, not weeks. Go [check it out](https://railsfast.com/?ref=vehiclesdb)!
7
-
8
- `vehiclesdb` is the official Ruby client for the [**VehiclesDB API**](https://vehiclesdb.com) — a hosted service for rich vehicle data: production years, model images (year- and color-accurate), market segments, specifications, and more.
9
-
10
- > [!NOTE]
11
- > **This is an early shell release.** It reserves the gem and sets its shape; the VehiclesDB API isn't public yet, so resource methods (models, images, …) land as the service ships. Configuration, the client, and the error model are in place today.
12
-
13
- ## `vehiclesdb` vs `vehicles` — which do I want?
14
-
15
- Two gems, one product, and they're **fully independent** (each works on its own):
16
-
17
- | | [`vehicles`](https://github.com/rameerez/vehicles) | `vehiclesdb` (this gem) |
18
- |---|---|---|
19
- | What | Bundled make/model dataset + a delightful local API | Thin client for the hosted VehiclesDB API |
20
- | Data | Ships **inside the gem** (EU, offline) | Lives on the **server** (the paid API) |
21
- | Setup | Zero — no key, no network | Needs an API key |
22
- | Use it for | Make/model dropdowns, search, validation | Years, images, segments, specs |
23
-
24
- Most apps want **`vehicles`** — it works offline with zero config. Add **`vehiclesdb`** (and a key) when you want the richer hosted data; `vehicles` will use it automatically for enrichment. Or use `vehiclesdb` directly if all you want is the raw API.
25
-
26
- ## Installation
3
+ This gem is a two-file front door: it depends on
4
+ [**`vehicles`**](https://github.com/vehiclesdb/vehicles) — the Ruby SDK for
5
+ the [VehiclesDB](https://github.com/vehiclesdb/vehiclesdb) open vehicle
6
+ dataset and exposes the identical API under the `VehiclesDB` constant.
27
7
 
28
8
  ```ruby
29
9
  gem "vehiclesdb"
30
10
  ```
31
11
 
32
- ## Usage
33
-
34
12
  ```ruby
35
- VehiclesDB.configure do |config|
36
- config.api_key = ENV["VEHICLESDB_API_KEY"] # or just set ENV["VEHICLESDB_API_KEY"]
37
- end
38
-
39
- VehiclesDB.client.configured? # => true
13
+ VehiclesDB.find("vw golf") # => #<Vehicles::Model "Volkswagen Golf">
14
+ VehiclesDB.top_models(kind: :motorcycle, country: :th, limit: 5)
15
+ VehiclesDB.equal?(Vehicles) # => true — same module, two names
40
16
  ```
41
17
 
42
- You can also build a client explicitly (handy for multiple keys / standalone use):
43
-
44
- ```ruby
45
- client = VehiclesDB::Client.new(api_key: "vdb_live_...")
46
- client.configured? # => true
47
- ```
48
-
49
- ### Errors
50
-
51
- Everything raises a subclass of `VehiclesDB::Error`, so you can rescue broadly or narrowly:
52
-
53
- ```ruby
54
- VehiclesDB::Error # rescue-all base
55
- VehiclesDB::ConfigurationError # no API key configured
56
- VehiclesDB::AuthenticationError # bad key (HTTP 401/403)
57
- VehiclesDB::ApiError # other non-2xx — carries #status and #body
58
- ```
59
-
60
- ## Configuration
61
-
62
- | Option | Default | Notes |
63
- |---|---|---|
64
- | `api_key` | `ENV["VEHICLESDB_API_KEY"]` | your VehiclesDB key |
65
- | `api_base_url` | `https://api.vehiclesdb.com` | override for staging/self-host/tests |
66
- | `timeout` | `5` | request timeout (seconds) |
67
- | `user_agent` | `vehiclesdb-ruby/<version>` | sent with every request |
68
-
69
- ## Development
70
-
71
- After checking out the repo, run `bin/setup` to install dependencies. Then run
72
- `rake test`. You can also run `bin/console` for an interactive prompt.
73
-
74
- To install this gem onto your local machine, run `bundle exec rake install`.
75
-
76
- ## Contributing
77
-
78
- Bug reports and pull requests are welcome on GitHub at https://github.com/rameerez/vehiclesdb-ruby. Our code of conduct is: just be nice and make your mom proud of what you do and post online.
18
+ **Why two names?** The project is bigger than Ruby: the dataset lives at
19
+ [github.com/vehiclesdb/vehiclesdb](https://github.com/vehiclesdb/vehiclesdb)
20
+ and SDKs for other languages follow the `vehiclesdb-<language>` pattern. If
21
+ you found the project through that name, this gem takes you to the right
22
+ place. If you're starting fresh in Ruby, depend on
23
+ [`vehicles`](https://github.com/vehiclesdb/vehicles) directly — it's the
24
+ same thing with the shorter, Rails-idiomatic name.
79
25
 
80
- ## License
26
+ Docs, features, dataset details: **see the
27
+ [`vehicles` README](https://github.com/vehiclesdb/vehicles#readme)**.
81
28
 
82
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
29
+ Code MIT · bundled data CC-BY 4.0 (VehiclesDB).
data/lib/vehiclesdb.rb CHANGED
@@ -1,44 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "vehiclesdb/version"
4
- require_relative "vehiclesdb/error"
5
- require_relative "vehiclesdb/configuration"
6
- require_relative "vehiclesdb/client"
7
-
8
- # VehiclesDB — the official Ruby SDK for the VehiclesDB API
9
- # (https://vehiclesdb.com): a hosted service for rich vehicle data — production
10
- # years, model images (year- and color-accurate), market segments, specs, and more.
11
- #
12
- # This is the low-level API wrapper. If you just want make/model dropdowns that
13
- # work offline with zero setup, use the `vehicles` gem instead — it bundles the
14
- # data locally and reaches for VehiclesDB only for optional hosted enrichment.
15
- # The two are independent: `vehicles` works without this gem, and this gem works
16
- # without `vehicles`.
3
+ # The `vehiclesdb` gem is a thin, official ALIAS of the `vehicles` gem — one
4
+ # require away from the same bundled dataset, lookups, validators, and MCP
5
+ # server. It exists so that people who discover the project through the
6
+ # VehiclesDB name (github.com/vehiclesdb, huggingface.co/vehiclesdb,
7
+ # vehiclesdb.com) can `gem "vehiclesdb"` and land on the real thing, and so
8
+ # the name is defended in the vehiclesdb-<language> SDK family.
17
9
  #
18
- # VehiclesDB.configure { |c| c.api_key = ENV["VEHICLESDB_API_KEY"] }
19
- # VehiclesDB.client.configured? # => true
20
- #
21
- # NOTE: the VehiclesDB API is not public yet. This release reserves the gem and
22
- # establishes its shape; resource methods land as the API ships.
23
- module VehiclesDB
24
- class << self
25
- def configuration
26
- @configuration ||= Configuration.new
27
- end
28
-
29
- def configure
30
- yield(configuration)
31
- end
10
+ # There is deliberately NO separate API client here: the hosted-API seam
11
+ # lives inside `vehicles` (configure an api_key and the providers answer).
12
+ # One codebase, two front doors.
32
13
 
33
- # Reset config + the memoized default client. Mainly for tests.
34
- def reset_configuration!
35
- @configuration = Configuration.new
36
- @client = nil
37
- end
14
+ require "vehicles"
38
15
 
39
- # Memoized default client, built from the global configuration.
40
- def client
41
- @client ||= Client.new
42
- end
43
- end
44
- end
16
+ # Both spellings resolve to the same module — pick whichever reads better:
17
+ # VehiclesDB.find("vw golf") == Vehicles.find("vw golf")
18
+ VehiclesDB = Vehicles
metadata CHANGED
@@ -1,39 +1,34 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vehiclesdb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - rameerez
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2026-06-23 00:00:00.000000000 Z
10
+ date: 2026-07-26 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
- name: faraday
13
+ name: vehicles
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
- - - ">="
16
+ - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: '2.0'
19
- - - "<"
20
- - !ruby/object:Gem::Version
21
- version: '3.0'
18
+ version: '0.4'
22
19
  type: :runtime
23
20
  prerelease: false
24
21
  version_requirements: !ruby/object:Gem::Requirement
25
22
  requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- version: '2.0'
29
- - - "<"
23
+ - - "~>"
30
24
  - !ruby/object:Gem::Version
31
- version: '3.0'
32
- description: 'vehiclesdb is the official Ruby client for the VehiclesDB API (https://vehiclesdb.com),
33
- a hosted service for rich vehicle data: production years, model images (year- and
34
- color-accurate), market segments, specifications, and more. It''s the low-level
35
- API wrapper that the `vehicles` gem uses for optional hosted enrichment — but both
36
- gems are fully independent and usable on their own.'
25
+ version: '0.4'
26
+ description: 'vehiclesdb is a thin, official alias of the `vehicles` gem: the VehiclesDB
27
+ open dataset (~17k vehicle models across cars, motorcycles, mopeds, vans, trucks
28
+ and buses, from official registers of 14 countries) with Rails-friendly lookups,
29
+ dropdown helpers, validators, popularity/availability data, and a bundled MCP server.
30
+ Installing this gem installs `vehicles` and exposes the same API under the VehiclesDB
31
+ constant. If in doubt, depend on `vehicles` directly.'
37
32
  email:
38
33
  - rubygems@rameerez.com
39
34
  executables: []
@@ -44,19 +39,14 @@ files:
44
39
  - LICENSE.txt
45
40
  - README.md
46
41
  - lib/vehiclesdb.rb
47
- - lib/vehiclesdb/client.rb
48
- - lib/vehiclesdb/configuration.rb
49
- - lib/vehiclesdb/error.rb
50
- - lib/vehiclesdb/version.rb
51
- - sig/vehiclesdb.rbs
52
- homepage: https://github.com/rameerez/vehiclesdb-ruby
42
+ homepage: https://github.com/vehiclesdb/vehiclesdb-ruby
53
43
  licenses:
54
44
  - MIT
55
45
  metadata:
56
46
  allowed_push_host: https://rubygems.org
57
- homepage_uri: https://github.com/rameerez/vehiclesdb-ruby
58
- source_code_uri: https://github.com/rameerez/vehiclesdb-ruby/tree/main
59
- changelog_uri: https://github.com/rameerez/vehiclesdb-ruby/blob/main/CHANGELOG.md
47
+ homepage_uri: https://github.com/vehiclesdb/vehiclesdb-ruby
48
+ source_code_uri: https://github.com/vehiclesdb/vehiclesdb-ruby/tree/main
49
+ changelog_uri: https://github.com/vehiclesdb/vehiclesdb-ruby/blob/main/CHANGELOG.md
60
50
  rubygems_mfa_required: 'true'
61
51
  rdoc_options: []
62
52
  require_paths:
@@ -74,6 +64,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
64
  requirements: []
75
65
  rubygems_version: 3.6.2
76
66
  specification_version: 4
77
- summary: Official Ruby SDK for the VehiclesDB APIrich vehicle data (years, images,
78
- segments, specs).
67
+ summary: Official alias of the `vehicles` gemthe VehiclesDB open vehicle dataset
68
+ for Ruby.
79
69
  test_files: []
@@ -1,61 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "faraday"
4
-
5
- module VehiclesDB
6
- # A thin client over the VehiclesDB HTTP API. Standalone: construct one
7
- # directly, or use `VehiclesDB.client` (which reads the global configuration).
8
- #
9
- # client = VehiclesDB::Client.new(api_key: "vdb_...")
10
- # client.configured? # => true
11
- #
12
- # The request plumbing (auth header, JSON, timeout, error mapping) is ready;
13
- # resource methods (e.g. `model`, `image`) are added as the API ships — they'll
14
- # build on the private `get` below. Kept deliberately small for now: this
15
- # release reserves the gem and sets the shape.
16
- class Client
17
- attr_reader :api_key, :api_base_url, :timeout
18
-
19
- def initialize(api_key: nil, api_base_url: nil, timeout: nil)
20
- config = VehiclesDB.configuration
21
- @api_key = api_key || config.api_key
22
- @api_base_url = api_base_url || config.api_base_url
23
- @timeout = timeout || config.timeout
24
- end
25
-
26
- # True when an API key is present (the client can authenticate).
27
- def configured?
28
- !api_key.to_s.empty?
29
- end
30
-
31
- private
32
-
33
- # GET a JSON resource and return the parsed body. Raises ConfigurationError
34
- # when unconfigured, AuthenticationError on 401/403, ApiError otherwise. The
35
- # caller decides whether to rescue. Resource methods will wrap this.
36
- def get(path, params = {})
37
- raise ConfigurationError, "No VehiclesDB API key configured" unless configured?
38
-
39
- handle(connection.get(path, params))
40
- end
41
-
42
- def handle(response)
43
- return response.body if response.success?
44
- raise AuthenticationError, "Invalid VehiclesDB API key" if [401, 403].include?(response.status)
45
-
46
- raise ApiError.new("VehiclesDB API error (HTTP #{response.status})",
47
- status: response.status, body: response.body)
48
- end
49
-
50
- def connection
51
- @connection ||= Faraday.new(url: api_base_url) do |f|
52
- f.request :json
53
- f.response :json
54
- f.headers["Authorization"] = "Bearer #{api_key}"
55
- f.headers["User-Agent"] = VehiclesDB.configuration.user_agent
56
- f.options.timeout = timeout
57
- f.adapter Faraday.default_adapter
58
- end
59
- end
60
- end
61
- end
@@ -1,30 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module VehiclesDB
4
- # Global configuration. Sensible defaults; the API key is picked up from
5
- # ENV["VEHICLESDB_API_KEY"] automatically, so the common case needs no setup.
6
- #
7
- # VehiclesDB.configure do |config|
8
- # config.api_key = "vdb_live_..."
9
- # end
10
- class Configuration
11
- # Your VehiclesDB API key. Defaults to ENV["VEHICLESDB_API_KEY"].
12
- attr_accessor :api_key
13
-
14
- # Base URL of the API. Overridable for self-hosting / staging / testing.
15
- attr_accessor :api_base_url
16
-
17
- # Request timeout in seconds.
18
- attr_accessor :timeout
19
-
20
- # Sent as the User-Agent header so VehiclesDB can see SDK usage.
21
- attr_accessor :user_agent
22
-
23
- def initialize
24
- @api_key = ENV.fetch("VEHICLESDB_API_KEY", nil)
25
- @api_base_url = "https://api.vehiclesdb.com"
26
- @timeout = 5
27
- @user_agent = "vehiclesdb-ruby/#{VehiclesDB::VERSION}"
28
- end
29
- end
30
- end
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module VehiclesDB
4
- # Base class for every error this gem raises — rescue `VehiclesDB::Error` to
5
- # catch them all.
6
- class Error < StandardError; end
7
-
8
- # No API key configured (or an empty one).
9
- class ConfigurationError < Error; end
10
-
11
- # The API rejected the credentials (HTTP 401/403).
12
- class AuthenticationError < Error; end
13
-
14
- # Any other non-success API response. Carries the HTTP status and parsed body.
15
- class ApiError < Error
16
- attr_reader :status, :body
17
-
18
- def initialize(message = nil, status: nil, body: nil)
19
- @status = status
20
- @body = body
21
- super(message)
22
- end
23
- end
24
- end
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module VehiclesDB
4
- VERSION = "0.1.0"
5
- end
data/sig/vehiclesdb.rbs DELETED
@@ -1,41 +0,0 @@
1
- # Type signatures for the public API. (Best-effort; the README and code are the
2
- # source of truth.)
3
-
4
- module VehiclesDB
5
- VERSION: String
6
-
7
- def self.configuration: () -> Configuration
8
- def self.configure: () { (Configuration) -> void } -> void
9
- def self.reset_configuration!: () -> void
10
- def self.client: () -> Client
11
-
12
- class Error < StandardError
13
- end
14
-
15
- class ConfigurationError < Error
16
- end
17
-
18
- class AuthenticationError < Error
19
- end
20
-
21
- class ApiError < Error
22
- attr_reader status: Integer?
23
- attr_reader body: untyped
24
- def initialize: (?String?, ?status: Integer?, ?body: untyped) -> void
25
- end
26
-
27
- class Configuration
28
- attr_accessor api_key: String?
29
- attr_accessor api_base_url: String
30
- attr_accessor timeout: Integer
31
- attr_accessor user_agent: String
32
- end
33
-
34
- class Client
35
- attr_reader api_key: String?
36
- attr_reader api_base_url: String
37
- attr_reader timeout: Integer
38
- def initialize: (?api_key: String?, ?api_base_url: String?, ?timeout: Integer?) -> void
39
- def configured?: () -> bool
40
- end
41
- end