Class: Edmunds::Vehicle::Specification::Make::Makes
- Inherits:
-
Object
- Object
- Edmunds::Vehicle::Specification::Make::Makes
- Defined in:
- lib/edmunds/vehicle/specification/make.rb
Instance Attribute Summary collapse
-
#makes ⇒ Object
readonly
Returns the value of attribute makes.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes) ⇒ Makes
constructor
A new instance of Makes.
Constructor Details
#initialize(attributes) ⇒ Makes
16 17 18 |
# File 'lib/edmunds/vehicle/specification/make.rb', line 16 def initialize(attributes) @makes = attributes['makes'].map { |json| Make.new(json) } if attributes.key?('makes') end |
Instance Attribute Details
#makes ⇒ Object (readonly)
Returns the value of attribute makes.
14 15 16 |
# File 'lib/edmunds/vehicle/specification/make.rb', line 14 def makes @makes end |
Class Method Details
.find(api_params = {}) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/edmunds/vehicle/specification/make.rb', line 20 def self.find(api_params = {}) response = Edmunds::Api.get("#{MAKES_API_URL}") do |request| request.raw_parameters = api_params request.allowed_parameters = { 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 |