edmunds 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: beef6e670c86ce24faac7b018dc62ff5de4fa3e1
4
- data.tar.gz: 726d7b282b93c87773301e81029085f915ad0166
3
+ metadata.gz: 481d130e3e474aae238c7dbfd8bc62ac6bd5510d
4
+ data.tar.gz: 7b17fb30d33fdf209fcb1186225e3207eb14cd77
5
5
  SHA512:
6
- metadata.gz: b0cd620b85f58922ee3afbbad5452078542e8f0dc5af2e8bfca5c0a237c8b752183a55af7b59ada9e529fbeba7cbd6485c8cc30ac57aa6f44cda188e8c9c0460
7
- data.tar.gz: 29b9fdc3d0532a54b4f724dd159a8da2473f0f61405021f8ff91d2619ddcacd54723ae0292d255f4aacff73456ac2c316a4979bf28f751558846ac6cefda7b58
6
+ metadata.gz: 9b33cbec6f69aefcb344037441d6974883124d549a9134988c1eb08762ea5b0576b993b4721da8433f9ab8326d30e4c828ec470a7313977db8528293e6c6290b
7
+ data.tar.gz: 4d9bb098ac68dcd54a16df24c270142b2363123f4ecf714e72ddaee1c328c225bdf80b7b279dc2092fbf871a36d93681ae5b7f0597717b2de8439e99cfc06cba
@@ -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.
@@ -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"
@@ -0,0 +1,8 @@
1
+ require 'edmunds'
2
+
3
+ module Edmunds
4
+ module Vehicle
5
+ API_URL_V1 = Edmunds::API_URL_V1 + "/vehicle"
6
+ API_URL_V2 = Edmunds::API_URL_V2 + "/vehicle"
7
+ end
8
+ end
@@ -1,12 +1,27 @@
1
1
  require 'faraday'
2
2
  require 'json'
3
3
 
4
- API_URL = "https://api.edmunds.com/api/v1/vehicle/vin/"
4
+ API_URL = Edmunds::Vehicle::API_URL_V1 + "/vin/"
5
5
 
6
6
  module Edmunds
7
7
  module Vehicle
8
8
  module Specification
9
- class VinDecoding
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
@@ -1,3 +1,3 @@
1
1
  module Edmunds
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
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.1
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: ''