Class: Edmunds::Vehicle::Specification::Model::ModelsCount
- Inherits:
-
Object
- Object
- Edmunds::Vehicle::Specification::Model::ModelsCount
- Defined in:
- lib/edmunds/vehicle/specification/model.rb
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
Returns the value of attribute count.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes) ⇒ ModelsCount
constructor
A new instance of ModelsCount.
Constructor Details
#initialize(attributes) ⇒ ModelsCount
Returns a new instance of ModelsCount.
76 77 78 |
# File 'lib/edmunds/vehicle/specification/model.rb', line 76 def initialize(attributes) @count = attributes['modelsCount'] end |
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count.
74 75 76 |
# File 'lib/edmunds/vehicle/specification/model.rb', line 74 def count @count end |
Class Method Details
.find(make_name, api_params = {}) ⇒ Object
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/edmunds/vehicle/specification/model.rb', line 80 def self.find(make_name, api_params = {}) response = Edmunds::Api.get("#{MODEL_API_URL}/#{make_name}/models/count") 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 |