class Edmunds::Vehicle::Specification::Make::MakesCount

Attributes

count[R]

Public Class Methods

find(api_params = {}) click to toggle source
# 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
new(attributes) click to toggle source
# File lib/edmunds/vehicle/specification/make.rb, line 75
def initialize(attributes)
  @count = attributes['makesCount']
end