Class: TRMNL::API::Models::Palette
- Inherits:
-
Struct
- Object
- Struct
- TRMNL::API::Models::Palette
- Defined in:
- lib/trmnl/api/models/palette.rb
Overview
Models the data of the API response.
Instance Attribute Summary collapse
-
#colors ⇒ Object
Returns the value of attribute colors.
-
#framework_class ⇒ Object
Returns the value of attribute framework_class.
-
#grays ⇒ Object
Returns the value of attribute grays.
-
#label ⇒ Object
Returns the value of attribute label.
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Palette
constructor
A new instance of Palette.
Constructor Details
#initialize ⇒ Palette
Returns a new instance of Palette.
15 16 17 18 19 20 |
# File 'lib/trmnl/api/models/palette.rb', line 15 def initialize(**) super self[:grays] ||= 0 self[:colors] ||= Core::EMPTY_ARRAY freeze end |
Instance Attribute Details
#colors ⇒ Object
Returns the value of attribute colors
10 11 12 |
# File 'lib/trmnl/api/models/palette.rb', line 10 def colors @colors end |
#framework_class ⇒ Object
Returns the value of attribute framework_class
10 11 12 |
# File 'lib/trmnl/api/models/palette.rb', line 10 def framework_class @framework_class end |
#grays ⇒ Object
Returns the value of attribute grays
10 11 12 |
# File 'lib/trmnl/api/models/palette.rb', line 10 def grays @grays end |
#label ⇒ Object
Returns the value of attribute label
10 11 12 |
# File 'lib/trmnl/api/models/palette.rb', line 10 def label @label end |
#name ⇒ Object
Returns the value of attribute name
10 11 12 |
# File 'lib/trmnl/api/models/palette.rb', line 10 def name @name end |
Class Method Details
.for(attributes) ⇒ Object
13 |
# File 'lib/trmnl/api/models/palette.rb', line 13 def self.for(attributes) = new(**attributes.transform_keys(name: :label, id: :name)) |