Class: MistApi::Anomaly

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

Overview

Anomaly

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(events = nil, sle_baseline = nil, sle_deviation = nil, timestamp = nil, since = SKIP) ⇒ Anomaly

Returns a new instance of Anomaly.



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

def initialize(events = nil, sle_baseline = nil, sle_deviation = nil,
               timestamp = nil, since = SKIP)
  @events = events
  @since = since unless since == SKIP
  @sle_baseline = sle_baseline
  @sle_deviation = sle_deviation
  @timestamp = timestamp
end

Instance Attribute Details

#eventsArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


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

def events
  @events
end

#sinceFloat

TODO: Write general description for this method

Returns:

  • (Float)


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

def since
  @since
end

#sle_baselineFloat

TODO: Write general description for this method

Returns:

  • (Float)


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

def sle_baseline
  @sle_baseline
end

#sle_deviationFloat

TODO: Write general description for this method

Returns:

  • (Float)


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

def sle_deviation
  @sle_deviation
end

#timestampFloat

Epoch (seconds)

Returns:

  • (Float)


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

def timestamp
  @timestamp
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  events = hash.key?('events') ? hash['events'] : nil
  sle_baseline = hash.key?('sle_baseline') ? hash['sle_baseline'] : nil
  sle_deviation = hash.key?('sle_deviation') ? hash['sle_deviation'] : nil
  timestamp = hash.key?('timestamp') ? hash['timestamp'] : nil
  since = hash.key?('since') ? hash['since'] : SKIP

  # Create object from extracted values.
  Anomaly.new(events,
              sle_baseline,
              sle_deviation,
              timestamp,
              since)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['events'] = 'events'
  @_hash['since'] = 'since'
  @_hash['sle_baseline'] = 'sle_baseline'
  @_hash['sle_deviation'] = 'sle_deviation'
  @_hash['timestamp'] = 'timestamp'
  @_hash
end

.nullablesObject

An array for nullable fields



51
52
53
# File 'lib/mist_api/models/anomaly.rb', line 51

def self.nullables
  []
end

.optionalsObject

An array for optional fields



44
45
46
47
48
# File 'lib/mist_api/models/anomaly.rb', line 44

def self.optionals
  %w[
    since
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} events: #{@events.inspect}, since: #{@since.inspect}, sle_baseline:"\
  " #{@sle_baseline.inspect}, sle_deviation: #{@sle_deviation.inspect}, timestamp:"\
  " #{@timestamp.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



84
85
86
87
88
# File 'lib/mist_api/models/anomaly.rb', line 84

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} events: #{@events}, since: #{@since}, sle_baseline: #{@sle_baseline},"\
  " sle_deviation: #{@sle_deviation}, timestamp: #{@timestamp}>"
end