Class: TRMNL::API::Models::Model

Inherits:
Struct
  • Object
show all
Defined in:
lib/trmnl/api/models/model.rb

Overview

Models the data of the API response.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeModel

Returns a new instance of Model.



28
29
30
31
32
# File 'lib/trmnl/api/models/model.rb', line 28

def initialize(**)
  super
  apply_defaults
  freeze
end

Instance Attribute Details

#bit_depthObject

Returns the value of attribute bit_depth

Returns:

  • (Object)

    the current value of bit_depth



9
10
11
# File 'lib/trmnl/api/models/model.rb', line 9

def bit_depth
  @bit_depth
end

#colorsObject

Returns the value of attribute colors

Returns:

  • (Object)

    the current value of colors



9
10
11
# File 'lib/trmnl/api/models/model.rb', line 9

def colors
  @colors
end

#cssObject

Returns the value of attribute css

Returns:

  • (Object)

    the current value of css



9
10
11
# File 'lib/trmnl/api/models/model.rb', line 9

def css
  @css
end

#descriptionObject

Returns the value of attribute description

Returns:

  • (Object)

    the current value of description



9
10
11
# File 'lib/trmnl/api/models/model.rb', line 9

def description
  @description
end

#heightObject

Returns the value of attribute height

Returns:

  • (Object)

    the current value of height



9
10
11
# File 'lib/trmnl/api/models/model.rb', line 9

def height
  @height
end

#kindObject

Returns the value of attribute kind

Returns:

  • (Object)

    the current value of kind



9
10
11
# File 'lib/trmnl/api/models/model.rb', line 9

def kind
  @kind
end

#labelObject

Returns the value of attribute label

Returns:

  • (Object)

    the current value of label



9
10
11
# File 'lib/trmnl/api/models/model.rb', line 9

def label
  @label
end

#mime_typeObject

Returns the value of attribute mime_type

Returns:

  • (Object)

    the current value of mime_type



9
10
11
# File 'lib/trmnl/api/models/model.rb', line 9

def mime_type
  @mime_type
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



9
10
11
# File 'lib/trmnl/api/models/model.rb', line 9

def name
  @name
end

#offset_xObject

Returns the value of attribute offset_x

Returns:

  • (Object)

    the current value of offset_x



9
10
11
# File 'lib/trmnl/api/models/model.rb', line 9

def offset_x
  @offset_x
end

#offset_yObject

Returns the value of attribute offset_y

Returns:

  • (Object)

    the current value of offset_y



9
10
11
# File 'lib/trmnl/api/models/model.rb', line 9

def offset_y
  @offset_y
end

#palette_namesObject

Returns the value of attribute palette_names

Returns:

  • (Object)

    the current value of palette_names



9
10
11
# File 'lib/trmnl/api/models/model.rb', line 9

def palette_names
  @palette_names
end

#rotationObject

Returns the value of attribute rotation

Returns:

  • (Object)

    the current value of rotation



9
10
11
# File 'lib/trmnl/api/models/model.rb', line 9

def rotation
  @rotation
end

#scale_factorObject

Returns the value of attribute scale_factor

Returns:

  • (Object)

    the current value of scale_factor



9
10
11
# File 'lib/trmnl/api/models/model.rb', line 9

def scale_factor
  @scale_factor
end

#widthObject

Returns the value of attribute width

Returns:

  • (Object)

    the current value of width



9
10
11
# File 'lib/trmnl/api/models/model.rb', line 9

def width
  @width
end

Class Method Details

.for(attributes) ⇒ Object



26
# File 'lib/trmnl/api/models/model.rb', line 26

def self.for(attributes) = new(**attributes.transform_keys!(palette_ids: :palette_names))

Instance Method Details

#to_jsonObject



34
# File 'lib/trmnl/api/models/model.rb', line 34

def to_json(*) = to_h.to_json(*)