Class: MistApi::JseDevice
- Defined in:
- lib/mist_api/models/jse_device.rb
Overview
JseDevice Model.
Instance Attribute Summary collapse
-
#ext_ip ⇒ String
When available.
-
#last_seen ⇒ Float
Last seen timestamp.
-
#mac ⇒ String
Last seen timestamp.
-
#model ⇒ String
Last seen timestamp.
-
#serial ⇒ String
Last seen timestamp.
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(ext_ip = SKIP, last_seen = SKIP, mac = SKIP, model = SKIP, serial = SKIP) ⇒ JseDevice
constructor
A new instance of JseDevice.
-
#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(ext_ip = SKIP, last_seen = SKIP, mac = SKIP, model = SKIP, serial = SKIP) ⇒ JseDevice
Returns a new instance of JseDevice.
61 62 63 64 65 66 67 68 |
# File 'lib/mist_api/models/jse_device.rb', line 61 def initialize(ext_ip = SKIP, last_seen = SKIP, mac = SKIP, model = SKIP, serial = SKIP) @ext_ip = ext_ip unless ext_ip == SKIP @last_seen = last_seen unless last_seen == SKIP @mac = mac unless mac == SKIP @model = model unless model == SKIP @serial = serial unless serial == SKIP end |
Instance Attribute Details
#ext_ip ⇒ String
When available
14 15 16 |
# File 'lib/mist_api/models/jse_device.rb', line 14 def ext_ip @ext_ip end |
#last_seen ⇒ Float
Last seen timestamp
18 19 20 |
# File 'lib/mist_api/models/jse_device.rb', line 18 def last_seen @last_seen end |
#mac ⇒ String
Last seen timestamp
22 23 24 |
# File 'lib/mist_api/models/jse_device.rb', line 22 def mac @mac end |
#model ⇒ String
Last seen timestamp
26 27 28 |
# File 'lib/mist_api/models/jse_device.rb', line 26 def model @model end |
#serial ⇒ String
Last seen timestamp
30 31 32 |
# File 'lib/mist_api/models/jse_device.rb', line 30 def serial @serial end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/mist_api/models/jse_device.rb', line 71 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. ext_ip = hash.key?('ext_ip') ? hash['ext_ip'] : SKIP last_seen = hash.key?('last_seen') ? hash['last_seen'] : SKIP mac = hash.key?('mac') ? hash['mac'] : SKIP model = hash.key?('model') ? hash['model'] : SKIP serial = hash.key?('serial') ? hash['serial'] : SKIP # Create object from extracted values. JseDevice.new(ext_ip, last_seen, mac, model, serial) end |
.names ⇒ Object
A mapping from model property names to API property names.
33 34 35 36 37 38 39 40 41 |
# File 'lib/mist_api/models/jse_device.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['ext_ip'] = 'ext_ip' @_hash['last_seen'] = 'last_seen' @_hash['mac'] = 'mac' @_hash['model'] = 'model' @_hash['serial'] = 'serial' @_hash end |
.nullables ⇒ Object
An array for nullable fields
55 56 57 58 59 |
# File 'lib/mist_api/models/jse_device.rb', line 55 def self.nullables %w[ last_seen ] end |
.optionals ⇒ Object
An array for optional fields
44 45 46 47 48 49 50 51 52 |
# File 'lib/mist_api/models/jse_device.rb', line 44 def self.optionals %w[ ext_ip last_seen mac model serial ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
97 98 99 100 101 |
# File 'lib/mist_api/models/jse_device.rb', line 97 def inspect class_name = self.class.name.split('::').last "<#{class_name} ext_ip: #{@ext_ip.inspect}, last_seen: #{@last_seen.inspect}, mac:"\ " #{@mac.inspect}, model: #{@model.inspect}, serial: #{@serial.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
90 91 92 93 94 |
# File 'lib/mist_api/models/jse_device.rb', line 90 def to_s class_name = self.class.name.split('::').last "<#{class_name} ext_ip: #{@ext_ip}, last_seen: #{@last_seen}, mac: #{@mac}, model:"\ " #{@model}, serial: #{@serial}>" end |