Class: Edmunds::Vehicle::Specification::Color::ColorsDetails

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ ColorsDetails

Returns a new instance of ColorsDetails.



51
52
53
54
55
56
57
58
59
# File 'lib/edmunds/vehicle/specification/color.rb', line 51

def initialize(attributes)
  @id = attributes['id']
  @name = attributes['name']
  @equipment_type = attributes['equipmentType']
  @availability = attributes['availability']
  @manufacture_option_name = attributes['manufactureOptionName']
  @manufacture_option_code = attributes['manufactureOptionCode']
  @category = attributes['category']
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



40
41
42
# File 'lib/edmunds/vehicle/specification/color.rb', line 40

def attributes
  @attributes
end

#availabilityObject (readonly)

Returns the value of attribute availability.



40
41
42
# File 'lib/edmunds/vehicle/specification/color.rb', line 40

def availability
  @availability
end

#categoryObject (readonly)

Returns the value of attribute category.



40
41
42
# File 'lib/edmunds/vehicle/specification/color.rb', line 40

def category
  @category
end

#color_chipsObject (readonly)

Returns the value of attribute color_chips.



40
41
42
# File 'lib/edmunds/vehicle/specification/color.rb', line 40

def color_chips
  @color_chips
end

#equipment_typeObject (readonly)

Returns the value of attribute equipment_type.



40
41
42
# File 'lib/edmunds/vehicle/specification/color.rb', line 40

def equipment_type
  @equipment_type
end

#fabric_TypesObject (readonly)

Returns the value of attribute fabric_Types.



40
41
42
# File 'lib/edmunds/vehicle/specification/color.rb', line 40

def fabric_Types
  @fabric_Types
end

#idObject (readonly)

Returns the value of attribute id.



40
41
42
# File 'lib/edmunds/vehicle/specification/color.rb', line 40

def id
  @id
end

#manufacture_option_codeObject (readonly)

Returns the value of attribute manufacture_option_code.



40
41
42
# File 'lib/edmunds/vehicle/specification/color.rb', line 40

def manufacture_option_code
  @manufacture_option_code
end

#manufacture_option_nameObject (readonly)

Returns the value of attribute manufacture_option_name.



40
41
42
# File 'lib/edmunds/vehicle/specification/color.rb', line 40

def manufacture_option_name
  @manufacture_option_name
end

#nameObject (readonly)

Returns the value of attribute name.



40
41
42
# File 'lib/edmunds/vehicle/specification/color.rb', line 40

def name
  @name
end

Class Method Details

.find(color_id, api_params = {}) ⇒ Object



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/edmunds/vehicle/specification/color.rb', line 61

def self.find(color_id, api_params = {})
  response = Edmunds::Api.get("#{COLORS_API_URL}/#{color_id}") do |request|
    request.raw_parameters = api_params

    request.allowed_parameters = {
        fmt: %w[json]
    }

    request.default_parameters = { fmt: 'json' }

    request.required_parameters = %w[fmt]
  end

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