Class: TRMNL::API::Models::Model
- Inherits:
-
Struct
- Object
- Struct
- TRMNL::API::Models::Model
- Defined in:
- lib/trmnl/api/models/model.rb
Overview
Models the data of the API response.
Instance Attribute Summary collapse
-
#bit_depth ⇒ Object
Returns the value of attribute bit_depth.
-
#colors ⇒ Object
Returns the value of attribute colors.
-
#css ⇒ Object
Returns the value of attribute css.
-
#description ⇒ Object
Returns the value of attribute description.
-
#height ⇒ Object
Returns the value of attribute height.
-
#kind ⇒ Object
Returns the value of attribute kind.
-
#label ⇒ Object
Returns the value of attribute label.
-
#mime_type ⇒ Object
Returns the value of attribute mime_type.
-
#name ⇒ Object
Returns the value of attribute name.
-
#offset_x ⇒ Object
Returns the value of attribute offset_x.
-
#offset_y ⇒ Object
Returns the value of attribute offset_y.
-
#palette_names ⇒ Object
Returns the value of attribute palette_names.
-
#rotation ⇒ Object
Returns the value of attribute rotation.
-
#scale_factor ⇒ Object
Returns the value of attribute scale_factor.
-
#width ⇒ Object
Returns the value of attribute width.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Model
constructor
A new instance of Model.
- #to_json ⇒ Object
Constructor Details
#initialize ⇒ Model
Returns a new instance of Model.
29 30 31 32 33 |
# File 'lib/trmnl/api/models/model.rb', line 29 def initialize(**) super apply_defaults freeze end |
Instance Attribute Details
#bit_depth ⇒ Object
Returns the value of attribute bit_depth
10 11 12 |
# File 'lib/trmnl/api/models/model.rb', line 10 def bit_depth @bit_depth end |
#colors ⇒ Object
Returns the value of attribute colors
10 11 12 |
# File 'lib/trmnl/api/models/model.rb', line 10 def colors @colors end |
#css ⇒ Object
Returns the value of attribute css
10 11 12 |
# File 'lib/trmnl/api/models/model.rb', line 10 def css @css end |
#description ⇒ Object
Returns the value of attribute description
10 11 12 |
# File 'lib/trmnl/api/models/model.rb', line 10 def description @description end |
#height ⇒ Object
Returns the value of attribute height
10 11 12 |
# File 'lib/trmnl/api/models/model.rb', line 10 def height @height end |
#kind ⇒ Object
Returns the value of attribute kind
10 11 12 |
# File 'lib/trmnl/api/models/model.rb', line 10 def kind @kind end |
#label ⇒ Object
Returns the value of attribute label
10 11 12 |
# File 'lib/trmnl/api/models/model.rb', line 10 def label @label end |
#mime_type ⇒ Object
Returns the value of attribute mime_type
10 11 12 |
# File 'lib/trmnl/api/models/model.rb', line 10 def mime_type @mime_type end |
#name ⇒ Object
Returns the value of attribute name
10 11 12 |
# File 'lib/trmnl/api/models/model.rb', line 10 def name @name end |
#offset_x ⇒ Object
Returns the value of attribute offset_x
10 11 12 |
# File 'lib/trmnl/api/models/model.rb', line 10 def offset_x @offset_x end |
#offset_y ⇒ Object
Returns the value of attribute offset_y
10 11 12 |
# File 'lib/trmnl/api/models/model.rb', line 10 def offset_y @offset_y end |
#palette_names ⇒ Object
Returns the value of attribute palette_names
10 11 12 |
# File 'lib/trmnl/api/models/model.rb', line 10 def palette_names @palette_names end |
#rotation ⇒ Object
Returns the value of attribute rotation
10 11 12 |
# File 'lib/trmnl/api/models/model.rb', line 10 def rotation @rotation end |
#scale_factor ⇒ Object
Returns the value of attribute scale_factor
10 11 12 |
# File 'lib/trmnl/api/models/model.rb', line 10 def scale_factor @scale_factor end |
#width ⇒ Object
Returns the value of attribute width
10 11 12 |
# File 'lib/trmnl/api/models/model.rb', line 10 def width @width end |
Class Method Details
.for(attributes) ⇒ Object
27 |
# File 'lib/trmnl/api/models/model.rb', line 27 def self.for(attributes) = new(**attributes.transform_keys(palette_ids: :palette_names)) |
Instance Method Details
#to_json ⇒ Object
35 |
# File 'lib/trmnl/api/models/model.rb', line 35 def to_json(*) = to_h.to_json(*) |