Class: MistApi::StatsApL2tpStat

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

Overview

StatsApL2tpStat 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(sessions = SKIP, state = SKIP, uptime = SKIP, wxtunnel_id = SKIP) ⇒ StatsApL2tpStat

Returns a new instance of StatsApL2tpStat.



57
58
59
60
61
62
63
# File 'lib/mist_api/models/stats_ap_l2tp_stat.rb', line 57

def initialize(sessions = SKIP, state = SKIP, uptime = SKIP,
               wxtunnel_id = SKIP)
  @sessions = sessions unless sessions == SKIP
  @state = state unless state == SKIP
  @uptime = uptime unless uptime == SKIP
  @wxtunnel_id = wxtunnel_id unless wxtunnel_id == SKIP
end

Instance Attribute Details

#sessionsArray[StatsApL2tpStatSession]

List of sessions

Returns:



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

def sessions
  @sessions
end

#stateL2tpStateEnum

enum: ‘established`, `established_with_session`, `idle`, `wait-ctrl-conn`, `wait-ctrl-reply`

Returns:



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

def state
  @state
end

#uptimeInteger

Uptime

Returns:

  • (Integer)


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

def uptime
  @uptime
end

#wxtunnel_idUUID | String

WxlanTunnel ID

Returns:

  • (UUID | String)


27
28
29
# File 'lib/mist_api/models/stats_ap_l2tp_stat.rb', line 27

def wxtunnel_id
  @wxtunnel_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/mist_api/models/stats_ap_l2tp_stat.rb', line 66

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  # Parameter is an array, so we need to iterate through it
  sessions = nil
  unless hash['sessions'].nil?
    sessions = []
    hash['sessions'].each do |structure|
      sessions << (StatsApL2tpStatSession.from_hash(structure) if structure)
    end
  end

  sessions = SKIP unless hash.key?('sessions')
  state = hash.key?('state') ? hash['state'] : SKIP
  uptime = hash.key?('uptime') ? hash['uptime'] : SKIP
  wxtunnel_id = hash.key?('wxtunnel_id') ? hash['wxtunnel_id'] : SKIP

  # Create object from extracted values.
  StatsApL2tpStat.new(sessions,
                      state,
                      uptime,
                      wxtunnel_id)
end

.namesObject

A mapping from model property names to API property names.



30
31
32
33
34
35
36
37
# File 'lib/mist_api/models/stats_ap_l2tp_stat.rb', line 30

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['sessions'] = 'sessions'
  @_hash['state'] = 'state'
  @_hash['uptime'] = 'uptime'
  @_hash['wxtunnel_id'] = 'wxtunnel_id'
  @_hash
end

.nullablesObject

An array for nullable fields



50
51
52
53
54
55
# File 'lib/mist_api/models/stats_ap_l2tp_stat.rb', line 50

def self.nullables
  %w[
    uptime
    wxtunnel_id
  ]
end

.optionalsObject

An array for optional fields



40
41
42
43
44
45
46
47
# File 'lib/mist_api/models/stats_ap_l2tp_stat.rb', line 40

def self.optionals
  %w[
    sessions
    state
    uptime
    wxtunnel_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



99
100
101
102
103
# File 'lib/mist_api/models/stats_ap_l2tp_stat.rb', line 99

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} sessions: #{@sessions.inspect}, state: #{@state.inspect}, uptime:"\
  " #{@uptime.inspect}, wxtunnel_id: #{@wxtunnel_id.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



92
93
94
95
96
# File 'lib/mist_api/models/stats_ap_l2tp_stat.rb', line 92

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} sessions: #{@sessions}, state: #{@state}, uptime: #{@uptime}, wxtunnel_id:"\
  " #{@wxtunnel_id}>"
end