Class: MistApi::StatsMxtunnelSession

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

Overview

StatsMxtunnelSession 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(local_sid = nil, remote_id = nil, remote_sid = nil, state = nil) ⇒ StatsMxtunnelSession

Returns a new instance of StatsMxtunnelSession.



48
49
50
51
52
53
54
# File 'lib/mist_api/models/stats_mxtunnel_session.rb', line 48

def initialize(local_sid = nil, remote_id = nil, remote_sid = nil,
               state = nil)
  @local_sid = local_sid
  @remote_id = remote_id
  @remote_sid = remote_sid
  @state = state
end

Instance Attribute Details

#local_sidInteger

Remote sessions id (dynamically unless Tunnel is said to be static)

Returns:

  • (Integer)


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

def local_sid
  @local_sid
end

#remote_idString

WxlanTunnel Remote ID

Returns:

  • (String)


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

def remote_id
  @remote_id
end

#remote_sidInteger

Remote sessions id (dynamically unless Tunnel is said to be static)

Returns:

  • (Integer)


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

def remote_sid
  @remote_sid
end

#stateString

Remote sessions id (dynamically unless Tunnel is said to be static)

Returns:

  • (String)


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

def state
  @state
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/mist_api/models/stats_mxtunnel_session.rb', line 57

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  local_sid = hash.key?('local_sid') ? hash['local_sid'] : nil
  remote_id = hash.key?('remote_id') ? hash['remote_id'] : nil
  remote_sid = hash.key?('remote_sid') ? hash['remote_sid'] : nil
  state = hash.key?('state') ? hash['state'] : nil

  # Create object from extracted values.
  StatsMxtunnelSession.new(local_sid,
                           remote_id,
                           remote_sid,
                           state)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['local_sid'] = 'local_sid'
  @_hash['remote_id'] = 'remote_id'
  @_hash['remote_sid'] = 'remote_sid'
  @_hash['state'] = 'state'
  @_hash
end

.nullablesObject

An array for nullable fields



44
45
46
# File 'lib/mist_api/models/stats_mxtunnel_session.rb', line 44

def self.nullables
  []
end

.optionalsObject

An array for optional fields



39
40
41
# File 'lib/mist_api/models/stats_mxtunnel_session.rb', line 39

def self.optionals
  []
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/mist_api/models/stats_mxtunnel_session.rb', line 75

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.local_sid,
                            ->(val) { val.instance_of? Integer }) and
        APIHelper.valid_type?(value.remote_id,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.remote_sid,
                              ->(val) { val.instance_of? Integer }) and
        APIHelper.valid_type?(value.state,
                              ->(val) { val.instance_of? String })
    )
  end

  return false unless value.instance_of? Hash

  (
    APIHelper.valid_type?(value['local_sid'],
                          ->(val) { val.instance_of? Integer }) and
      APIHelper.valid_type?(value['remote_id'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['remote_sid'],
                            ->(val) { val.instance_of? Integer }) and
      APIHelper.valid_type?(value['state'],
                            ->(val) { val.instance_of? String })
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



111
112
113
114
115
# File 'lib/mist_api/models/stats_mxtunnel_session.rb', line 111

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

#to_sObject

Provides a human-readable string representation of the object.



104
105
106
107
108
# File 'lib/mist_api/models/stats_mxtunnel_session.rb', line 104

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