Class: MistApi::StatsWiredClient

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

Overview

StatsWiredClient 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(mac = nil, auth_state = SKIP, device_id = SKIP, eth_port = SKIP, last_seen = SKIP, rx_bytes = SKIP, rx_pkts = SKIP, site_id = SKIP, tx_bytes = SKIP, tx_pkts = SKIP, uptime = SKIP, vlan_id = SKIP, additional_properties = nil) ⇒ StatsWiredClient

Returns a new instance of StatsWiredClient.



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/mist_api/models/stats_wired_client.rb', line 105

def initialize(mac = nil, auth_state = SKIP, device_id = SKIP,
               eth_port = SKIP, last_seen = SKIP, rx_bytes = SKIP,
               rx_pkts = SKIP, site_id = SKIP, tx_bytes = SKIP,
               tx_pkts = SKIP, uptime = SKIP, vlan_id = SKIP,
               additional_properties = nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @auth_state = auth_state unless auth_state == SKIP
  @device_id = device_id unless device_id == SKIP
  @eth_port = eth_port unless eth_port == SKIP
  @last_seen = last_seen unless last_seen == SKIP
  @mac = mac
  @rx_bytes = rx_bytes unless rx_bytes == SKIP
  @rx_pkts = rx_pkts unless rx_pkts == SKIP
  @site_id = site_id unless site_id == SKIP
  @tx_bytes = tx_bytes unless tx_bytes == SKIP
  @tx_pkts = tx_pkts unless tx_pkts == SKIP
  @uptime = uptime unless uptime == SKIP
  @vlan_id = vlan_id unless vlan_id == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#auth_stateString

Client authorization status

Returns:

  • (String)


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

def auth_state
  @auth_state
end

#device_idString

Device ID the client is connected to

Returns:

  • (String)


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

def device_id
  @device_id
end

#eth_portString

Port on AP where the wired client is connected

Returns:

  • (String)


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

def eth_port
  @eth_port
end

#last_seenFloat

Time when last Tx/Rx observed

Returns:

  • (Float)


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

def last_seen
  @last_seen
end

#macString

Client mac

Returns:

  • (String)


30
31
32
# File 'lib/mist_api/models/stats_wired_client.rb', line 30

def mac
  @mac
end

#rx_bytesInteger

Amount of traffic received since connection

Returns:

  • (Integer)


34
35
36
# File 'lib/mist_api/models/stats_wired_client.rb', line 34

def rx_bytes
  @rx_bytes
end

#rx_pktsInteger

Amount of packets received since connection

Returns:

  • (Integer)


38
39
40
# File 'lib/mist_api/models/stats_wired_client.rb', line 38

def rx_pkts
  @rx_pkts
end

#site_idUUID | String

Amount of packets received since connection

Returns:

  • (UUID | String)


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

def site_id
  @site_id
end

#tx_bytesInteger

Amount of traffic sent since connection

Returns:

  • (Integer)


46
47
48
# File 'lib/mist_api/models/stats_wired_client.rb', line 46

def tx_bytes
  @tx_bytes
end

#tx_pktsInteger

Amount of packets sent since connection

Returns:

  • (Integer)


50
51
52
# File 'lib/mist_api/models/stats_wired_client.rb', line 50

def tx_pkts
  @tx_pkts
end

#uptimeFloat

How long, in seconds, has the client been connected

Returns:

  • (Float)


54
55
56
# File 'lib/mist_api/models/stats_wired_client.rb', line 54

def uptime
  @uptime
end

#vlan_idFloat

VLAN id, could be empty

Returns:

  • (Float)


58
59
60
# File 'lib/mist_api/models/stats_wired_client.rb', line 58

def vlan_id
  @vlan_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# File 'lib/mist_api/models/stats_wired_client.rb', line 129

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  mac = hash.key?('mac') ? hash['mac'] : nil
  auth_state = hash.key?('auth_state') ? hash['auth_state'] : SKIP
  device_id = hash.key?('device_id') ? hash['device_id'] : SKIP
  eth_port = hash.key?('eth_port') ? hash['eth_port'] : SKIP
  last_seen = hash.key?('last_seen') ? hash['last_seen'] : SKIP
  rx_bytes = hash.key?('rx_bytes') ? hash['rx_bytes'] : SKIP
  rx_pkts = hash.key?('rx_pkts') ? hash['rx_pkts'] : SKIP
  site_id = hash.key?('site_id') ? hash['site_id'] : SKIP
  tx_bytes = hash.key?('tx_bytes') ? hash['tx_bytes'] : SKIP
  tx_pkts = hash.key?('tx_pkts') ? hash['tx_pkts'] : SKIP
  uptime = hash.key?('uptime') ? hash['uptime'] : SKIP
  vlan_id = hash.key?('vlan_id') ? hash['vlan_id'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  StatsWiredClient.new(mac,
                       auth_state,
                       device_id,
                       eth_port,
                       last_seen,
                       rx_bytes,
                       rx_pkts,
                       site_id,
                       tx_bytes,
                       tx_pkts,
                       uptime,
                       vlan_id,
                       additional_properties)
end

.namesObject

A mapping from model property names to API property names.



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/mist_api/models/stats_wired_client.rb', line 61

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['auth_state'] = 'auth_state'
  @_hash['device_id'] = 'device_id'
  @_hash['eth_port'] = 'eth_port'
  @_hash['last_seen'] = 'last_seen'
  @_hash['mac'] = 'mac'
  @_hash['rx_bytes'] = 'rx_bytes'
  @_hash['rx_pkts'] = 'rx_pkts'
  @_hash['site_id'] = 'site_id'
  @_hash['tx_bytes'] = 'tx_bytes'
  @_hash['tx_pkts'] = 'tx_pkts'
  @_hash['uptime'] = 'uptime'
  @_hash['vlan_id'] = 'vlan_id'
  @_hash
end

.nullablesObject

An array for nullable fields



96
97
98
99
100
101
102
103
# File 'lib/mist_api/models/stats_wired_client.rb', line 96

def self.nullables
  %w[
    rx_bytes
    rx_pkts
    tx_bytes
    tx_pkts
  ]
end

.optionalsObject

An array for optional fields



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/mist_api/models/stats_wired_client.rb', line 79

def self.optionals
  %w[
    auth_state
    device_id
    eth_port
    last_seen
    rx_bytes
    rx_pkts
    site_id
    tx_bytes
    tx_pkts
    uptime
    vlan_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



179
180
181
182
183
184
185
186
187
# File 'lib/mist_api/models/stats_wired_client.rb', line 179

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} auth_state: #{@auth_state.inspect}, device_id: #{@device_id.inspect},"\
  " eth_port: #{@eth_port.inspect}, last_seen: #{@last_seen.inspect}, mac: #{@mac.inspect},"\
  " rx_bytes: #{@rx_bytes.inspect}, rx_pkts: #{@rx_pkts.inspect}, site_id:"\
  " #{@site_id.inspect}, tx_bytes: #{@tx_bytes.inspect}, tx_pkts: #{@tx_pkts.inspect}, uptime:"\
  " #{@uptime.inspect}, vlan_id: #{@vlan_id.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



170
171
172
173
174
175
176
# File 'lib/mist_api/models/stats_wired_client.rb', line 170

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} auth_state: #{@auth_state}, device_id: #{@device_id}, eth_port:"\
  " #{@eth_port}, last_seen: #{@last_seen}, mac: #{@mac}, rx_bytes: #{@rx_bytes}, rx_pkts:"\
  " #{@rx_pkts}, site_id: #{@site_id}, tx_bytes: #{@tx_bytes}, tx_pkts: #{@tx_pkts}, uptime:"\
  " #{@uptime}, vlan_id: #{@vlan_id}, additional_properties: #{@additional_properties}>"
end