Class: Edmunds::Vehicle::Specification::Model::Models
- Inherits:
-
Object
- Object
- Edmunds::Vehicle::Specification::Model::Models
- Defined in:
- lib/edmunds/vehicle/specification/model.rb
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#models ⇒ Object
readonly
Returns the value of attribute models.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes) ⇒ Models
constructor
A new instance of Models.
Constructor Details
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count.
43 44 45 |
# File 'lib/edmunds/vehicle/specification/model.rb', line 43 def count @count end |
#models ⇒ Object (readonly)
Returns the value of attribute models.
43 44 45 |
# File 'lib/edmunds/vehicle/specification/model.rb', line 43 def models @models end |
Class Method Details
.find(make_name, api_params = {}) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/edmunds/vehicle/specification/model.rb', line 50 def self.find(make_name, api_params = {}) response = Edmunds::Api.get("#{MODEL_API_URL}/#{make_name}/models") do |request| request.raw_parameters = api_params request.allowed_parameters = { submodel: Edmunds::Vehicle::SUBMODEL_REGEX, category: Edmunds::Vehicle::VEHICLE_CATEGORIES, state: %w[new used future], year: ((1990.to_s)..(Date.current.year.to_s)), view: %w[basic full], fmt: %w[json] } request.default_parameters = { view: 'basic', fmt: 'json' } request.required_parameters = %w[fmt] end attributes = JSON.parse(response.body) new(attributes) end |