carsxe 1.2.0 → 1.3.0
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 +4 -4
- data/CHANGELOG.md +9 -5
- data/README.md +516 -316
- data/lib/carsxe/carsxe.rb +60 -10
- data/lib/carsxe/types.rb +73 -22
- data/lib/carsxe/version.rb +5 -5
- data/lib/carsxe.rb +1 -1
- metadata +1 -2
- data/carsxe-1.1.1.gem +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3e35bd5083bfa0a5a86f4f632bec00dba447d566093e52246d3d71788ddfe7ab
|
|
4
|
+
data.tar.gz: d4b13f4c039f7d492fdeee710e310e1a15f02b66ec69d6bd75d27eecd3266189
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3b5f42e345655bfac2d0a3641bd6bfeb6033642ff50a0d1cf6e0e05ba3d1a2beaec2091106b11ce624c3f71d2e083ce811ba984a43098b1044959cd43f4dec0e
|
|
7
|
+
data.tar.gz: ffb7fa7f87f1a9b35d71fc4dce94c6d3f56ef9c0bcf9ce39d29cc1e71c4587d7c6312423fbdd7cad4e344af3994a260b704ce7a3918feda475972192dd521b83
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -1,316 +1,516 @@
|
|
|
1
|
-
# 🚗 CarsXE API (Ruby Gem)
|
|
2
|
-
|
|
3
|
-
[](https://rubygems.org/gems/carsxe)
|
|
4
|
-
|
|
5
|
-
**CarsXE** is a powerful and developer-friendly API that gives you instant access to a wide range of vehicle data. From VIN decoding and market value estimation to vehicle history, images, OBD code explanations, and plate recognition, CarsXE provides everything you need to build automotive applications at scale.
|
|
6
|
-
|
|
7
|
-
🌐 **Website:** [https://api.carsxe.com](https://api.carsxe.com)
|
|
8
|
-
📄 **Docs:** [https://api.carsxe.com/docs](https://api.carsxe.com/docs)
|
|
9
|
-
📦 **All Products:** [https://api.carsxe.com/all-products](https://api.carsxe.com/all-products)
|
|
10
|
-
|
|
11
|
-
To get started with the CarsXE API, follow these steps:
|
|
12
|
-
|
|
13
|
-
1. **Sign up for a CarsXE account:**
|
|
14
|
-
- [Register here](https://api.carsxe.com/register)
|
|
15
|
-
- Add a [payment method](https://api.carsxe.com/dashboard/billing#payment-methods) to activate your subscription and get your API key.
|
|
16
|
-
|
|
17
|
-
2. **Install the CarsXE Ruby gem:**
|
|
18
|
-
|
|
19
|
-
Run this command in your terminal:
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
gem install carsxe
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
Or add it to your Gemfile:
|
|
26
|
-
|
|
27
|
-
```ruby
|
|
28
|
-
gem 'carsxe'
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
Then run `bundle install`.
|
|
32
|
-
|
|
33
|
-
3. **Require the CarsXE API in your code:**
|
|
34
|
-
|
|
35
|
-
```ruby
|
|
36
|
-
require 'carsxe'
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
4. **Initialize the API with your API key:**
|
|
40
|
-
|
|
41
|
-
```ruby
|
|
42
|
-
API_KEY = 'YOUR_API_KEY'
|
|
43
|
-
carsxe = Carsxe::CarsXE.new(api_key: API_KEY)
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
5. **Use the various endpoint methods provided by the API to access the data you need.**
|
|
47
|
-
|
|
48
|
-
## Usage
|
|
49
|
-
|
|
50
|
-
```ruby
|
|
51
|
-
vin = 'WBAFR7C57CC811956'
|
|
52
|
-
|
|
53
|
-
begin
|
|
54
|
-
vehicle = carsxe.specs('vin' => vin)
|
|
55
|
-
puts vehicle['input']['vin']
|
|
56
|
-
rescue StandardError => error
|
|
57
|
-
puts "Error: #{error.message}"
|
|
58
|
-
end
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
---
|
|
62
|
-
|
|
63
|
-
## 📚 Endpoints
|
|
64
|
-
|
|
65
|
-
The CarsXE API provides the following endpoint methods:
|
|
66
|
-
|
|
67
|
-
### `specs` – Decode VIN & get full vehicle specifications
|
|
68
|
-
|
|
69
|
-
**Required:**
|
|
70
|
-
|
|
71
|
-
- `vin`
|
|
72
|
-
|
|
73
|
-
**Optional:**
|
|
74
|
-
|
|
75
|
-
- `deepdata`
|
|
76
|
-
- `disableIntVINDecoding`
|
|
77
|
-
|
|
78
|
-
**Example:**
|
|
79
|
-
|
|
80
|
-
```ruby
|
|
81
|
-
vehicle = carsxe.specs('vin' => 'WBAFR7C57CC811956')
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
---
|
|
85
|
-
|
|
86
|
-
### `int_vin_decoder` – Decode VIN with worldwide support
|
|
87
|
-
|
|
88
|
-
**Required:**
|
|
89
|
-
|
|
90
|
-
- `vin`
|
|
91
|
-
|
|
92
|
-
**Optional:**
|
|
93
|
-
|
|
94
|
-
- None
|
|
95
|
-
|
|
96
|
-
**Example:**
|
|
97
|
-
|
|
98
|
-
```ruby
|
|
99
|
-
intvin = carsxe.int_vin_decoder('vin' => 'WF0MXXGBWM8R43240')
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
---
|
|
103
|
-
|
|
104
|
-
### `plate_decoder` – Decode license plate info (plate, country)
|
|
105
|
-
|
|
106
|
-
**Required:**
|
|
107
|
-
|
|
108
|
-
- `plate`
|
|
109
|
-
- `country` (always required except for US, where it is optional and defaults to 'US')
|
|
110
|
-
|
|
111
|
-
**Optional:**
|
|
112
|
-
|
|
113
|
-
- `state` (required for some countries, e.g. US, AU, CA)
|
|
114
|
-
- `district` (required for Pakistan)
|
|
115
|
-
|
|
116
|
-
> **Note:**
|
|
117
|
-
>
|
|
118
|
-
> - The `state` parameter is required only when applicable (for
|
|
119
|
-
> specific countries such as US, AU, CA, etc.).
|
|
120
|
-
> - For Pakistan (`country='pk'`), both `state` and `district`
|
|
121
|
-
> are required.
|
|
122
|
-
|
|
123
|
-
**Example:**
|
|
124
|
-
|
|
125
|
-
```ruby
|
|
126
|
-
decoded_plate = carsxe.plate_decoder('plate' => '7XER187', 'state' => 'CA', 'country' => 'US')
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
---
|
|
130
|
-
|
|
131
|
-
### `market_value` – Estimate vehicle market value based on VIN
|
|
132
|
-
|
|
133
|
-
**Required:**
|
|
134
|
-
|
|
135
|
-
- `vin`
|
|
136
|
-
|
|
137
|
-
**Optional:**
|
|
138
|
-
|
|
139
|
-
- `state`
|
|
140
|
-
- `mileage`
|
|
141
|
-
- `condition`
|
|
142
|
-
|
|
143
|
-
**Example:**
|
|
144
|
-
|
|
145
|
-
```ruby
|
|
146
|
-
marketvalue = carsxe.market_value('vin' => 'WBAFR7C57CC811956', 'state' => 'CA', 'mileage' => '80000', 'condition' => 'good')
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
---
|
|
150
|
-
|
|
151
|
-
### `history` – Retrieve vehicle history
|
|
152
|
-
|
|
153
|
-
**Required:**
|
|
154
|
-
|
|
155
|
-
- `vin`
|
|
156
|
-
|
|
157
|
-
**Optional:**
|
|
158
|
-
|
|
159
|
-
- None
|
|
160
|
-
|
|
161
|
-
**Example:**
|
|
162
|
-
|
|
163
|
-
```ruby
|
|
164
|
-
history = carsxe.history('vin' => 'WBAFR7C57CC811956')
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
---
|
|
168
|
-
|
|
169
|
-
### `images` – Fetch images by make, model, year, trim
|
|
170
|
-
|
|
171
|
-
**Required:**
|
|
172
|
-
|
|
173
|
-
- `make`
|
|
174
|
-
- `model`
|
|
175
|
-
|
|
176
|
-
**Optional:**
|
|
177
|
-
|
|
178
|
-
- `year`
|
|
179
|
-
- `trim`
|
|
180
|
-
- `color`
|
|
181
|
-
- `transparent`
|
|
182
|
-
- `angle`
|
|
183
|
-
- `photoType`
|
|
184
|
-
- `size`
|
|
185
|
-
- `license`
|
|
186
|
-
|
|
187
|
-
**Example:**
|
|
188
|
-
|
|
189
|
-
```ruby
|
|
190
|
-
images = carsxe.images('make' => 'BMW', 'model' => 'X5', 'year' => '2019')
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
---
|
|
194
|
-
|
|
195
|
-
### `recalls` – Get safety recall data for a VIN
|
|
196
|
-
|
|
197
|
-
**Required:**
|
|
198
|
-
|
|
199
|
-
- `vin`
|
|
200
|
-
|
|
201
|
-
**Optional:**
|
|
202
|
-
|
|
203
|
-
- None
|
|
204
|
-
|
|
205
|
-
**Example:**
|
|
206
|
-
|
|
207
|
-
```ruby
|
|
208
|
-
recalls = carsxe.recalls('vin' => '1C4JJXR64PW696340')
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
---
|
|
212
|
-
|
|
213
|
-
### `plate_image_recognition` – Read & decode plates from images
|
|
214
|
-
|
|
215
|
-
**Required:**
|
|
216
|
-
|
|
217
|
-
- `upload_url`
|
|
218
|
-
|
|
219
|
-
**Optional:**
|
|
220
|
-
|
|
221
|
-
- None
|
|
222
|
-
|
|
223
|
-
**Example:**
|
|
224
|
-
|
|
225
|
-
```ruby
|
|
226
|
-
plateimg = carsxe.plate_image_recognition('upload_url' => 'https://api.carsxe.com/img/apis/plate_recognition.JPG')
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
---
|
|
230
|
-
|
|
231
|
-
### `vin_ocr` – Extract VINs from images using OCR
|
|
232
|
-
|
|
233
|
-
**Required:**
|
|
234
|
-
|
|
235
|
-
- `upload_url`
|
|
236
|
-
|
|
237
|
-
**Optional:**
|
|
238
|
-
|
|
239
|
-
- None
|
|
240
|
-
|
|
241
|
-
**Example:**
|
|
242
|
-
|
|
243
|
-
```ruby
|
|
244
|
-
vinocr = carsxe.vin_ocr('upload_url' => 'https://api.carsxe.com/img/apis/plate_recognition.JPG')
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
---
|
|
248
|
-
|
|
249
|
-
### `year_make_model` – Query vehicle by year, make, model and trim (optional)
|
|
250
|
-
|
|
251
|
-
**Required:**
|
|
252
|
-
|
|
253
|
-
- `year`
|
|
254
|
-
- `make`
|
|
255
|
-
- `model`
|
|
256
|
-
|
|
257
|
-
**Optional:**
|
|
258
|
-
|
|
259
|
-
- `trim`
|
|
260
|
-
|
|
261
|
-
**Example:**
|
|
262
|
-
|
|
263
|
-
```ruby
|
|
264
|
-
yymm = carsxe.year_make_model('year' => '2012', 'make' => 'BMW', 'model' => '5 Series')
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
---
|
|
268
|
-
|
|
269
|
-
### `obd_codes_decoder` – Decode OBD error/diagnostic codes
|
|
270
|
-
|
|
271
|
-
**Required:**
|
|
272
|
-
|
|
273
|
-
- `code`
|
|
274
|
-
|
|
275
|
-
**Optional:**
|
|
276
|
-
|
|
277
|
-
- None
|
|
278
|
-
|
|
279
|
-
**Example:**
|
|
280
|
-
|
|
281
|
-
```ruby
|
|
282
|
-
obdcode = carsxe.obd_codes_decoder('code' => 'P0115')
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
---
|
|
286
|
-
|
|
287
|
-
### `lien_and_theft` – Check for lien and theft records
|
|
288
|
-
|
|
289
|
-
**Required:**
|
|
290
|
-
|
|
291
|
-
- `vin`
|
|
292
|
-
|
|
293
|
-
**Optional:**
|
|
294
|
-
|
|
295
|
-
- None
|
|
296
|
-
|
|
297
|
-
**Example:**
|
|
298
|
-
|
|
299
|
-
```ruby
|
|
300
|
-
lientheft = carsxe.lien_and_theft('vin' => '2C3CDXFG1FH762860')
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
---
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
-
|
|
310
|
-
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
1
|
+
# 🚗 CarsXE API (Ruby Gem)
|
|
2
|
+
|
|
3
|
+
[](https://rubygems.org/gems/carsxe)
|
|
4
|
+
|
|
5
|
+
**CarsXE** is a powerful and developer-friendly API that gives you instant access to a wide range of vehicle data. From VIN decoding and market value estimation to vehicle history, images, OBD code explanations, and plate recognition, CarsXE provides everything you need to build automotive applications at scale.
|
|
6
|
+
|
|
7
|
+
🌐 **Website:** [https://api.carsxe.com](https://api.carsxe.com)
|
|
8
|
+
📄 **Docs:** [https://api.carsxe.com/docs](https://api.carsxe.com/docs)
|
|
9
|
+
📦 **All Products:** [https://api.carsxe.com/all-products](https://api.carsxe.com/all-products)
|
|
10
|
+
|
|
11
|
+
To get started with the CarsXE API, follow these steps:
|
|
12
|
+
|
|
13
|
+
1. **Sign up for a CarsXE account:**
|
|
14
|
+
- [Register here](https://api.carsxe.com/register)
|
|
15
|
+
- Add a [payment method](https://api.carsxe.com/dashboard/billing#payment-methods) to activate your subscription and get your API key.
|
|
16
|
+
|
|
17
|
+
2. **Install the CarsXE Ruby gem:**
|
|
18
|
+
|
|
19
|
+
Run this command in your terminal:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
gem install carsxe
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Or add it to your Gemfile:
|
|
26
|
+
|
|
27
|
+
```ruby
|
|
28
|
+
gem 'carsxe'
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Then run `bundle install`.
|
|
32
|
+
|
|
33
|
+
3. **Require the CarsXE API in your code:**
|
|
34
|
+
|
|
35
|
+
```ruby
|
|
36
|
+
require 'carsxe'
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
4. **Initialize the API with your API key:**
|
|
40
|
+
|
|
41
|
+
```ruby
|
|
42
|
+
API_KEY = 'YOUR_API_KEY'
|
|
43
|
+
carsxe = Carsxe::CarsXE.new(api_key: API_KEY)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
5. **Use the various endpoint methods provided by the API to access the data you need.**
|
|
47
|
+
|
|
48
|
+
## Usage
|
|
49
|
+
|
|
50
|
+
```ruby
|
|
51
|
+
vin = 'WBAFR7C57CC811956'
|
|
52
|
+
|
|
53
|
+
begin
|
|
54
|
+
vehicle = carsxe.specs('vin' => vin)
|
|
55
|
+
puts vehicle['input']['vin']
|
|
56
|
+
rescue StandardError => error
|
|
57
|
+
puts "Error: #{error.message}"
|
|
58
|
+
end
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## 📚 Endpoints
|
|
64
|
+
|
|
65
|
+
The CarsXE API provides the following endpoint methods:
|
|
66
|
+
|
|
67
|
+
### `specs` – Decode VIN & get full vehicle specifications
|
|
68
|
+
|
|
69
|
+
**Required:**
|
|
70
|
+
|
|
71
|
+
- `vin`
|
|
72
|
+
|
|
73
|
+
**Optional:**
|
|
74
|
+
|
|
75
|
+
- `deepdata`
|
|
76
|
+
- `disableIntVINDecoding`
|
|
77
|
+
|
|
78
|
+
**Example:**
|
|
79
|
+
|
|
80
|
+
```ruby
|
|
81
|
+
vehicle = carsxe.specs('vin' => 'WBAFR7C57CC811956')
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
### `int_vin_decoder` – Decode VIN with worldwide support
|
|
87
|
+
|
|
88
|
+
**Required:**
|
|
89
|
+
|
|
90
|
+
- `vin`
|
|
91
|
+
|
|
92
|
+
**Optional:**
|
|
93
|
+
|
|
94
|
+
- None
|
|
95
|
+
|
|
96
|
+
**Example:**
|
|
97
|
+
|
|
98
|
+
```ruby
|
|
99
|
+
intvin = carsxe.int_vin_decoder('vin' => 'WF0MXXGBWM8R43240')
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
### `plate_decoder` – Decode license plate info (plate, country)
|
|
105
|
+
|
|
106
|
+
**Required:**
|
|
107
|
+
|
|
108
|
+
- `plate`
|
|
109
|
+
- `country` (always required except for US, where it is optional and defaults to 'US')
|
|
110
|
+
|
|
111
|
+
**Optional:**
|
|
112
|
+
|
|
113
|
+
- `state` (required for some countries, e.g. US, AU, CA)
|
|
114
|
+
- `district` (required for Pakistan)
|
|
115
|
+
|
|
116
|
+
> **Note:**
|
|
117
|
+
>
|
|
118
|
+
> - The `state` parameter is required only when applicable (for
|
|
119
|
+
> specific countries such as US, AU, CA, etc.).
|
|
120
|
+
> - For Pakistan (`country='pk'`), both `state` and `district`
|
|
121
|
+
> are required.
|
|
122
|
+
|
|
123
|
+
**Example:**
|
|
124
|
+
|
|
125
|
+
```ruby
|
|
126
|
+
decoded_plate = carsxe.plate_decoder('plate' => '7XER187', 'state' => 'CA', 'country' => 'US')
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
### `market_value` – Estimate vehicle market value based on VIN
|
|
132
|
+
|
|
133
|
+
**Required:**
|
|
134
|
+
|
|
135
|
+
- `vin`
|
|
136
|
+
|
|
137
|
+
**Optional:**
|
|
138
|
+
|
|
139
|
+
- `state`
|
|
140
|
+
- `mileage`
|
|
141
|
+
- `condition`
|
|
142
|
+
|
|
143
|
+
**Example:**
|
|
144
|
+
|
|
145
|
+
```ruby
|
|
146
|
+
marketvalue = carsxe.market_value('vin' => 'WBAFR7C57CC811956', 'state' => 'CA', 'mileage' => '80000', 'condition' => 'good')
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
### `history` – Retrieve vehicle history
|
|
152
|
+
|
|
153
|
+
**Required:**
|
|
154
|
+
|
|
155
|
+
- `vin`
|
|
156
|
+
|
|
157
|
+
**Optional:**
|
|
158
|
+
|
|
159
|
+
- None
|
|
160
|
+
|
|
161
|
+
**Example:**
|
|
162
|
+
|
|
163
|
+
```ruby
|
|
164
|
+
history = carsxe.history('vin' => 'WBAFR7C57CC811956')
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
### `images` – Fetch images by make, model, year, trim
|
|
170
|
+
|
|
171
|
+
**Required:**
|
|
172
|
+
|
|
173
|
+
- `make`
|
|
174
|
+
- `model`
|
|
175
|
+
|
|
176
|
+
**Optional:**
|
|
177
|
+
|
|
178
|
+
- `year`
|
|
179
|
+
- `trim`
|
|
180
|
+
- `color`
|
|
181
|
+
- `transparent`
|
|
182
|
+
- `angle`
|
|
183
|
+
- `photoType`
|
|
184
|
+
- `size`
|
|
185
|
+
- `license`
|
|
186
|
+
|
|
187
|
+
**Example:**
|
|
188
|
+
|
|
189
|
+
```ruby
|
|
190
|
+
images = carsxe.images('make' => 'BMW', 'model' => 'X5', 'year' => '2019')
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
### `recalls` – Get safety recall data for a VIN
|
|
196
|
+
|
|
197
|
+
**Required:**
|
|
198
|
+
|
|
199
|
+
- `vin`
|
|
200
|
+
|
|
201
|
+
**Optional:**
|
|
202
|
+
|
|
203
|
+
- None
|
|
204
|
+
|
|
205
|
+
**Example:**
|
|
206
|
+
|
|
207
|
+
```ruby
|
|
208
|
+
recalls = carsxe.recalls('vin' => '1C4JJXR64PW696340')
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
### `plate_image_recognition` – Read & decode plates from images
|
|
214
|
+
|
|
215
|
+
**Required:**
|
|
216
|
+
|
|
217
|
+
- `upload_url`
|
|
218
|
+
|
|
219
|
+
**Optional:**
|
|
220
|
+
|
|
221
|
+
- None
|
|
222
|
+
|
|
223
|
+
**Example:**
|
|
224
|
+
|
|
225
|
+
```ruby
|
|
226
|
+
plateimg = carsxe.plate_image_recognition('upload_url' => 'https://api.carsxe.com/img/apis/plate_recognition.JPG')
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
### `vin_ocr` – Extract VINs from images using OCR
|
|
232
|
+
|
|
233
|
+
**Required:**
|
|
234
|
+
|
|
235
|
+
- `upload_url`
|
|
236
|
+
|
|
237
|
+
**Optional:**
|
|
238
|
+
|
|
239
|
+
- None
|
|
240
|
+
|
|
241
|
+
**Example:**
|
|
242
|
+
|
|
243
|
+
```ruby
|
|
244
|
+
vinocr = carsxe.vin_ocr('upload_url' => 'https://api.carsxe.com/img/apis/plate_recognition.JPG')
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
### `year_make_model` – Query vehicle by year, make, model and trim (optional)
|
|
250
|
+
|
|
251
|
+
**Required:**
|
|
252
|
+
|
|
253
|
+
- `year`
|
|
254
|
+
- `make`
|
|
255
|
+
- `model`
|
|
256
|
+
|
|
257
|
+
**Optional:**
|
|
258
|
+
|
|
259
|
+
- `trim`
|
|
260
|
+
|
|
261
|
+
**Example:**
|
|
262
|
+
|
|
263
|
+
```ruby
|
|
264
|
+
yymm = carsxe.year_make_model('year' => '2012', 'make' => 'BMW', 'model' => '5 Series')
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
### `obd_codes_decoder` – Decode OBD error/diagnostic codes
|
|
270
|
+
|
|
271
|
+
**Required:**
|
|
272
|
+
|
|
273
|
+
- `code`
|
|
274
|
+
|
|
275
|
+
**Optional:**
|
|
276
|
+
|
|
277
|
+
- None
|
|
278
|
+
|
|
279
|
+
**Example:**
|
|
280
|
+
|
|
281
|
+
```ruby
|
|
282
|
+
obdcode = carsxe.obd_codes_decoder('code' => 'P0115')
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
287
|
+
### `lien_and_theft` – Check for lien and theft records
|
|
288
|
+
|
|
289
|
+
**Required:**
|
|
290
|
+
|
|
291
|
+
- `vin`
|
|
292
|
+
|
|
293
|
+
**Optional:**
|
|
294
|
+
|
|
295
|
+
- None
|
|
296
|
+
|
|
297
|
+
**Example:**
|
|
298
|
+
|
|
299
|
+
```ruby
|
|
300
|
+
lientheft = carsxe.lien_and_theft('vin' => '2C3CDXFG1FH762860')
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
---
|
|
304
|
+
|
|
305
|
+
### `recalls_ymm` – Get safety recalls by year, make, and model
|
|
306
|
+
|
|
307
|
+
**Required:**
|
|
308
|
+
|
|
309
|
+
- `year`
|
|
310
|
+
- `make`
|
|
311
|
+
- `model`
|
|
312
|
+
|
|
313
|
+
**Optional:**
|
|
314
|
+
|
|
315
|
+
- None
|
|
316
|
+
|
|
317
|
+
**Example:**
|
|
318
|
+
|
|
319
|
+
```ruby
|
|
320
|
+
recalls_ymm = carsxe.recalls_ymm('year' => '2026', 'make' => 'toyota', 'model' => 'corolla')
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
### `recalls_batch_submit` – Submit VINs for bulk recall checking
|
|
326
|
+
|
|
327
|
+
**Required (at least one of):**
|
|
328
|
+
|
|
329
|
+
- `vins`
|
|
330
|
+
- `csv`
|
|
331
|
+
- `csvUrl`
|
|
332
|
+
|
|
333
|
+
**Optional:**
|
|
334
|
+
|
|
335
|
+
- `webhookUrl`
|
|
336
|
+
|
|
337
|
+
**Example:**
|
|
338
|
+
|
|
339
|
+
```ruby
|
|
340
|
+
batch = carsxe.recalls_batch_submit('vins' => ['1HGBH41JXMN109186', '5YJSA1E26HF000001'])
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
---
|
|
344
|
+
|
|
345
|
+
### `recalls_batch_status` – Check a bulk recalls batch
|
|
346
|
+
|
|
347
|
+
**Required:**
|
|
348
|
+
|
|
349
|
+
- `batchId`
|
|
350
|
+
|
|
351
|
+
**Optional:**
|
|
352
|
+
|
|
353
|
+
- None
|
|
354
|
+
|
|
355
|
+
**Example:**
|
|
356
|
+
|
|
357
|
+
```ruby
|
|
358
|
+
status = carsxe.recalls_batch_status('batchId' => 'brb_mnablbn7_wvbaqv')
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
---
|
|
362
|
+
|
|
363
|
+
### `recalls_batch_results` – Fetch bulk recalls results as JSON
|
|
364
|
+
|
|
365
|
+
**Required:**
|
|
366
|
+
|
|
367
|
+
- `batchId`
|
|
368
|
+
|
|
369
|
+
**Optional:**
|
|
370
|
+
|
|
371
|
+
- None
|
|
372
|
+
|
|
373
|
+
**Example:**
|
|
374
|
+
|
|
375
|
+
```ruby
|
|
376
|
+
results = carsxe.recalls_batch_results('batchId' => 'brb_mnablbn7_wvbaqv')
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
---
|
|
380
|
+
|
|
381
|
+
### `recalls_batch_download` – Download bulk recalls results as CSV
|
|
382
|
+
|
|
383
|
+
**Required:**
|
|
384
|
+
|
|
385
|
+
- `batchId`
|
|
386
|
+
|
|
387
|
+
**Optional:**
|
|
388
|
+
|
|
389
|
+
- None
|
|
390
|
+
|
|
391
|
+
**Example:**
|
|
392
|
+
|
|
393
|
+
```ruby
|
|
394
|
+
csv = carsxe.recalls_batch_download('batchId' => 'brb_mnablbn7_wvbaqv')
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
---
|
|
398
|
+
|
|
399
|
+
### `ymm_options` – List year, make, model, trim, or variant options
|
|
400
|
+
|
|
401
|
+
**Required:**
|
|
402
|
+
|
|
403
|
+
- None
|
|
404
|
+
|
|
405
|
+
**Optional:**
|
|
406
|
+
|
|
407
|
+
- `dimension`
|
|
408
|
+
- `year`
|
|
409
|
+
- `make`
|
|
410
|
+
- `model`
|
|
411
|
+
- `trim`
|
|
412
|
+
|
|
413
|
+
**Example:**
|
|
414
|
+
|
|
415
|
+
```ruby
|
|
416
|
+
options = carsxe.ymm_options('year' => '2026', 'make' => 'Toyota')
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
---
|
|
420
|
+
|
|
421
|
+
### `ownership_vin` – Look up registered owner(s) by VIN
|
|
422
|
+
|
|
423
|
+
**Required:**
|
|
424
|
+
|
|
425
|
+
- `vin`
|
|
426
|
+
|
|
427
|
+
**Optional:**
|
|
428
|
+
|
|
429
|
+
- `include`
|
|
430
|
+
|
|
431
|
+
**Example:**
|
|
432
|
+
|
|
433
|
+
```ruby
|
|
434
|
+
owners = carsxe.ownership_vin('vin' => '1FT8X3BT0BEA61538')
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
---
|
|
438
|
+
|
|
439
|
+
### `ownership_person` – Look up ownership by name and address
|
|
440
|
+
|
|
441
|
+
**Required:**
|
|
442
|
+
|
|
443
|
+
- `first_name`
|
|
444
|
+
- `last_name`
|
|
445
|
+
- `address`
|
|
446
|
+
- `zip`
|
|
447
|
+
|
|
448
|
+
**Optional:**
|
|
449
|
+
|
|
450
|
+
- `include`
|
|
451
|
+
|
|
452
|
+
**Example:**
|
|
453
|
+
|
|
454
|
+
```ruby
|
|
455
|
+
person = carsxe.ownership_person('first_name' => 'John', 'last_name' => 'Sample', 'address' => '123 Example St', 'zip' => '90210')
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
---
|
|
459
|
+
|
|
460
|
+
### `ownership_address` – Look up residents at a street address
|
|
461
|
+
|
|
462
|
+
**Required:**
|
|
463
|
+
|
|
464
|
+
- `address`
|
|
465
|
+
- `zip`
|
|
466
|
+
|
|
467
|
+
**Optional:**
|
|
468
|
+
|
|
469
|
+
- `include`
|
|
470
|
+
- `variant`
|
|
471
|
+
|
|
472
|
+
**Example:**
|
|
473
|
+
|
|
474
|
+
```ruby
|
|
475
|
+
address = carsxe.ownership_address('address' => '123 Example St', 'zip' => '90210')
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
---
|
|
479
|
+
|
|
480
|
+
### `ownership_zip` – Search owners in a ZIP code
|
|
481
|
+
|
|
482
|
+
**Required:**
|
|
483
|
+
|
|
484
|
+
- `zip`
|
|
485
|
+
|
|
486
|
+
**Optional:**
|
|
487
|
+
|
|
488
|
+
- `gender`
|
|
489
|
+
- `min_age`
|
|
490
|
+
- `max_age`
|
|
491
|
+
- `income`
|
|
492
|
+
- `page`
|
|
493
|
+
- `limit`
|
|
494
|
+
- `include`
|
|
495
|
+
- `variant`
|
|
496
|
+
|
|
497
|
+
**Example:**
|
|
498
|
+
|
|
499
|
+
```ruby
|
|
500
|
+
zip_owners = carsxe.ownership_zip('zip' => '90210', 'limit' => '15')
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
---
|
|
504
|
+
|
|
505
|
+
## Notes & Best Practices
|
|
506
|
+
|
|
507
|
+
- **Parameter requirements:** Each endpoint requires specific parameters—see the Required/Optional fields above.
|
|
508
|
+
- **Return values:** Responses are Ruby hashes. `recalls_batch_download` returns CSV text.
|
|
509
|
+
- **Error handling:** Use begin/rescue blocks to gracefully handle API errors.
|
|
510
|
+
- **More info:** For advanced usage and full details, visit the [official API documentation](https://api.carsxe.com/docs).
|
|
511
|
+
|
|
512
|
+
---
|
|
513
|
+
|
|
514
|
+
## Overall
|
|
515
|
+
|
|
516
|
+
CarsXE API provides a wide range of powerful, easy-to-use tools for accessing and integrating vehicle data into your applications and services. Whether you're a developer or a business owner, you can quickly get the information you need to take your projects to the next level—without hassle or inconvenience.
|
data/lib/carsxe/carsxe.rb
CHANGED
|
@@ -55,7 +55,7 @@ module Carsxe
|
|
|
55
55
|
url = "#{api_base_url}/platerecognition?key=#{api_key}&source=ruby"
|
|
56
56
|
if params.size == 1
|
|
57
57
|
first_key, first_value = params.first
|
|
58
|
-
post_json(url, {
|
|
58
|
+
post_json(url, {first_key => first_value})
|
|
59
59
|
else
|
|
60
60
|
raise ArgumentError, "Expected exactly one parameter, but got #{params.size}"
|
|
61
61
|
end
|
|
@@ -65,7 +65,7 @@ module Carsxe
|
|
|
65
65
|
url = "#{api_base_url}/v1/vinocr?key=#{api_key}&source=ruby"
|
|
66
66
|
if params.size == 1
|
|
67
67
|
first_key, first_value = params.first
|
|
68
|
-
post_json(url, {
|
|
68
|
+
post_json(url, {first_key => first_value})
|
|
69
69
|
else
|
|
70
70
|
raise ArgumentError, "Expected exactly one parameter, but got #{params.size}"
|
|
71
71
|
end
|
|
@@ -83,6 +83,55 @@ module Carsxe
|
|
|
83
83
|
get("v1/lien-theft", params, Types::VIN_INPUT)
|
|
84
84
|
end
|
|
85
85
|
|
|
86
|
+
def recalls_ymm(params = {})
|
|
87
|
+
get("v1/recalls-ymm", params, Types::RECALLS_YMM_INPUT)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def recalls_batch_submit(params = {})
|
|
91
|
+
unless params["vins"] || params["csv"] || params["csvUrl"]
|
|
92
|
+
raise ArgumentError, "Missing required parameter(s): vins, csv, or csvUrl"
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
url = "#{api_base_url}/v1/recalls-batch/submit?key=#{api_key}&source=ruby"
|
|
96
|
+
payload = {}
|
|
97
|
+
%w[vins csv csvUrl webhookUrl].each do |key|
|
|
98
|
+
payload[key] = params[key] if params.key?(key) && !params[key].nil?
|
|
99
|
+
end
|
|
100
|
+
post_json(url, payload)
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def recalls_batch_status(params = {})
|
|
104
|
+
get("v1/recalls-batch/status", params, Types::RECALLS_BATCH_INPUT)
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def recalls_batch_results(params = {})
|
|
108
|
+
get("v1/recalls-batch/results", params, Types::RECALLS_BATCH_INPUT)
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def recalls_batch_download(params = {})
|
|
112
|
+
get("v1/recalls-batch/download", params, Types::RECALLS_BATCH_INPUT)
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def ymm_options(params = {})
|
|
116
|
+
get("v1/ymm-options", params, Types::YMM_OPTIONS_INPUT)
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def ownership_vin(params = {})
|
|
120
|
+
get("v1/ownership/vin", params, Types::OWNERSHIP_VIN_INPUT)
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def ownership_person(params = {})
|
|
124
|
+
get("v1/ownership/person", params, Types::OWNERSHIP_PERSON_INPUT)
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def ownership_address(params = {})
|
|
128
|
+
get("v1/ownership/address", params, Types::OWNERSHIP_ADDRESS_INPUT)
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
def ownership_zip(params = {})
|
|
132
|
+
get("v1/ownership/zip", params, Types::OWNERSHIP_ZIP_INPUT)
|
|
133
|
+
end
|
|
134
|
+
|
|
86
135
|
private
|
|
87
136
|
|
|
88
137
|
# Determine required and optional keys from a param definition hash.
|
|
@@ -96,10 +145,10 @@ module Carsxe
|
|
|
96
145
|
# Special case for plate decoder params
|
|
97
146
|
if param_def.equal?(Types::PLATE_DECODER_PARAMS)
|
|
98
147
|
country = if params && params["country"]
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
148
|
+
params["country"].to_s.downcase
|
|
149
|
+
else
|
|
150
|
+
"us"
|
|
151
|
+
end
|
|
103
152
|
|
|
104
153
|
if country == "pk" || country == "pakistan"
|
|
105
154
|
required |= ["state", "district"]
|
|
@@ -115,7 +164,7 @@ module Carsxe
|
|
|
115
164
|
if params
|
|
116
165
|
missing = required.reject { |k| params.key?(k) && !params[k].nil? }
|
|
117
166
|
unless missing.empty?
|
|
118
|
-
raise ArgumentError, "Missing required parameter(s): #{missing.join(
|
|
167
|
+
raise ArgumentError, "Missing required parameter(s): #{missing.join(", ")}"
|
|
119
168
|
end
|
|
120
169
|
end
|
|
121
170
|
|
|
@@ -173,8 +222,9 @@ module Carsxe
|
|
|
173
222
|
|
|
174
223
|
def parse_response(response)
|
|
175
224
|
body = response.body.to_s
|
|
176
|
-
|
|
177
|
-
|
|
225
|
+
JSON.parse(body)
|
|
226
|
+
rescue JSON::ParserError
|
|
227
|
+
body
|
|
178
228
|
end
|
|
179
229
|
end
|
|
180
|
-
end
|
|
230
|
+
end
|
data/lib/carsxe/types.rb
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
|
|
2
3
|
#
|
|
3
4
|
# Parameter "schemas" used by the client to determine required vs optional keys.
|
|
4
5
|
# Values are :required or :optional (simple representation, enough for validation here).
|
|
@@ -10,30 +11,30 @@ module Carsxe
|
|
|
10
11
|
}.freeze
|
|
11
12
|
|
|
12
13
|
MARKET_VALUE_INPUT = {
|
|
13
|
-
"vin"
|
|
14
|
-
"state"
|
|
15
|
-
"mileage"
|
|
14
|
+
"vin" => :required,
|
|
15
|
+
"state" => :optional,
|
|
16
|
+
"mileage" => :optional,
|
|
16
17
|
"condition" => :optional
|
|
17
18
|
}.freeze
|
|
18
19
|
|
|
19
20
|
PLATE_DECODER_PARAMS = {
|
|
20
|
-
"plate"
|
|
21
|
-
"country"
|
|
22
|
-
"state"
|
|
21
|
+
"plate" => :required,
|
|
22
|
+
"country" => :optional, # country is allowed but not strictly required by default
|
|
23
|
+
"state" => :optional,
|
|
23
24
|
"district" => :optional
|
|
24
25
|
}.freeze
|
|
25
26
|
|
|
26
27
|
IMAGE_INPUT = {
|
|
27
|
-
"make"
|
|
28
|
-
"model"
|
|
29
|
-
"year"
|
|
30
|
-
"trim"
|
|
31
|
-
"color"
|
|
28
|
+
"make" => :required,
|
|
29
|
+
"model" => :required,
|
|
30
|
+
"year" => :optional,
|
|
31
|
+
"trim" => :optional,
|
|
32
|
+
"color" => :optional,
|
|
32
33
|
"transparent" => :optional,
|
|
33
|
-
"angle"
|
|
34
|
-
"photoType"
|
|
35
|
-
"size"
|
|
36
|
-
"license"
|
|
34
|
+
"angle" => :optional,
|
|
35
|
+
"photoType" => :optional,
|
|
36
|
+
"size" => :optional,
|
|
37
|
+
"license" => :optional
|
|
37
38
|
}.freeze
|
|
38
39
|
|
|
39
40
|
OBDCODESDECODER_INPUT = {
|
|
@@ -49,16 +50,66 @@ module Carsxe
|
|
|
49
50
|
}.freeze
|
|
50
51
|
|
|
51
52
|
YEAR_MAKE_MODEL_INPUT = {
|
|
52
|
-
"year"
|
|
53
|
-
"make"
|
|
53
|
+
"year" => :required,
|
|
54
|
+
"make" => :required,
|
|
54
55
|
"model" => :required,
|
|
55
|
-
"trim"
|
|
56
|
+
"trim" => :optional
|
|
56
57
|
}.freeze
|
|
57
58
|
|
|
58
59
|
SPECS_INPUT = {
|
|
59
|
-
"vin"
|
|
60
|
-
"deepData"
|
|
61
|
-
"disableIntVINDecoding"
|
|
60
|
+
"vin" => :required,
|
|
61
|
+
"deepData" => :optional,
|
|
62
|
+
"disableIntVINDecoding" => :optional
|
|
63
|
+
}.freeze
|
|
64
|
+
|
|
65
|
+
RECALLS_YMM_INPUT = {
|
|
66
|
+
"year" => :required,
|
|
67
|
+
"make" => :required,
|
|
68
|
+
"model" => :required
|
|
69
|
+
}.freeze
|
|
70
|
+
|
|
71
|
+
RECALLS_BATCH_INPUT = {
|
|
72
|
+
"batchId" => :required
|
|
73
|
+
}.freeze
|
|
74
|
+
|
|
75
|
+
YMM_OPTIONS_INPUT = {
|
|
76
|
+
"dimension" => :optional,
|
|
77
|
+
"year" => :optional,
|
|
78
|
+
"make" => :optional,
|
|
79
|
+
"model" => :optional,
|
|
80
|
+
"trim" => :optional
|
|
81
|
+
}.freeze
|
|
82
|
+
|
|
83
|
+
OWNERSHIP_VIN_INPUT = {
|
|
84
|
+
"vin" => :required,
|
|
85
|
+
"include" => :optional
|
|
86
|
+
}.freeze
|
|
87
|
+
|
|
88
|
+
OWNERSHIP_PERSON_INPUT = {
|
|
89
|
+
"first_name" => :required,
|
|
90
|
+
"last_name" => :required,
|
|
91
|
+
"address" => :required,
|
|
92
|
+
"zip" => :required,
|
|
93
|
+
"include" => :optional
|
|
94
|
+
}.freeze
|
|
95
|
+
|
|
96
|
+
OWNERSHIP_ADDRESS_INPUT = {
|
|
97
|
+
"address" => :required,
|
|
98
|
+
"zip" => :required,
|
|
99
|
+
"include" => :optional,
|
|
100
|
+
"variant" => :optional
|
|
101
|
+
}.freeze
|
|
102
|
+
|
|
103
|
+
OWNERSHIP_ZIP_INPUT = {
|
|
104
|
+
"zip" => :required,
|
|
105
|
+
"gender" => :optional,
|
|
106
|
+
"min_age" => :optional,
|
|
107
|
+
"max_age" => :optional,
|
|
108
|
+
"income" => :optional,
|
|
109
|
+
"page" => :optional,
|
|
110
|
+
"limit" => :optional,
|
|
111
|
+
"include" => :optional,
|
|
112
|
+
"variant" => :optional
|
|
62
113
|
}.freeze
|
|
63
114
|
end
|
|
64
|
-
end
|
|
115
|
+
end
|
data/lib/carsxe/version.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Carsxe
|
|
4
|
-
VERSION = "1.
|
|
5
|
-
end
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Carsxe
|
|
4
|
+
VERSION = "1.3.0"
|
|
5
|
+
end
|
data/lib/carsxe.rb
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
require "carsxe/version"
|
|
2
|
-
require "carsxe/carsxe"
|
|
2
|
+
require "carsxe/carsxe"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: carsxe
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- CarsXE Developer
|
|
@@ -29,7 +29,6 @@ files:
|
|
|
29
29
|
- Rakefile
|
|
30
30
|
- bin/console
|
|
31
31
|
- bin/setup
|
|
32
|
-
- carsxe-1.1.1.gem
|
|
33
32
|
- lib/carsxe.rb
|
|
34
33
|
- lib/carsxe/carsxe.rb
|
|
35
34
|
- lib/carsxe/types.rb
|
data/carsxe-1.1.1.gem
DELETED
|
Binary file
|