Class: MistApi::DeviceVersionItem
- Defined in:
- lib/mist_api/models/device_version_item.rb
Overview
DeviceVersionItem Model.
Instance Attribute Summary collapse
-
#model ⇒ String
Device model (as seen in the device stats).
-
#tag ⇒ String
Annotation, stable / beta / alpha.
-
#version ⇒ String
Firmware version.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(model = nil, version = nil, tag = SKIP) ⇒ DeviceVersionItem
constructor
A new instance of DeviceVersionItem.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
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
#model ⇒ String
Device model (as seen in the device stats)
14 15 16 |
# File 'lib/mist_api/models/device_version_item.rb', line 14 def model @model end |
#tag ⇒ String
Annotation, stable / beta / alpha. Or it can be empty or nothing which is likely a dev build
19 20 21 |
# File 'lib/mist_api/models/device_version_item.rb', line 19 def tag @tag end |
#version ⇒ String
Firmware version
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 |
.names ⇒ Object
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 |
.nullables ⇒ Object
An array for nullable fields
42 43 44 |
# File 'lib/mist_api/models/device_version_item.rb', line 42 def self.nullables [] end |
.optionals ⇒ Object
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
#inspect ⇒ Object
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_s ⇒ Object
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 |