edmunds_ruby 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +88 -0
- data/lib/edmunds/api.rb +36 -0
- data/lib/edmunds/make.rb +65 -0
- data/lib/edmunds/model.rb +67 -0
- data/lib/edmunds/model_year.rb +83 -0
- data/lib/edmunds/photo.rb +22 -0
- data/lib/edmunds/style.rb +23 -0
- data/lib/edmunds/version.rb +3 -0
- data/lib/edmunds_ruby.rb +6 -39
- metadata +12 -71
- data/README.rdoc +0 -3
- data/lib/edmunds_ruby/image_finders.rb +0 -29
- data/lib/edmunds_ruby/make_finders.rb +0 -53
- data/lib/edmunds_ruby/model_finders.rb +0 -24
- data/lib/edmunds_ruby/model_year_finders.rb +0 -8
- data/lib/edmunds_ruby/style_finders.rb +0 -14
- data/lib/edmunds_ruby/version.rb +0 -3
- data/test/dummy/README.rdoc +0 -261
- data/test/dummy/Rakefile +0 -7
- data/test/dummy/app/assets/javascripts/application.js +0 -15
- data/test/dummy/app/assets/stylesheets/application.css +0 -13
- data/test/dummy/app/controllers/application_controller.rb +0 -3
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/views/layouts/application.html.erb +0 -14
- data/test/dummy/config/application.rb +0 -59
- data/test/dummy/config/boot.rb +0 -10
- data/test/dummy/config/database.yml +0 -25
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -37
- data/test/dummy/config/environments/production.rb +0 -67
- data/test/dummy/config/environments/test.rb +0 -37
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/inflections.rb +0 -15
- data/test/dummy/config/initializers/mime_types.rb +0 -5
- data/test/dummy/config/initializers/secret_token.rb +0 -7
- data/test/dummy/config/initializers/session_store.rb +0 -8
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/test/dummy/config/locales/en.yml +0 -5
- data/test/dummy/config/routes.rb +0 -58
- data/test/dummy/config.ru +0 -4
- data/test/dummy/public/404.html +0 -26
- data/test/dummy/public/422.html +0 -26
- data/test/dummy/public/500.html +0 -25
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +0 -6
- data/test/edmunds_ruby_test.rb +0 -7
- data/test/test_helper.rb +0 -15
data/README.md
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
## Ruby wrapper for the Edmunds auto api
|
2
|
+
|
3
|
+
This API wrapper will allow you to make calls to the Edmunds Vehicle API to get detailed information about nearly any make, model, and style (trim).
|
4
|
+
You can also get production images for each vehicle.
|
5
|
+
|
6
|
+
|
7
|
+
## Setup:
|
8
|
+
|
9
|
+
First, include the gem in your Gemfile:
|
10
|
+
|
11
|
+
vim Gemfile
|
12
|
+
|
13
|
+
gem 'edmunds_ruby'
|
14
|
+
|
15
|
+
bundle
|
16
|
+
|
17
|
+
Or if using from the console, just install the gem:
|
18
|
+
|
19
|
+
gem install 'edmunds_ruby'
|
20
|
+
|
21
|
+
Now add your API key
|
22
|
+
|
23
|
+
### Get Edmunds Vehicle API key:
|
24
|
+
|
25
|
+
You will need to create an account with Edmunds and get a free developer Vehicle API key from here:
|
26
|
+
|
27
|
+
http://developer.edmunds.com
|
28
|
+
|
29
|
+
Once you get your API key, either create an initializer file to place it in OR add it to your .bashrc script
|
30
|
+
|
31
|
+
#### method 1 - put api key in an initializer file:
|
32
|
+
|
33
|
+
Create a new file in config/initializers called edmunds.rb, like so:
|
34
|
+
|
35
|
+
vim config/initializers/edmunds.rb
|
36
|
+
|
37
|
+
Add this line, with your api key:
|
38
|
+
|
39
|
+
Rails.configuration.edmunds_vehicle_api_key = "your_api_key_here"
|
40
|
+
|
41
|
+
Save the file and exit.
|
42
|
+
|
43
|
+
|
44
|
+
#### method 2 - put api key in your .bashrc script:
|
45
|
+
|
46
|
+
Open .bashrc file:
|
47
|
+
|
48
|
+
vim ~/.bashrc
|
49
|
+
|
50
|
+
Add this line near the top of the file:
|
51
|
+
|
52
|
+
export EDMUNDS_VEHICLE="your_api_key_here"
|
53
|
+
|
54
|
+
Save and close the file, then source the file to make the changes take effect:
|
55
|
+
|
56
|
+
source ~/.bashrc
|
57
|
+
|
58
|
+
Now you can use the Vehicle API as you like.
|
59
|
+
|
60
|
+
|
61
|
+
## Usage:
|
62
|
+
|
63
|
+
To use the gem, open a console and start playing.
|
64
|
+
There are currently 5 classes you can call: Make, Model, ModelYear, Style, and Photo
|
65
|
+
|
66
|
+
Some of the methods require inputs, others do not. Let's try an easy one first:
|
67
|
+
|
68
|
+
m = Edmunds::Make.new
|
69
|
+
m.find_all
|
70
|
+
|
71
|
+
This should return a list of all vehicle makes in the system.
|
72
|
+
|
73
|
+
For the Model class, you will have to provide an id first (which you can get from a Make response)
|
74
|
+
|
75
|
+
m = Edmunds::Model.new
|
76
|
+
m.find_by_id("Lamborghini_Diablo")
|
77
|
+
|
78
|
+
|
79
|
+
More documentation on the way...
|
80
|
+
|
81
|
+
|
82
|
+
## Bug reports and Pull requests
|
83
|
+
|
84
|
+
Please open an issue on Github if you find a bug, and I will address it.
|
85
|
+
|
86
|
+
If you have an improvement to submit, please fork the repo, add your code and send a pull request.
|
87
|
+
|
88
|
+
|
data/lib/edmunds/api.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
module Edmunds
|
2
|
+
class API
|
3
|
+
# Using this model requires setting your Edmunds API key in your ~/.bashrc file like so:
|
4
|
+
# export EDMUNDS_VEHICLE="your_api_key_here"
|
5
|
+
|
6
|
+
require 'rest_client'
|
7
|
+
require 'crack'
|
8
|
+
require 'crack/json'
|
9
|
+
|
10
|
+
attr_reader :base, :api_key, :image_base_url, :format, :base_url
|
11
|
+
|
12
|
+
def initialize
|
13
|
+
if set_key
|
14
|
+
@base = "http://api.edmunds.com/v1/api/vehicle"
|
15
|
+
@image_base_url = "http://media.ed.edmunds-media.com"
|
16
|
+
@format = "fmt=json&api_key=#{@api_key}"
|
17
|
+
else
|
18
|
+
return @errors
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def set_key
|
23
|
+
@api_key = ENV["EDMUNDS_VEHICLE"] || Rails.configuration.edmunds_vehicle_api_key
|
24
|
+
rescue
|
25
|
+
@errors = "You need to set your Edmunds Vehicle API key first"
|
26
|
+
return false
|
27
|
+
end
|
28
|
+
|
29
|
+
def call_api
|
30
|
+
@base_url = @base + @url + @format
|
31
|
+
@resp = RestClient.get(@base_url)
|
32
|
+
@json = Crack::JSON.parse(@resp)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
data/lib/edmunds/make.rb
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
module Edmunds
|
2
|
+
class Make < API
|
3
|
+
# Makes
|
4
|
+
def find_all
|
5
|
+
@url = "/makerepository/findall?"
|
6
|
+
call_api
|
7
|
+
@json["makeHolder"]
|
8
|
+
end
|
9
|
+
|
10
|
+
def find_by_id(make_id)
|
11
|
+
@url = "/makerepository/findbyid?id=#{make_id}&"
|
12
|
+
call_api
|
13
|
+
@json["makeHolder"]
|
14
|
+
end
|
15
|
+
|
16
|
+
def find_future_makes
|
17
|
+
@url = "/makerepository/findfuturemakes?"
|
18
|
+
call_api
|
19
|
+
@json["makeHolder"]
|
20
|
+
end
|
21
|
+
|
22
|
+
def find_make_by_name(make_name)
|
23
|
+
@url = "/makerepository/findmakebyname?name=#{make_name}&"
|
24
|
+
call_api
|
25
|
+
@json["makeHolder"]
|
26
|
+
end
|
27
|
+
|
28
|
+
def find_makes_by_model_year(model_year)
|
29
|
+
@url = "/makerepository/findmakesbymodelyear?year=#{model_year}&"
|
30
|
+
call_api
|
31
|
+
@json["makeHolder"]
|
32
|
+
end
|
33
|
+
|
34
|
+
def find_makes_by_publication_state(condition)
|
35
|
+
# should either be "new" or "used"
|
36
|
+
@url = "/makerepository/findmakesbypublicationstate?state=#{condition}&"
|
37
|
+
call_api
|
38
|
+
@json["makeHolder"]
|
39
|
+
end
|
40
|
+
|
41
|
+
def find_new_and_used
|
42
|
+
@url = "/makerepository/findnewandused?"
|
43
|
+
call_api
|
44
|
+
@json["makeHolder"]
|
45
|
+
end
|
46
|
+
|
47
|
+
def find_new_and_used_makes_by_model_year(year)
|
48
|
+
@url = "/makerepository/findnewandusedmakesbymodelyear?year=#{year}&"
|
49
|
+
call_api
|
50
|
+
@json["makeHolder"]
|
51
|
+
end
|
52
|
+
|
53
|
+
def find_new_makes
|
54
|
+
@url = "/makerepository/findnewmakes?"
|
55
|
+
call_api
|
56
|
+
@json["makeHolder"]
|
57
|
+
end
|
58
|
+
|
59
|
+
def find_used_makes
|
60
|
+
@url = "/makerepository/findusedmakes?"
|
61
|
+
call_api
|
62
|
+
@json["makeHolder"]
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
module Edmunds
|
2
|
+
class Model < API
|
3
|
+
|
4
|
+
# models
|
5
|
+
def find_by_id(model_id)
|
6
|
+
@url = "/modelrepository/findbyid?id=#{model_id}&"
|
7
|
+
call_api
|
8
|
+
@json["modelHolder"]
|
9
|
+
end
|
10
|
+
|
11
|
+
def find_by_make_id(make_id)
|
12
|
+
@url = "/modelrepository/findbymakeid?makeid=#{make_id}&"
|
13
|
+
call_api
|
14
|
+
@json["modelHolder"]
|
15
|
+
end
|
16
|
+
|
17
|
+
def find_future_models_by_make_id(make_id)
|
18
|
+
@url = "/modelrepository/findfuturemodelsbymakeid?makeid=#{make_id}&"
|
19
|
+
call_api
|
20
|
+
@json["modelHolder"]
|
21
|
+
end
|
22
|
+
|
23
|
+
def find_model_by_make_model_name(make_name, model_name)
|
24
|
+
@url = "/modelrepository/findmodelbymakemodelname?make=#{make_name}&model=#{model_name}&"
|
25
|
+
call_api
|
26
|
+
@json["modelHolder"]
|
27
|
+
end
|
28
|
+
|
29
|
+
def find_models_by_make(make)
|
30
|
+
@url = "/modelrepository/findmodelsbymake?make=#{make}&"
|
31
|
+
call_api
|
32
|
+
@json["modelHolder"]
|
33
|
+
end
|
34
|
+
|
35
|
+
def find_models_by_make_and_publication_state(make, state)
|
36
|
+
# state should be "new", "used", etc..
|
37
|
+
@url = "/modelrepository/findmodelsbymakeandpublicationstate?make=#{make}&state=#{state}&"
|
38
|
+
call_api
|
39
|
+
@json["modelHolder"]
|
40
|
+
end
|
41
|
+
|
42
|
+
def find_models_by_make_and_year(make, year)
|
43
|
+
@url = "/modelrepository/findmodelsbymakeandyear?make=#{make}&year=#{year}&"
|
44
|
+
call_api
|
45
|
+
@json["modelHolder"]
|
46
|
+
end
|
47
|
+
|
48
|
+
def find_new_and_used_models_by_make_id(make_id)
|
49
|
+
@url = "/modelrepository/findnewandusedmodelsbymakeid?makeid=#{make_id}&"
|
50
|
+
call_api
|
51
|
+
@json["modelHolder"]
|
52
|
+
end
|
53
|
+
|
54
|
+
def find_new_models_by_make_id(make_id)
|
55
|
+
@url = "/modelrepository/findnewmodelsbymakeid?makeId=#{make_id}&"
|
56
|
+
call_api
|
57
|
+
@json["modelHolder"]
|
58
|
+
end
|
59
|
+
|
60
|
+
def find_used_models_by_make_id(make_id)
|
61
|
+
@url = "/modelrepository/findusedmodelsbymakeid?makeId=#{make_id}&"
|
62
|
+
call_api
|
63
|
+
@json["modelHolder"]
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
module Edmunds
|
2
|
+
class ModelYear < API
|
3
|
+
|
4
|
+
def find_by_id(id)
|
5
|
+
@url = "/modelyearrepository/findbyid?id=#{id}&"
|
6
|
+
call_api
|
7
|
+
@json["modelYearHolder"]
|
8
|
+
end
|
9
|
+
|
10
|
+
def find_distinct_year_with_new
|
11
|
+
@url = "/modelyearrepository/finddistinctyearwithnew?"
|
12
|
+
call_api
|
13
|
+
@json
|
14
|
+
end
|
15
|
+
|
16
|
+
def find_distinct_year_with_new_or_used
|
17
|
+
@url = "/modelyearrepository/finddistinctyearwithneworused?"
|
18
|
+
call_api
|
19
|
+
@json
|
20
|
+
end
|
21
|
+
|
22
|
+
def find_distinct_year_with_used
|
23
|
+
@url = "/modelyearrepository/finddistinctyearwithused?"
|
24
|
+
call_api
|
25
|
+
@json
|
26
|
+
end
|
27
|
+
|
28
|
+
def find_future_model_years_by_model_id(model_id)
|
29
|
+
@url = "/modelyearrepository/findfuturemodelyearsbymodelid?modelId=#{model_id}&"
|
30
|
+
call_api
|
31
|
+
@json["modelYearHolder"]
|
32
|
+
end
|
33
|
+
|
34
|
+
def find_model_years_by_make_and_year(make, year)
|
35
|
+
@url = "/modelyearrepository/findmodelyearsbymakeandyear?make=#{make}&year=#{year}&"
|
36
|
+
call_api
|
37
|
+
@json["modelYearHolder"]
|
38
|
+
end
|
39
|
+
|
40
|
+
def find_model_years_by_make_model(make, model)
|
41
|
+
@url = "/modelyearrepository/findmodelyearsbymakemodel?make=#{make}&model=#{model}&"
|
42
|
+
call_api
|
43
|
+
@json["modelYearHolder"]
|
44
|
+
end
|
45
|
+
|
46
|
+
def find_new_and_used_model_years_by_makeid_and_year(make_id, year)
|
47
|
+
@url = "/modelyearrepository/findnewandusedmodelyearsbymakeidandyear?makeid=#{make_id}&year=#{year}&"
|
48
|
+
call_api
|
49
|
+
@json["modelYearHolder"]
|
50
|
+
end
|
51
|
+
|
52
|
+
def find_new_model_years_by_model_id(model_id)
|
53
|
+
@url = "/modelyearrepository/findnewmodelyearsbymodelid?modelId=#{model_id}&"
|
54
|
+
call_api
|
55
|
+
@json["modelYearHolder"]
|
56
|
+
end
|
57
|
+
|
58
|
+
def find_used_model_years_by_model_id(model_id)
|
59
|
+
@url = "/modelyearrepository/findusedmodelyearsbymodelid?modelId=#{model_id}&"
|
60
|
+
call_api
|
61
|
+
@json["modelYearHolder"]
|
62
|
+
end
|
63
|
+
|
64
|
+
def find_years_by_category_and_publication_state(category, state)
|
65
|
+
@url = "/modelyearrepository/findyearsbycategoryandpublicationstate?category=#{category}&state=#{state}&"
|
66
|
+
call_api
|
67
|
+
@json
|
68
|
+
end
|
69
|
+
|
70
|
+
def for_model_id(model_id)
|
71
|
+
@url = "/modelyearrepository/formodelid?modelid=#{model_id}&"
|
72
|
+
call_api
|
73
|
+
@json["modelYearHolder"]
|
74
|
+
end
|
75
|
+
|
76
|
+
def for_year_make_model(year, make, model)
|
77
|
+
@url = "/modelyearrepository/foryearmakemodel?year=#{year}&make=#{make}&model=#{model}&"
|
78
|
+
call_api
|
79
|
+
@json["modelYearHolder"]
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Edmunds
|
2
|
+
class Photo < API
|
3
|
+
|
4
|
+
# get an array of images available from this style id
|
5
|
+
def find_by_style_id(style_id)
|
6
|
+
@url = "photo/service/findphotosbystyleid?styleId=#{style_id}&"
|
7
|
+
call_api
|
8
|
+
@json
|
9
|
+
end
|
10
|
+
|
11
|
+
# get the array of images, then sample one image from the group of exterior and front quarter panel (FQ) shots, then go ahead and append the base url so you can view the image directly.
|
12
|
+
# if no sample is found, just return the entire array.
|
13
|
+
def find_sample_by_style_id(style_id)
|
14
|
+
@url = "photo/service/findphotosbystyleid?styleId=#{style_id}&"
|
15
|
+
call_api
|
16
|
+
@image = @image_base_url + @json.select{|s| s["subType"] == "exterior" && s["shotTypeAbbreviation"] == "FQ" }.first["photoSrcs"].select{|s| s.match(/\d{3}(.jpg)/) }.max
|
17
|
+
rescue
|
18
|
+
@json
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Edmunds
|
2
|
+
class Style < API
|
3
|
+
|
4
|
+
def find_by_id(style_id)
|
5
|
+
@url = "/stylerepository/findbyid?id=#{style_id}&"
|
6
|
+
call_api
|
7
|
+
@json["styleHolder"]
|
8
|
+
end
|
9
|
+
|
10
|
+
def find_styles_by_make_model_year(make, model, year)
|
11
|
+
@url = "/stylerepository/findstylesbymakemodelyear?make=#{make}&model=#{model}&year=#{year}&"
|
12
|
+
call_api
|
13
|
+
@json["styleHolder"]
|
14
|
+
end
|
15
|
+
|
16
|
+
def find_styles_by_model_year_id(model_year_id)
|
17
|
+
@url = "/stylerepository/findstylesbymodelyearid?modelyearid=#{model_year_id}&"
|
18
|
+
call_api
|
19
|
+
@json["styleHolder"]
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
data/lib/edmunds_ruby.rb
CHANGED
@@ -1,40 +1,7 @@
|
|
1
|
-
require '
|
2
|
-
require '
|
3
|
-
require '
|
4
|
-
require '
|
5
|
-
require '
|
1
|
+
require 'edmunds/api'
|
2
|
+
require 'edmunds/photo'
|
3
|
+
require 'edmunds/make'
|
4
|
+
require 'edmunds/model'
|
5
|
+
require 'edmunds/model_year'
|
6
|
+
require 'edmunds/style'
|
6
7
|
|
7
|
-
module EdmundsRuby
|
8
|
-
|
9
|
-
class API
|
10
|
-
include MakeFinders
|
11
|
-
include ModelFinders
|
12
|
-
include ModelYearFinders
|
13
|
-
include StyleFinders
|
14
|
-
include ImageFinders
|
15
|
-
|
16
|
-
# Using this model requires setting your Edmunds API key in your ~/.bashrc file like so:
|
17
|
-
# export EDMUNDS_VEHICLE="your_api_key_here"
|
18
|
-
|
19
|
-
require 'rest_client'
|
20
|
-
require 'crack'
|
21
|
-
require 'crack/json'
|
22
|
-
|
23
|
-
attr_reader :data, :image, :images
|
24
|
-
|
25
|
-
def initialize
|
26
|
-
@base = "http://api.edmunds.com/v1/api/vehicle"
|
27
|
-
@api_key = ENV["EDMUNDS_VEHICLE"]
|
28
|
-
@image_base_url = "http://media.ed.edmunds-media.com"
|
29
|
-
@format = "fmt=json&api_key=#{@api_key}"
|
30
|
-
end
|
31
|
-
|
32
|
-
def call_api
|
33
|
-
@base_url = @base + @url + @format
|
34
|
-
@resp = RestClient.get(@base_url)
|
35
|
-
@json = Crack::JSON.parse(@resp)
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: edmunds_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-07-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -67,46 +67,17 @@ extensions: []
|
|
67
67
|
extra_rdoc_files: []
|
68
68
|
files:
|
69
69
|
- lib/tasks/edmunds_ruby_tasks.rake
|
70
|
-
- lib/edmunds_ruby/image_finders.rb
|
71
|
-
- lib/edmunds_ruby/model_year_finders.rb
|
72
|
-
- lib/edmunds_ruby/version.rb
|
73
|
-
- lib/edmunds_ruby/make_finders.rb
|
74
|
-
- lib/edmunds_ruby/model_finders.rb
|
75
|
-
- lib/edmunds_ruby/style_finders.rb
|
76
70
|
- lib/edmunds_ruby.rb
|
71
|
+
- lib/edmunds/photo.rb
|
72
|
+
- lib/edmunds/model.rb
|
73
|
+
- lib/edmunds/version.rb
|
74
|
+
- lib/edmunds/model_year.rb
|
75
|
+
- lib/edmunds/style.rb
|
76
|
+
- lib/edmunds/api.rb
|
77
|
+
- lib/edmunds/make.rb
|
77
78
|
- MIT-LICENSE
|
78
79
|
- Rakefile
|
79
|
-
- README.
|
80
|
-
- test/edmunds_ruby_test.rb
|
81
|
-
- test/dummy/script/rails
|
82
|
-
- test/dummy/README.rdoc
|
83
|
-
- test/dummy/public/500.html
|
84
|
-
- test/dummy/public/422.html
|
85
|
-
- test/dummy/public/favicon.ico
|
86
|
-
- test/dummy/public/404.html
|
87
|
-
- test/dummy/app/controllers/application_controller.rb
|
88
|
-
- test/dummy/app/helpers/application_helper.rb
|
89
|
-
- test/dummy/app/assets/javascripts/application.js
|
90
|
-
- test/dummy/app/assets/stylesheets/application.css
|
91
|
-
- test/dummy/app/views/layouts/application.html.erb
|
92
|
-
- test/dummy/config/initializers/backtrace_silencers.rb
|
93
|
-
- test/dummy/config/initializers/wrap_parameters.rb
|
94
|
-
- test/dummy/config/initializers/session_store.rb
|
95
|
-
- test/dummy/config/initializers/secret_token.rb
|
96
|
-
- test/dummy/config/initializers/inflections.rb
|
97
|
-
- test/dummy/config/initializers/mime_types.rb
|
98
|
-
- test/dummy/config/application.rb
|
99
|
-
- test/dummy/config/environments/test.rb
|
100
|
-
- test/dummy/config/environments/production.rb
|
101
|
-
- test/dummy/config/environments/development.rb
|
102
|
-
- test/dummy/config/routes.rb
|
103
|
-
- test/dummy/config/locales/en.yml
|
104
|
-
- test/dummy/config/database.yml
|
105
|
-
- test/dummy/config/environment.rb
|
106
|
-
- test/dummy/config/boot.rb
|
107
|
-
- test/dummy/Rakefile
|
108
|
-
- test/dummy/config.ru
|
109
|
-
- test/test_helper.rb
|
80
|
+
- README.md
|
110
81
|
homepage: http://isotope11.com
|
111
82
|
licenses: []
|
112
83
|
post_install_message:
|
@@ -127,38 +98,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
98
|
version: '0'
|
128
99
|
requirements: []
|
129
100
|
rubyforge_project:
|
130
|
-
rubygems_version: 1.8.
|
101
|
+
rubygems_version: 1.8.25
|
131
102
|
signing_key:
|
132
103
|
specification_version: 3
|
133
104
|
summary: Edmunds auto API
|
134
|
-
test_files:
|
135
|
-
- test/edmunds_ruby_test.rb
|
136
|
-
- test/dummy/script/rails
|
137
|
-
- test/dummy/README.rdoc
|
138
|
-
- test/dummy/public/500.html
|
139
|
-
- test/dummy/public/422.html
|
140
|
-
- test/dummy/public/favicon.ico
|
141
|
-
- test/dummy/public/404.html
|
142
|
-
- test/dummy/app/controllers/application_controller.rb
|
143
|
-
- test/dummy/app/helpers/application_helper.rb
|
144
|
-
- test/dummy/app/assets/javascripts/application.js
|
145
|
-
- test/dummy/app/assets/stylesheets/application.css
|
146
|
-
- test/dummy/app/views/layouts/application.html.erb
|
147
|
-
- test/dummy/config/initializers/backtrace_silencers.rb
|
148
|
-
- test/dummy/config/initializers/wrap_parameters.rb
|
149
|
-
- test/dummy/config/initializers/session_store.rb
|
150
|
-
- test/dummy/config/initializers/secret_token.rb
|
151
|
-
- test/dummy/config/initializers/inflections.rb
|
152
|
-
- test/dummy/config/initializers/mime_types.rb
|
153
|
-
- test/dummy/config/application.rb
|
154
|
-
- test/dummy/config/environments/test.rb
|
155
|
-
- test/dummy/config/environments/production.rb
|
156
|
-
- test/dummy/config/environments/development.rb
|
157
|
-
- test/dummy/config/routes.rb
|
158
|
-
- test/dummy/config/locales/en.yml
|
159
|
-
- test/dummy/config/database.yml
|
160
|
-
- test/dummy/config/environment.rb
|
161
|
-
- test/dummy/config/boot.rb
|
162
|
-
- test/dummy/Rakefile
|
163
|
-
- test/dummy/config.ru
|
164
|
-
- test/test_helper.rb
|
105
|
+
test_files: []
|
data/README.rdoc
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
module EdmundsRuby::ImageFinders
|
2
|
-
|
3
|
-
def get_image(style_id)
|
4
|
-
@url = "photo/service/findphotosbystyleid?styleId=#{style_id}&"
|
5
|
-
call_api
|
6
|
-
@image = @image_base_url + @json.select{|s| s["subType"] == "exterior" && s["shotTypeAbbreviation"] == "FQ" }.first["photoSrcs"].select{|s| s.match(/\d{3}(.jpg)/) }.max
|
7
|
-
rescue
|
8
|
-
"http://webmuseum.mit.edu/mobiusicons/no_image.jpg"
|
9
|
-
end
|
10
|
-
|
11
|
-
def get_images(style_id)
|
12
|
-
@url = "photo/service/findphotosbystyleid?styleId=#{style_id}&"
|
13
|
-
call_api
|
14
|
-
@images = []
|
15
|
-
@json.each do |image|
|
16
|
-
if image["photoSrcs"].select{|s| s.match(/\d{3}(.jpg)/) }.present?
|
17
|
-
@images.push(@image_base_url + image["photoSrcs"].select{|s| s.match(/\d{3}(.jpg)/) }.max)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
@images
|
21
|
-
rescue
|
22
|
-
if @images.present?
|
23
|
-
@images
|
24
|
-
else
|
25
|
-
["http://webmuseum.mit.edu/mobiusicons/no_image.jpg"]
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
module EdmundsRuby::MakeFinders
|
2
|
-
# Makes
|
3
|
-
def find_all_makes
|
4
|
-
@url = "/makerepository/findall?"
|
5
|
-
call_api
|
6
|
-
end
|
7
|
-
|
8
|
-
def find_make_by_id(make_id)
|
9
|
-
@url = "/makerepository/findbyid?id=#{make_id}&"
|
10
|
-
call_api
|
11
|
-
end
|
12
|
-
|
13
|
-
def find_future_makes
|
14
|
-
@url = "/makerepository/findfuturemakes?"
|
15
|
-
call_api
|
16
|
-
end
|
17
|
-
|
18
|
-
def find_make_by_name(make_name)
|
19
|
-
@url = "/makerepository/findmakebyname?name=#{make_name}&"
|
20
|
-
call_api
|
21
|
-
end
|
22
|
-
|
23
|
-
def find_makes_by_model_year(model_year)
|
24
|
-
@url = "/makerepository/findmakesbymodelyear?year=#{model_year}&"
|
25
|
-
call_api
|
26
|
-
end
|
27
|
-
|
28
|
-
def find_makes_by_publication_state(condition)
|
29
|
-
# should either be "new" or "used"
|
30
|
-
@url = "/makerepository/findmakesbypublicationstate?state=#{condition}&"
|
31
|
-
call_api
|
32
|
-
end
|
33
|
-
|
34
|
-
def find_new_and_used
|
35
|
-
@url = "/makerepository/findnewandused"
|
36
|
-
call_api
|
37
|
-
end
|
38
|
-
|
39
|
-
def find_new_and_used_makes_by_model_year(year)
|
40
|
-
@url = "/makerepository/findnewandusedmakesbymodelyear?year=#{year}&"
|
41
|
-
call_api
|
42
|
-
end
|
43
|
-
|
44
|
-
def find_new_makes
|
45
|
-
@url = "/makerepository/findnewmakes?"
|
46
|
-
call_api
|
47
|
-
end
|
48
|
-
|
49
|
-
def find_used_makes
|
50
|
-
@url = "/makerepository/findusedmakes?"
|
51
|
-
call_api
|
52
|
-
end
|
53
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
module EdmundsRuby::ModelFinders
|
2
|
-
|
3
|
-
# models
|
4
|
-
def find_model_by_id(model_id)
|
5
|
-
@url = "/modelrepository/findbyid?id=#{model_id}&"
|
6
|
-
call_api
|
7
|
-
end
|
8
|
-
|
9
|
-
def find_models_by_make_id(make_id)
|
10
|
-
@url = "/modelrepository/findbymakeid?makeid=#{make_id}&"
|
11
|
-
call_api
|
12
|
-
end
|
13
|
-
|
14
|
-
def find_new_models_by_make_id(make_id)
|
15
|
-
@url = "/modelrepository/findnewmodelsbymakeid?makeId=#{make_id}&"
|
16
|
-
call_api
|
17
|
-
end
|
18
|
-
|
19
|
-
def find_used_models_by_make_id(make_id)
|
20
|
-
@url = "/modelrepository/findusedmodelsbymakeid?makeId=#{make_id}&"
|
21
|
-
call_api
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
module EdmundsRuby::StyleFinders
|
2
|
-
|
3
|
-
# styles
|
4
|
-
def get_model_year_styles(model_year_id)
|
5
|
-
@url = "/stylerepository/findstylesbymodelyearid?modelyearid=#{model_year_id}&"
|
6
|
-
call_api
|
7
|
-
end
|
8
|
-
|
9
|
-
def trim_info(style_id)
|
10
|
-
@url = "/stylerepository/findbyid?id=#{style_id}&"
|
11
|
-
call_api
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|