Class: MistApi::ConstAlarmDefinition

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

Overview

ConstAlarmDefinition 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(display = nil, fields = nil, group = nil, key = nil, severity = nil, example = SKIP, marvis_suggestion_category = SKIP) ⇒ ConstAlarmDefinition

Returns a new instance of ConstAlarmDefinition.



68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/mist_api/models/const_alarm_definition.rb', line 68

def initialize(display = nil, fields = nil, group = nil, key = nil,
               severity = nil, example = SKIP,
               marvis_suggestion_category = SKIP)
  @display = display
  @example = example unless example == SKIP
  @fields = fields
  @group = group
  @key = key
  unless marvis_suggestion_category == SKIP
    @marvis_suggestion_category =
      marvis_suggestion_category
  end
  @severity = severity
end

Instance Attribute Details

#displayString

Description of the alarm type

Returns:

  • (String)


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

def display
  @display
end

#exampleObject

Description of the alarm type

Returns:

  • (Object)


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

def example
  @example
end

#fieldsArray[String]

List of fields available in an alarm details payload (in REST APIs & Webhooks); e.g. ‘aps`, `switches`, `gateways`, `hostnames`, `ssids`, `bssids`

Returns:

  • (Array[String])


24
25
26
# File 'lib/mist_api/models/const_alarm_definition.rb', line 24

def fields
  @fields
end

#groupString

Group to which the alarm belongs

Returns:

  • (String)


28
29
30
# File 'lib/mist_api/models/const_alarm_definition.rb', line 28

def group
  @group
end

#keyString

Key name of the alarm type

Returns:

  • (String)


32
33
34
# File 'lib/mist_api/models/const_alarm_definition.rb', line 32

def key
  @key
end

#marvis_suggestion_categoryString

Marvis defined category to which the alarm belongs

Returns:

  • (String)


36
37
38
# File 'lib/mist_api/models/const_alarm_definition.rb', line 36

def marvis_suggestion_category
  @marvis_suggestion_category
end

#severityString

Severity of the alarm

Returns:

  • (String)


40
41
42
# File 'lib/mist_api/models/const_alarm_definition.rb', line 40

def severity
  @severity
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/mist_api/models/const_alarm_definition.rb', line 84

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  display = hash.key?('display') ? hash['display'] : nil
  fields = hash.key?('fields') ? hash['fields'] : nil
  group = hash.key?('group') ? hash['group'] : nil
  key = hash.key?('key') ? hash['key'] : nil
  severity = hash.key?('severity') ? hash['severity'] : nil
  example = hash.key?('example') ? hash['example'] : SKIP
  marvis_suggestion_category =
    hash.key?('marvis_suggestion_category') ? hash['marvis_suggestion_category'] : SKIP

  # Create object from extracted values.
  ConstAlarmDefinition.new(display,
                           fields,
                           group,
                           key,
                           severity,
                           example,
                           marvis_suggestion_category)
end

.namesObject

A mapping from model property names to API property names.



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/mist_api/models/const_alarm_definition.rb', line 43

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['display'] = 'display'
  @_hash['example'] = 'example'
  @_hash['fields'] = 'fields'
  @_hash['group'] = 'group'
  @_hash['key'] = 'key'
  @_hash['marvis_suggestion_category'] = 'marvis_suggestion_category'
  @_hash['severity'] = 'severity'
  @_hash
end

.nullablesObject

An array for nullable fields



64
65
66
# File 'lib/mist_api/models/const_alarm_definition.rb', line 64

def self.nullables
  []
end

.optionalsObject

An array for optional fields



56
57
58
59
60
61
# File 'lib/mist_api/models/const_alarm_definition.rb', line 56

def self.optionals
  %w[
    example
    marvis_suggestion_category
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} display: #{@display.inspect}, example: #{@example.inspect}, fields:"\
  " #{@fields.inspect}, group: #{@group.inspect}, key: #{@key.inspect},"\
  " marvis_suggestion_category: #{@marvis_suggestion_category.inspect}, severity:"\
  " #{@severity.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



108
109
110
111
112
113
# File 'lib/mist_api/models/const_alarm_definition.rb', line 108

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} display: #{@display}, example: #{@example}, fields: #{@fields}, group:"\
  " #{@group}, key: #{@key}, marvis_suggestion_category: #{@marvis_suggestion_category},"\
  " severity: #{@severity}>"
end