Class: Edmunds::Vehicle::Specification::Make::MakesCount
- Inherits:
-
Object
- Object
- Edmunds::Vehicle::Specification::Make::MakesCount
- Defined in:
- lib/edmunds/vehicle/specification/make.rb
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
Returns the value of attribute count.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes) ⇒ MakesCount
constructor
A new instance of MakesCount.
Constructor Details
#initialize(attributes) ⇒ MakesCount
Returns a new instance of MakesCount.
75 76 77 |
# File 'lib/edmunds/vehicle/specification/make.rb', line 75 def initialize(attributes) @count = attributes['makesCount'] end |
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count.
73 74 75 |
# File 'lib/edmunds/vehicle/specification/make.rb', line 73 def count @count end |
Class Method Details
.find(api_params = {}) ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/edmunds/vehicle/specification/make.rb', line 79 def self.find(api_params = {}) response = Edmunds::Api.get("#{MAKES_COUNT_API_URL}") do |request| request.raw_parameters = api_params request.allowed_parameters = { state: %w[new used future], year: ((1990.to_s)..(Date.today.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 |