Class: MistApi::CoaServer

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

Overview

CoA Server

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(ip = nil, secret = nil, disable_event_timestamp_check = false, enabled = false, port = SKIP) ⇒ CoaServer

Returns a new instance of CoaServer.



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

def initialize(ip = nil, secret = nil,
               disable_event_timestamp_check = false, enabled = false,
               port = SKIP)
  unless disable_event_timestamp_check == SKIP
    @disable_event_timestamp_check =
      disable_event_timestamp_check
  end
  @enabled = enabled unless enabled == SKIP
  @ip = ip
  @port = port unless port == SKIP
  @secret = secret
end

Instance Attribute Details

#disable_event_timestamp_checkTrueClass | FalseClass

Whether to disable Event-Timestamp Check

Returns:

  • (TrueClass | FalseClass)


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

def disable_event_timestamp_check
  @disable_event_timestamp_check
end

#enabledTrueClass | FalseClass

Whether to disable Event-Timestamp Check

Returns:

  • (TrueClass | FalseClass)


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

def enabled
  @enabled
end

#ipString

Whether to disable Event-Timestamp Check

Returns:

  • (String)


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

def ip
  @ip
end

#portObject

Radius CoA Port, value from 1 to 65535, default is 3799

Returns:

  • (Object)


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

def port
  @port
end

#secretString

Radius CoA Port, value from 1 to 65535, default is 3799

Returns:

  • (String)


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

def secret
  @secret
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/mist_api/models/coa_server.rb', line 72

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  ip = hash.key?('ip') ? hash['ip'] : nil
  secret = hash.key?('secret') ? hash['secret'] : nil
  disable_event_timestamp_check =
    hash['disable_event_timestamp_check'] ||= false
  enabled = hash['enabled'] ||= false
  port = hash.key?('port') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:RadiusCoaPort), hash['port']
  ) : SKIP

  # Create object from extracted values.
  CoaServer.new(ip,
                secret,
                disable_event_timestamp_check,
                enabled,
                port)
end

.namesObject

A mapping from model property names to API property names.



33
34
35
36
37
38
39
40
41
42
# File 'lib/mist_api/models/coa_server.rb', line 33

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['disable_event_timestamp_check'] =
    'disable_event_timestamp_check'
  @_hash['enabled'] = 'enabled'
  @_hash['ip'] = 'ip'
  @_hash['port'] = 'port'
  @_hash['secret'] = 'secret'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



45
46
47
48
49
50
51
# File 'lib/mist_api/models/coa_server.rb', line 45

def self.optionals
  %w[
    disable_event_timestamp_check
    enabled
    port
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:

  • The (CoaServer | Hash)

    value against the validation is performed.



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/mist_api/models/coa_server.rb', line 95

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.ip,
                            ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.secret,
                              ->(val) { val.instance_of? String })
    )
  end

  return false unless value.instance_of? Hash

  (
    APIHelper.valid_type?(value['ip'],
                          ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['secret'],
                            ->(val) { val.instance_of? String })
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



123
124
125
126
127
128
# File 'lib/mist_api/models/coa_server.rb', line 123

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} disable_event_timestamp_check: #{@disable_event_timestamp_check.inspect},"\
  " enabled: #{@enabled.inspect}, ip: #{@ip.inspect}, port: #{@port.inspect}, secret:"\
  " #{@secret.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



116
117
118
119
120
# File 'lib/mist_api/models/coa_server.rb', line 116

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} disable_event_timestamp_check: #{@disable_event_timestamp_check}, enabled:"\
  " #{@enabled}, ip: #{@ip}, port: #{@port}, secret: #{@secret}>"
end