Class: MistApi::DeviceVersionItem

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/mist_api/models/device_version_item.rb

Overview

DeviceVersionItem Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(model = nil, version = nil, tag = SKIP) ⇒ DeviceVersionItem

Returns a new instance of DeviceVersionItem.



46
47
48
49
50
# File 'lib/mist_api/models/device_version_item.rb', line 46

def initialize(model = nil, version = nil, tag = SKIP)
  @model = model
  @tag = tag unless tag == SKIP
  @version = version
end

Instance Attribute Details

#modelString

Device model (as seen in the device stats)

Returns:

  • (String)


14
15
16
# File 'lib/mist_api/models/device_version_item.rb', line 14

def model
  @model
end

#tagString

Annotation, stable / beta / alpha. Or it can be empty or nothing which is likely a dev build

Returns:

  • (String)


19
20
21
# File 'lib/mist_api/models/device_version_item.rb', line 19

def tag
  @tag
end

#versionString

Firmware version

Returns:

  • (String)


23
24
25
# File 'lib/mist_api/models/device_version_item.rb', line 23

def version
  @version
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/mist_api/models/device_version_item.rb', line 53

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  model = hash.key?('model') ? hash['model'] : nil
  version = hash.key?('version') ? hash['version'] : nil
  tag = hash.key?('tag') ? hash['tag'] : SKIP

  # Create object from extracted values.
  DeviceVersionItem.new(model,
                        version,
                        tag)
end

.namesObject

A mapping from model property names to API property names.



26
27
28
29
30
31
32
# File 'lib/mist_api/models/device_version_item.rb', line 26

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['model'] = 'model'
  @_hash['tag'] = 'tag'
  @_hash['version'] = 'version'
  @_hash
end

.nullablesObject

An array for nullable fields



42
43
44
# File 'lib/mist_api/models/device_version_item.rb', line 42

def self.nullables
  []
end

.optionalsObject

An array for optional fields



35
36
37
38
39
# File 'lib/mist_api/models/device_version_item.rb', line 35

def self.optionals
  %w[
    tag
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



74
75
76
77
78
# File 'lib/mist_api/models/device_version_item.rb', line 74

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} model: #{@model.inspect}, tag: #{@tag.inspect}, version:"\
  " #{@version.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



68
69
70
71
# File 'lib/mist_api/models/device_version_item.rb', line 68

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} model: #{@model}, tag: #{@tag}, version: #{@version}>"
end