Class: Edmunds::Model

Inherits:
API
  • Object
show all
Defined in:
lib/edmunds/model.rb

Instance Attribute Summary

Attributes inherited from API

#api_key, #base, #base_url, #format, #image_base_url

Instance Method Summary collapse

Methods inherited from API

#call_api, #initialize, #set_key

Constructor Details

This class inherits a constructor from Edmunds::API

Instance Method Details

#find_by_id(model_id) ⇒ Object

models



5
6
7
8
9
# File 'lib/edmunds/model.rb', line 5

def find_by_id(model_id)
  @url = "/modelrepository/findbyid?id=#{model_id}&"
  call_api
  @json["modelHolder"]
end

#find_by_make_id(make_id) ⇒ Object



11
12
13
14
15
# File 'lib/edmunds/model.rb', line 11

def find_by_make_id(make_id)
  @url = "/modelrepository/findbymakeid?makeid=#{make_id}&"
  call_api
  @json["modelHolder"]
end

#find_future_models_by_make_id(make_id) ⇒ Object



17
18
19
20
21
# File 'lib/edmunds/model.rb', line 17

def find_future_models_by_make_id(make_id)
  @url = "/modelrepository/findfuturemodelsbymakeid?makeid=#{make_id}&"
  call_api
  @json["modelHolder"]
end

#find_model_by_make_model_name(make_name, model_name) ⇒ Object



23
24
25
26
27
# File 'lib/edmunds/model.rb', line 23

def find_model_by_make_model_name(make_name, model_name)
  @url = "/modelrepository/findmodelbymakemodelname?make=#{make_name}&model=#{model_name}&"
  call_api
  @json["modelHolder"]
end

#find_models_by_make(make) ⇒ Object



29
30
31
32
33
# File 'lib/edmunds/model.rb', line 29

def find_models_by_make(make)
  @url = "/modelrepository/findmodelsbymake?make=#{make}&"
  call_api
  @json["modelHolder"]
end

#find_models_by_make_and_publication_state(make, state) ⇒ Object



35
36
37
38
39
40
# File 'lib/edmunds/model.rb', line 35

def find_models_by_make_and_publication_state(make, state)
  # state should be "new", "used", etc..
  @url = "/modelrepository/findmodelsbymakeandpublicationstate?make=#{make}&state=#{state}&"
  call_api
  @json["modelHolder"]
end

#find_models_by_make_and_year(make, year) ⇒ Object



42
43
44
45
46
# File 'lib/edmunds/model.rb', line 42

def find_models_by_make_and_year(make, year)
  @url = "/modelrepository/findmodelsbymakeandyear?make=#{make}&year=#{year}&"
  call_api
  @json["modelHolder"]
end

#find_new_and_used_models_by_make_id(make_id) ⇒ Object



48
49
50
51
52
# File 'lib/edmunds/model.rb', line 48

def find_new_and_used_models_by_make_id(make_id)
  @url = "/modelrepository/findnewandusedmodelsbymakeid?makeid=#{make_id}&"
  call_api
  @json["modelHolder"]
end

#find_new_models_by_make_id(make_id) ⇒ Object



54
55
56
57
58
# File 'lib/edmunds/model.rb', line 54

def find_new_models_by_make_id(make_id)
  @url = "/modelrepository/findnewmodelsbymakeid?makeId=#{make_id}&"
  call_api
  @json["modelHolder"]
end

#find_used_models_by_make_id(make_id) ⇒ Object



60
61
62
63
64
# File 'lib/edmunds/model.rb', line 60

def find_used_models_by_make_id(make_id)
  @url = "/modelrepository/findusedmodelsbymakeid?makeId=#{make_id}&"
  call_api
  @json["modelHolder"]
end