edmunds_ruby 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/edmunds_api.rb +0 -31
- data/lib/edmunds_ruby.rb +31 -1
- metadata +1 -1
data/lib/edmunds_api.rb
CHANGED
@@ -1,34 +1,3 @@
|
|
1
|
-
class EdmundsAPI
|
2
|
-
include EdmundsMakes
|
3
|
-
include EdmundsModels
|
4
|
-
include EdmundsModelYears
|
5
|
-
include EdmundsStyles
|
6
|
-
include EdmundsImages
|
7
|
-
|
8
|
-
# Using this model requires setting your Edmunds API key in your ~/.bashrc file like so:
|
9
|
-
# export EDMUNDS_VEHICLE="your_api_key_here"
|
10
|
-
|
11
|
-
require 'rest_client'
|
12
|
-
require 'crack'
|
13
|
-
require 'crack/json'
|
14
|
-
require 'pry'
|
15
|
-
|
16
|
-
attr_reader :data, :image, :images
|
17
|
-
|
18
|
-
def initialize
|
19
|
-
@base = "http://api.edmunds.com/v1/api/vehicle"
|
20
|
-
@api_key = ENV["EDMUNDS_VEHICLE"]
|
21
|
-
@image_base_url = "http://media.ed.edmunds-media.com"
|
22
|
-
@format = "fmt=json&api_key=#{@api_key}"
|
23
|
-
end
|
24
|
-
|
25
|
-
def call_api
|
26
|
-
@base_url = @base + @url + @format
|
27
|
-
@resp = RestClient.get(@base_url)
|
28
|
-
@json = Crack::JSON.parse(@resp)
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
32
1
|
|
33
2
|
|
34
3
|
|
data/lib/edmunds_ruby.rb
CHANGED
@@ -1,5 +1,35 @@
|
|
1
1
|
module EdmundsRuby
|
2
2
|
|
3
|
-
|
3
|
+
class EdmundsAPI
|
4
|
+
include EdmundsMakes
|
5
|
+
include EdmundsModels
|
6
|
+
include EdmundsModelYears
|
7
|
+
include EdmundsStyles
|
8
|
+
include EdmundsImages
|
9
|
+
|
10
|
+
# Using this model requires setting your Edmunds API key in your ~/.bashrc file like so:
|
11
|
+
# export EDMUNDS_VEHICLE="your_api_key_here"
|
12
|
+
|
13
|
+
require 'rest_client'
|
14
|
+
require 'crack'
|
15
|
+
require 'crack/json'
|
16
|
+
require 'pry'
|
17
|
+
|
18
|
+
attr_reader :data, :image, :images
|
19
|
+
|
20
|
+
def initialize
|
21
|
+
@base = "http://api.edmunds.com/v1/api/vehicle"
|
22
|
+
@api_key = ENV["EDMUNDS_VEHICLE"]
|
23
|
+
@image_base_url = "http://media.ed.edmunds-media.com"
|
24
|
+
@format = "fmt=json&api_key=#{@api_key}"
|
25
|
+
end
|
26
|
+
|
27
|
+
def call_api
|
28
|
+
@base_url = @base + @url + @format
|
29
|
+
@resp = RestClient.get(@base_url)
|
30
|
+
@json = Crack::JSON.parse(@resp)
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
4
34
|
|
5
35
|
end
|