Class: Edmunds::Vehicle::Specification::Style::StylesCountMakeModel

Inherits:
Object
  • Object
show all
Defined in:
lib/edmunds/vehicle/specification/style.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ StylesCountMakeModel

Returns a new instance of StylesCountMakeModel.



121
122
123
# File 'lib/edmunds/vehicle/specification/style.rb', line 121

def initialize(attributes)
  @count = attributes['stylesCount']
end

Instance Attribute Details

#countObject (readonly)

Returns the value of attribute count.



119
120
121
# File 'lib/edmunds/vehicle/specification/style.rb', line 119

def count
  @count
end

Class Method Details

.find(make_name, model_name, api_params = {}) ⇒ Object



125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/edmunds/vehicle/specification/style.rb', line 125

def self.find(make_name, model_name, api_params = {})
  response = Edmunds::Api.get("#{BASE_API_URL}/#{make_name}/#{model_name}/styles/count") do |request|

    request.raw_parameters = api_params

    request.allowed_parameters = {
      state: %w[new used future],
      fmt:  %w[json]
    }

    request.default_parameters = { fmt: 'json' }

    request.required_parameters = %w[fmt]
  end

  attributes = JSON.parse(response.body)
  new(attributes)
end