class Edmunds::Vehicle::Specification::Option::OptionsByStyle
Attributes
count[R]
options[R]
Public Class Methods
find(style_id, api_params = {})
click to toggle source
# File lib/edmunds/vehicle/specification/option.rb, line 21 def self.find(style_id, api_params = {}) response = Edmunds::Api.get("#{STYLE_API_URL}/#{style_id}/options") do |request| request.raw_parameters = api_params request.allowed_parameters = { category: %w[Interior Exterior Roof Interior\ Trim Mechanical Package Additional\ Fees Other], fmt: %w[json] } request.default_parameters = { 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/option.rb, line 16 def initialize(attributes) @options = attributes['options'].map { |json| Option.new(json) } if attributes.key?('options') @count = attributes['optionsCount'] end