Class: MistApi::JseDevice

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

Overview

JseDevice 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(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_ipString

When available

Returns:

  • (String)


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

def ext_ip
  @ext_ip
end

#last_seenFloat

Last seen timestamp

Returns:

  • (Float)


18
19
20
# File 'lib/mist_api/models/jse_device.rb', line 18

def last_seen
  @last_seen
end

#macString

Last seen timestamp

Returns:

  • (String)


22
23
24
# File 'lib/mist_api/models/jse_device.rb', line 22

def mac
  @mac
end

#modelString

Last seen timestamp

Returns:

  • (String)


26
27
28
# File 'lib/mist_api/models/jse_device.rb', line 26

def model
  @model
end

#serialString

Last seen timestamp

Returns:

  • (String)


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

.namesObject

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

.nullablesObject

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

.optionalsObject

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

#inspectObject

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_sObject

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