Class: TRMNL::API::Models::Firmware::Flash

Inherits:
Data
  • Object
show all
Defined in:
lib/trmnl/api/models/firmware/flash.rb

Overview

Models the data of the API response.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name: nil, label: nil, chip_family: nil, versions: Core::EMPTY_ARRAY) ⇒ Flash

Returns a new instance of Flash.



16
17
18
# File 'lib/trmnl/api/models/firmware/flash.rb', line 16

def initialize name: nil, label: nil, chip_family: nil, versions: Core::EMPTY_ARRAY
  super
end

Instance Attribute Details

#chip_familyObject (readonly)

Returns the value of attribute chip_family

Returns:

  • (Object)

    the current value of chip_family



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

def chip_family
  @chip_family
end

#labelObject (readonly)

Returns the value of attribute label

Returns:

  • (Object)

    the current value of label



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

def label
  @label
end

#nameObject (readonly)

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



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

def name
  @name
end

#versionsObject (readonly)

Returns the value of attribute versions

Returns:

  • (Object)

    the current value of versions



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

def versions
  @versions
end

Class Method Details

.for(**attributes) ⇒ Object



11
12
13
14
# File 'lib/trmnl/api/models/firmware/flash.rb', line 11

def self.for **attributes
  versions = Array(attributes.delete(:versions)).map { Version.for(**it) }
  new(**attributes.transform_keys!(keyname: :name, chipFamily: :chip_family), versions:)
end