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.



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_depthObject

Returns the value of attribute bit_depth

Returns:

  • (Object)

    the current value of bit_depth



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

def bit_depth
  @bit_depth
end

#colorsObject

Returns the value of attribute colors

Returns:

  • (Object)

    the current value of colors



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

def colors
  @colors
end

#cssObject

Returns the value of attribute css

Returns:

  • (Object)

    the current value of css



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

def css
  @css
end

#descriptionObject

Returns the value of attribute description

Returns:

  • (Object)

    the current value of description



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

def description
  @description
end

#heightObject

Returns the value of attribute height

Returns:

  • (Object)

    the current value of height



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

def height
  @height
end

#kindObject

Returns the value of attribute kind

Returns:

  • (Object)

    the current value of kind



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

def kind
  @kind
end

#labelObject

Returns the value of attribute label

Returns:

  • (Object)

    the current value of label



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

def label
  @label
end

#mime_typeObject

Returns the value of attribute mime_type

Returns:

  • (Object)

    the current value of mime_type



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

def mime_type
  @mime_type
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



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

def name
  @name
end

#offset_xObject

Returns the value of attribute offset_x

Returns:

  • (Object)

    the current value of offset_x



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

def offset_x
  @offset_x
end

#offset_yObject

Returns the value of attribute offset_y

Returns:

  • (Object)

    the current value of offset_y



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

def offset_y
  @offset_y
end

#palette_namesObject

Returns the value of attribute palette_names

Returns:

  • (Object)

    the current value of palette_names



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

def palette_names
  @palette_names
end

#rotationObject

Returns the value of attribute rotation

Returns:

  • (Object)

    the current value of rotation



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

def rotation
  @rotation
end

#scale_factorObject

Returns the value of attribute scale_factor

Returns:

  • (Object)

    the current value of scale_factor



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

def scale_factor
  @scale_factor
end

#widthObject

Returns the value of attribute width

Returns:

  • (Object)

    the current value of 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_jsonObject



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

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