edmunds 0.0.1 → 0.0.2
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/README.md +26 -0
- data/lib/edmunds.rb +6 -3
- data/lib/edmunds/vehicle.rb +8 -0
- data/lib/edmunds/vehicle/specification/vin_decoding.rb +17 -2
- data/lib/edmunds/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 481d130e3e474aae238c7dbfd8bc62ac6bd5510d
|
4
|
+
data.tar.gz: 7b17fb30d33fdf209fcb1186225e3207eb14cd77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b33cbec6f69aefcb344037441d6974883124d549a9134988c1eb08762ea5b0576b993b4721da8433f9ab8326d30e4c828ec470a7313977db8528293e6c6290b
|
7
|
+
data.tar.gz: 4d9bb098ac68dcd54a16df24c270142b2363123f4ecf714e72ddaee1c328c225bdf80b7b279dc2092fbf871a36d93681ae5b7f0597717b2de8439e99cfc06cba
|
data/README.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# edmunds
|
2
|
+
Edmunds.com Ruby API Wrapper
|
3
|
+
|
4
|
+
## Installation
|
5
|
+
Install the gem
|
6
|
+
```bash
|
7
|
+
gem install edmunds
|
8
|
+
```
|
9
|
+
Set your API key as a environment variable
|
10
|
+
```bash
|
11
|
+
export EDMUNDS_API_KEY=<api_key>
|
12
|
+
```
|
13
|
+
|
14
|
+
## Usage
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
require 'edmunds'
|
18
|
+
=> true
|
19
|
+
result = Edmunds::Vehicle::Specification::VinDecoding::Basic.find("JHMAP11461T005905")
|
20
|
+
=> #<Edmunds::Vehicle::Specification::VinDecoding::Basic:0x007faa2a0e4e40 @make="Honda", @model="S2000", @year=2001>
|
21
|
+
|
22
|
+
```
|
23
|
+
|
24
|
+
## License
|
25
|
+
|
26
|
+
Please see LICENSE at the top level of the repository.
|
data/lib/edmunds.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
|
-
require_relative "edmunds/version"
|
2
|
-
require_relative "edmunds/vehicle/specification/vin_decoding"
|
3
|
-
|
4
1
|
module Edmunds
|
2
|
+
API_URL_V1 = "https://api.edmunds.com/api/v1"
|
3
|
+
API_URL_V2 = "https://api.edmunds.com/api/v2"
|
5
4
|
end
|
5
|
+
|
6
|
+
require_relative "edmunds/version"
|
7
|
+
require_relative "edmunds/vehicle"
|
8
|
+
require_relative "edmunds/vehicle/specification/vin_decoding"
|
@@ -1,12 +1,27 @@
|
|
1
1
|
require 'faraday'
|
2
2
|
require 'json'
|
3
3
|
|
4
|
-
API_URL = "
|
4
|
+
API_URL = Edmunds::Vehicle::API_URL_V1 + "/vin/"
|
5
5
|
|
6
6
|
module Edmunds
|
7
7
|
module Vehicle
|
8
8
|
module Specification
|
9
|
-
|
9
|
+
module VinDecoding
|
10
|
+
class Basic
|
11
|
+
attr_reader :make, :model, :year
|
12
|
+
|
13
|
+
def initialize(attributes)
|
14
|
+
@make = attributes["make"]["name"]
|
15
|
+
@model = attributes["model"]["name"]
|
16
|
+
@year = attributes["year"]
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.find(vin)
|
20
|
+
response = Faraday.get("#{API_URL}/#{vin}/configuration", { api_key: ENV['EDMUNDS_API_KEY'] })
|
21
|
+
attributes = JSON.parse(response.body)
|
22
|
+
new(attributes)
|
23
|
+
end
|
24
|
+
end
|
10
25
|
end
|
11
26
|
end
|
12
27
|
end
|
data/lib/edmunds/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: edmunds
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Parraga
|
@@ -129,7 +129,9 @@ executables: []
|
|
129
129
|
extensions: []
|
130
130
|
extra_rdoc_files: []
|
131
131
|
files:
|
132
|
+
- README.md
|
132
133
|
- lib/edmunds.rb
|
134
|
+
- lib/edmunds/vehicle.rb
|
133
135
|
- lib/edmunds/vehicle/specification/vin_decoding.rb
|
134
136
|
- lib/edmunds/version.rb
|
135
137
|
homepage: ''
|