edmunds_api 0.1.3 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.coveralls.yml +1 -0
- data/.github/workflows/ci.yml +31 -0
- data/.simplecov +3 -0
- data/Gemfile +5 -1
- data/README.md +12 -1
- data/bin/console +1 -1
- data/edmunds_api.gemspec +2 -2
- data/endpoints.md +116 -0
- data/lib/edmunds/request.rb +16 -3
- data/lib/edmunds/vehicle/models.rb +1 -1
- data/lib/edmunds/version.rb +1 -1
- metadata +16 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b77f91e47eb5a9b5cb8848166eeab73765ebce2b941da060cb59eb7c0c1d58cd
|
4
|
+
data.tar.gz: '00901f5ecd771d640f429c302efd2c5adb1b3dfe78f2baec20df94a4681f4678'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e344196ce8164c02b9d6068099372785df6bd3502e8ffe6b605f19cbce6be09f2643f575f58c74ac2c39f1100e89a0db0791d21fa57a49f12aa956cd8585a73c
|
7
|
+
data.tar.gz: f08d86280787d2e08136d6d9897c3efff36a67894ae67cd42952a9b5ee929db792f9b4096f6b18ae9221e726b18f30d1067a35e57b48ce760225c1d1d0abf135
|
data/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
repo_token: jiOAN8YTWc1vAphD3slALGYNPhnkJ981n
|
@@ -0,0 +1,31 @@
|
|
1
|
+
name: CI
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
branches: master
|
5
|
+
|
6
|
+
env:
|
7
|
+
RACK_ENV: test
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
tests:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
strategy:
|
13
|
+
fail-fast: false
|
14
|
+
matrix:
|
15
|
+
# Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
|
16
|
+
ruby: [2.4, 2.5, 2.6, 2.7, '3.0']
|
17
|
+
|
18
|
+
name: Tests
|
19
|
+
steps:
|
20
|
+
- name: Check out repository code
|
21
|
+
uses: actions/checkout@v2
|
22
|
+
|
23
|
+
- name: Setup ruby
|
24
|
+
uses: ruby/setup-ruby@v1
|
25
|
+
with:
|
26
|
+
ruby-version: ${{ matrix.ruby }}
|
27
|
+
bundler-cache: true
|
28
|
+
|
29
|
+
- name: Run spec
|
30
|
+
run: |
|
31
|
+
bundle exec rspec
|
data/.simplecov
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
![Tests](https://github.com/webstreak/edmunds-api-ruby/actions/workflows/ci.yml/badge.svg)
|
2
|
+
[![Code Climate](https://codeclimate.com/github/webstreak/edmunds-api-ruby/badges/gpa.svg)](https://codeclimate.com/github/webstreak/edmunds-api-ruby)
|
3
|
+
[![Coverage Status](https://coveralls.io/repos/github/webstreak/edmunds-api-ruby/badge.svg)](https://coveralls.io/github/webstreak/edmunds-api-ruby)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/edmunds_api.svg)](https://badge.fury.io/rb/edmunds_api)
|
5
|
+
[![RubyGems](http://img.shields.io/gem/dt/edmunds_api.svg?style=flat)](http://rubygems.org/gems/edmunds_api)
|
6
|
+
|
1
7
|
Edmunds Api ruby client.
|
2
8
|
|
3
9
|
> *Status*: Beta. We are preparing the project for public release soon
|
@@ -7,7 +13,7 @@ Edmunds Api ruby client.
|
|
7
13
|
Add this line to your application's Gemfile:
|
8
14
|
|
9
15
|
```ruby
|
10
|
-
gem 'edmunds_api', '~> 0.1.
|
16
|
+
gem 'edmunds_api', '~> 0.1.8'
|
11
17
|
```
|
12
18
|
|
13
19
|
And then execute:
|
@@ -24,6 +30,7 @@ Add api_key in initializer:
|
|
24
30
|
```ruby
|
25
31
|
Edmunds.configure do |config|
|
26
32
|
config.api_key = 'your-api-key'
|
33
|
+
config.timeout = 5
|
27
34
|
end
|
28
35
|
```
|
29
36
|
Basic usage:
|
@@ -36,6 +43,10 @@ You can also pass options to an Api endpoint:
|
|
36
43
|
vehicles_api = Edmunds::Api.new.vehicles
|
37
44
|
vehicles_api.make('Lexus', {state: 'new'})
|
38
45
|
```
|
46
|
+
See supported options for each Api endpoint on [Edmunds website](http://developer.edmunds.com/api-documentation/overview/)
|
47
|
+
|
48
|
+
## Supported endpoints
|
49
|
+
[Endpoints](endpoints.md)
|
39
50
|
|
40
51
|
## Contributing
|
41
52
|
|
data/bin/console
CHANGED
data/edmunds_api.gemspec
CHANGED
@@ -22,8 +22,8 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_dependency 'http', '~> 2.0'
|
23
23
|
spec.add_dependency 'configurations', '~> 2.2'
|
24
24
|
|
25
|
-
spec.add_development_dependency 'bundler', '
|
26
|
-
spec.add_development_dependency 'rake', '~>
|
25
|
+
spec.add_development_dependency 'bundler', '> 1'
|
26
|
+
spec.add_development_dependency 'rake', '~> 12.3'
|
27
27
|
spec.add_development_dependency 'rspec', '~> 3.5'
|
28
28
|
spec.add_development_dependency 'webmock', '~> 2.1'
|
29
29
|
end
|
data/endpoints.md
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
## Vehicle API
|
2
|
+
|
3
|
+
### Makes
|
4
|
+
[Makes EdmundsApi docs](http://developer.edmunds.com/api-documentation/vehicle/spec_make/v2/)
|
5
|
+
|
6
|
+
| Endpoint | Description |
|
7
|
+
|-----------|-------------|
|
8
|
+
| `Edmunds::Api.new.vehicles.makes.count(options)` | Total Count of Car Makes |
|
9
|
+
| `Edmunds::Api.new.vehicles.makes.all_makes(options)` | A List of Car Makes |
|
10
|
+
| `Edmunds::Api.new.vehicles.makes.make("Make", options)` | Details on a Specific Car Make |
|
11
|
+
|
12
|
+
### Models
|
13
|
+
[Models EdmundsApi docs](http://developer.edmunds.com/api-documentation/vehicle/spec_model/v2/)
|
14
|
+
|
15
|
+
| Endpoint | Description |
|
16
|
+
|-----------|-------------|
|
17
|
+
| `Edmunds::Api.new.vehicles.models.count("Make", options)` | Total Count of Models for a Car Make |
|
18
|
+
| `Edmunds::Api.new.vehicles.models.models("Make", options)` | Get a List of Car Models for a Specific Car Make |
|
19
|
+
| `Edmunds::Api.new.vehicles.models.model("Make", "Model", options)` | Get Details on a Specific Car Model |
|
20
|
+
|
21
|
+
### Styles
|
22
|
+
[Styles EdmundsApi docs](http://developer.edmunds.com/api-documentation/vehicle/spec_style/v2/)
|
23
|
+
|
24
|
+
| Endpoint | Description |
|
25
|
+
|-----------|-------------|
|
26
|
+
| `Edmunds::Api.new.vehicles.styles.count(options)` | Styles Count |
|
27
|
+
| `Edmunds::Api.new.vehicles.styles.make_count("Make", options)` | Style Count by Car Make |
|
28
|
+
| `Edmunds::Api.new.vehicles.styles.make_model_count("Make", "Model", options)` | Style Count by Car Make and Model |
|
29
|
+
| `Edmunds::Api.new.vehicles.styles.make_model_year_count("Make", "Model", "Year", options)` | Style Count by Car Make/Model/Year |
|
30
|
+
| `Edmunds::Api.new.vehicles.styles.id(style_id, options)` | Car Style Details by Car Style ID |
|
31
|
+
| `Edmunds::Api.new.vehicles.styles.make_model_year("Make", "Model", "Year", options)` | Car Style Details by Car Make/Model/Year |
|
32
|
+
| `Edmunds::Api.new.vehicles.styles.chrome_data(chrome_id, options)` | Car Style Details by Car Chrome Data ID |
|
33
|
+
|
34
|
+
### Engines
|
35
|
+
[Engines EdmundsApi docs](http://developer.edmunds.com/api-documentation/vehicle/spec_engine_and_transmission/v2/)
|
36
|
+
|
37
|
+
| Endpoint | Description |
|
38
|
+
|-----------|-------------|
|
39
|
+
| `Edmunds::Api.new.vehicles.engines.details(engine_id)` | Engine Details by ID |
|
40
|
+
| `Edmunds::Api.new.vehicles.engines.by_style_id(style_id, options)` | Engines for a Car Style |
|
41
|
+
|
42
|
+
### Transmissions
|
43
|
+
[Transmissions EdmundsApi docs](http://developer.edmunds.com/api-documentation/vehicle/spec_engine_and_transmission/v2/)
|
44
|
+
|
45
|
+
| Endpoint | Description |
|
46
|
+
|-----------|-------------|
|
47
|
+
| `Edmunds::Api.new.vehicles.transmissions.details(transmission_id)` | Transmission Details by ID |
|
48
|
+
| `Edmunds::Api.new.vehicles.transmissions.by_style_id(style_id, options)` | Transmissions for a Car Style |
|
49
|
+
|
50
|
+
### Colors
|
51
|
+
[Colors EdmundsApi docs](http://developer.edmunds.com/api-documentation/vehicle/spec_colors_and_options/v2/)
|
52
|
+
|
53
|
+
| Endpoint | Description |
|
54
|
+
|-----------|-------------|
|
55
|
+
| `Edmunds::Api.new.vehicles.colors.details(color_id)` | Color Details by ID |
|
56
|
+
| `Edmunds::Api.new.vehicles.colors.by_style_id(style_id, options)` | Colors for a Car Style |
|
57
|
+
|
58
|
+
### Options
|
59
|
+
[Options EdmundsApi docs](http://developer.edmunds.com/api-documentation/vehicle/spec_colors_and_options/v2/)
|
60
|
+
|
61
|
+
| Endpoint | Description |
|
62
|
+
|-----------|-------------|
|
63
|
+
| `Edmunds::Api.new.vehicles.options.details(option_id)` | Option Details by ID |
|
64
|
+
| `Edmunds::Api.new.vehicles.options.by_style_id(style_id, options)` | Options for a Car Style |
|
65
|
+
|
66
|
+
### Equipment
|
67
|
+
[Equipment EdmundsApi docs](http://developer.edmunds.com/api-documentation/vehicle/spec_equipment/v2/)
|
68
|
+
|
69
|
+
| Endpoint | Description |
|
70
|
+
|-----------|-------------|
|
71
|
+
| `Edmunds::Api.new.vehicles.equipment.details(equipment_id)` | Equipment Details by ID |
|
72
|
+
| `Edmunds::Api.new.vehicles.equipment.by_style_id(style_id, options)` | Equipment for a Car Style |
|
73
|
+
|
74
|
+
### Squish vin
|
75
|
+
[Squish vin EdmundsApi docs](http://developer.edmunds.com/api-documentation/vehicle/spec_squishvin/v2/)
|
76
|
+
|
77
|
+
| Endpoint | Description |
|
78
|
+
|-----------|-------------|
|
79
|
+
| `Edmunds::Api.new.vehicles.squishvins.decode(VIN)` | Vehicle Details by Squish VIN |
|
80
|
+
|
81
|
+
### VIN Decoding
|
82
|
+
[VIN decoding EdmundsApi docs](http://developer.edmunds.com/api-documentation/vehicle/spec_vin_decoding/v2/)
|
83
|
+
|
84
|
+
| Endpoint | Description |
|
85
|
+
|-----------|-------------|
|
86
|
+
| `Edmunds::Api.new.vehicles.vin.decode(VIN, options)` | Vehicle Details by VIN |
|
87
|
+
|
88
|
+
### Safety
|
89
|
+
[Safety EdmundsApi docs](http://developer.edmunds.com/api-documentation/vehicle/service_safety/v2/)
|
90
|
+
|
91
|
+
| Endpoint | Description |
|
92
|
+
|-----------|-------------|
|
93
|
+
| `Edmunds::Api.new.vehicles.safety.ratings(style_id)` | Safety ratings by Style ID |
|
94
|
+
| `Edmunds::Api.new.vehicles.safety.ratings("Make", "Model", "Year")` | Safety ratings by Make/Model/Year |
|
95
|
+
|
96
|
+
### Letter Grade Rating
|
97
|
+
[Grades rating EdmundsApi docs](http://developer.edmunds.com/api-documentation/vehicle/content_letter_grade/v2/)
|
98
|
+
|
99
|
+
| Endpoint | Description |
|
100
|
+
|-----------|-------------|
|
101
|
+
| `Edmunds::Api.new.vehicles.grades.by_style_id(style_id)` | Rating Details by Style ID |
|
102
|
+
| `Edmunds::Api.new.vehicles.grades.details("Make", "Model", "Year")` | All Rating Details Reviews by Make/Model/Year |
|
103
|
+
| `Edmunds::Api.new.vehicles.grades.rating("Make", "Model", "Year")` | Letter Grade Rating by Make/Model/Year |
|
104
|
+
| `Edmunds::Api.new.vehicles.grades.by_review_id("Make", "Model", "Year", review_id)` | Rating Details by Make/Model/Year and Review ID |
|
105
|
+
|
106
|
+
## Media API
|
107
|
+
|
108
|
+
### Photos
|
109
|
+
[Photos EdmundsApi docs](http://developer.edmunds.com/api-documentation/media/photos/v2/)
|
110
|
+
|
111
|
+
| Endpoint | Description |
|
112
|
+
|-----------|-------------|
|
113
|
+
| `Edmunds::Api.new.media.photos.by_year_make_model("Year", "Make", "Model", options)` | Find photos by Make/Model/Year |
|
114
|
+
| `Edmunds::Api.new.media.photos.by_tag(tag, options)` | Find photos by Tag |
|
115
|
+
| `Edmunds::Api.new.media.photos.by_style_id(style_id, options)` | Find photos by Style ID |
|
116
|
+
| `Edmunds::Api.new.media.photos.by_make_model("Make", "Model", options)` | Find photos by Make/Model |
|
data/lib/edmunds/request.rb
CHANGED
@@ -1,23 +1,32 @@
|
|
1
|
+
require 'timeout'
|
2
|
+
|
1
3
|
module Edmunds
|
2
4
|
module Request
|
3
5
|
|
4
6
|
API_URL = 'https://api.edmunds.com/api'
|
7
|
+
API_VERSION = Edmunds.configuration.api_version.to_s
|
8
|
+
DEFAULT_TIMEOUT = 15
|
5
9
|
|
6
10
|
def api_call(api_path, path, options={})
|
7
11
|
url = build_api_url api_path, path
|
8
12
|
request_params = merge_required_params options
|
9
|
-
|
13
|
+
raise 'No api_key found' if request_params[:api_key].empty?
|
14
|
+
response = Timeout::timeout(timeout) {
|
15
|
+
HTTP.headers(http_headers).get(url, params: request_params)
|
16
|
+
}
|
10
17
|
parse_response response
|
11
18
|
end
|
12
19
|
|
20
|
+
private
|
21
|
+
|
13
22
|
def build_api_url(api_path, path)
|
14
|
-
api_version = 'v' +
|
23
|
+
api_version = 'v' + API_VERSION
|
15
24
|
API_URL + '/' + api_path + '/' + api_version + path
|
16
25
|
end
|
17
26
|
|
18
27
|
def merge_required_params(options)
|
19
28
|
{
|
20
|
-
api_key: Edmunds.configuration.api_key,
|
29
|
+
api_key: Edmunds.configuration.api_key.to_s.strip,
|
21
30
|
fmt: Edmunds.configuration.request_params.fmt
|
22
31
|
}.merge(options)
|
23
32
|
end
|
@@ -29,6 +38,10 @@ module Edmunds
|
|
29
38
|
}
|
30
39
|
end
|
31
40
|
|
41
|
+
def timeout
|
42
|
+
Edmunds.configuration.timeout || DEFAULT_TIMEOUT
|
43
|
+
end
|
44
|
+
|
32
45
|
def parse_response(response)
|
33
46
|
begin
|
34
47
|
body = JSON.parse response.body
|
data/lib/edmunds/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: edmunds_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Belyaev
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|
@@ -42,30 +42,30 @@ dependencies:
|
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '1
|
47
|
+
version: '1'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '1
|
54
|
+
version: '1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '12.3'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '12.3'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -101,8 +101,11 @@ executables: []
|
|
101
101
|
extensions: []
|
102
102
|
extra_rdoc_files: []
|
103
103
|
files:
|
104
|
+
- ".coveralls.yml"
|
105
|
+
- ".github/workflows/ci.yml"
|
104
106
|
- ".gitignore"
|
105
107
|
- ".rspec"
|
108
|
+
- ".simplecov"
|
106
109
|
- Gemfile
|
107
110
|
- LICENSE.txt
|
108
111
|
- README.md
|
@@ -110,6 +113,7 @@ files:
|
|
110
113
|
- bin/console
|
111
114
|
- bin/setup
|
112
115
|
- edmunds_api.gemspec
|
116
|
+
- endpoints.md
|
113
117
|
- lib/edmunds/api.rb
|
114
118
|
- lib/edmunds/configuration.rb
|
115
119
|
- lib/edmunds/error.rb
|
@@ -135,7 +139,7 @@ homepage: https://github.com/webstreak/edmunds-api-ruby
|
|
135
139
|
licenses:
|
136
140
|
- MIT
|
137
141
|
metadata: {}
|
138
|
-
post_install_message:
|
142
|
+
post_install_message:
|
139
143
|
rdoc_options: []
|
140
144
|
require_paths:
|
141
145
|
- lib
|
@@ -150,9 +154,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
154
|
- !ruby/object:Gem::Version
|
151
155
|
version: '0'
|
152
156
|
requirements: []
|
153
|
-
|
154
|
-
|
155
|
-
signing_key:
|
157
|
+
rubygems_version: 3.2.3
|
158
|
+
signing_key:
|
156
159
|
specification_version: 4
|
157
160
|
summary: Edmunds Api ruby client
|
158
161
|
test_files: []
|