Class: Verizon::DtoQueryMetricsResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/verizon/models/dto_query_metrics_response.rb

Overview

DtoQueryMetricsResponse 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(critical: SKIP, major: SKIP, minor: SKIP, noalert: SKIP, total: SKIP, deltacritical: SKIP, deltamajor: SKIP, deltaminor: SKIP, deltanoalert: SKIP) ⇒ DtoQueryMetricsResponse

Returns a new instance of DtoQueryMetricsResponse.



85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/verizon/models/dto_query_metrics_response.rb', line 85

def initialize(critical: SKIP, major: SKIP, minor: SKIP, noalert: SKIP,
               total: SKIP, deltacritical: SKIP, deltamajor: SKIP,
               deltaminor: SKIP, deltanoalert: SKIP)
  @critical = critical unless critical == SKIP
  @major = major unless major == SKIP
  @minor = minor unless minor == SKIP
  @noalert = noalert unless noalert == SKIP
  @total = total unless total == SKIP
  @deltacritical = deltacritical unless deltacritical == SKIP
  @deltamajor = deltamajor unless deltamajor == SKIP
  @deltaminor = deltaminor unless deltaminor == SKIP
  @deltanoalert = deltanoalert unless deltanoalert == SKIP
end

Instance Attribute Details

#criticalInteger

The number of critical alerts in the queried time period

Returns:

  • (Integer)


14
15
16
# File 'lib/verizon/models/dto_query_metrics_response.rb', line 14

def critical
  @critical
end

#deltacriticalInteger

The change in the number of critical alerts in the queried time period

Returns:

  • (Integer)


35
36
37
# File 'lib/verizon/models/dto_query_metrics_response.rb', line 35

def deltacritical
  @deltacritical
end

#deltamajorInteger

The change in the number of major alerts in the queried time period

Returns:

  • (Integer)


39
40
41
# File 'lib/verizon/models/dto_query_metrics_response.rb', line 39

def deltamajor
  @deltamajor
end

#deltaminorInteger

The change in the number of minor alerts in the queried time period

Returns:

  • (Integer)


43
44
45
# File 'lib/verizon/models/dto_query_metrics_response.rb', line 43

def deltaminor
  @deltaminor
end

#deltanoalertInteger

The change in the number of sensor reports containing no alerts in the queried time period

Returns:

  • (Integer)


48
49
50
# File 'lib/verizon/models/dto_query_metrics_response.rb', line 48

def deltanoalert
  @deltanoalert
end

#majorInteger

The number of major alerts in the queried time period

Returns:

  • (Integer)


18
19
20
# File 'lib/verizon/models/dto_query_metrics_response.rb', line 18

def major
  @major
end

#minorInteger

The number of minor alerts in the queried time period

Returns:

  • (Integer)


22
23
24
# File 'lib/verizon/models/dto_query_metrics_response.rb', line 22

def minor
  @minor
end

#noalertInteger

The number of sensor reports containing no alerts in the queried time period

Returns:

  • (Integer)


27
28
29
# File 'lib/verizon/models/dto_query_metrics_response.rb', line 27

def noalert
  @noalert
end

#totalInteger

The total number of alerts in the queried time period

Returns:

  • (Integer)


31
32
33
# File 'lib/verizon/models/dto_query_metrics_response.rb', line 31

def total
  @total
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/verizon/models/dto_query_metrics_response.rb', line 100

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  critical = hash.key?('critical') ? hash['critical'] : SKIP
  major = hash.key?('major') ? hash['major'] : SKIP
  minor = hash.key?('minor') ? hash['minor'] : SKIP
  noalert = hash.key?('noalert') ? hash['noalert'] : SKIP
  total = hash.key?('total') ? hash['total'] : SKIP
  deltacritical = hash.key?('deltacritical') ? hash['deltacritical'] : SKIP
  deltamajor = hash.key?('deltamajor') ? hash['deltamajor'] : SKIP
  deltaminor = hash.key?('deltaminor') ? hash['deltaminor'] : SKIP
  deltanoalert = hash.key?('deltanoalert') ? hash['deltanoalert'] : SKIP

  # Create object from extracted values.
  DtoQueryMetricsResponse.new(critical: critical,
                              major: major,
                              minor: minor,
                              noalert: noalert,
                              total: total,
                              deltacritical: deltacritical,
                              deltamajor: deltamajor,
                              deltaminor: deltaminor,
                              deltanoalert: deltanoalert)
end

.namesObject

A mapping from model property names to API property names.



51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/verizon/models/dto_query_metrics_response.rb', line 51

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['critical'] = 'critical'
  @_hash['major'] = 'major'
  @_hash['minor'] = 'minor'
  @_hash['noalert'] = 'noalert'
  @_hash['total'] = 'total'
  @_hash['deltacritical'] = 'deltacritical'
  @_hash['deltamajor'] = 'deltamajor'
  @_hash['deltaminor'] = 'deltaminor'
  @_hash['deltanoalert'] = 'deltanoalert'
  @_hash
end

.nullablesObject

An array for nullable fields



81
82
83
# File 'lib/verizon/models/dto_query_metrics_response.rb', line 81

def self.nullables
  []
end

.optionalsObject

An array for optional fields



66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/verizon/models/dto_query_metrics_response.rb', line 66

def self.optionals
  %w[
    critical
    major
    minor
    noalert
    total
    deltacritical
    deltamajor
    deltaminor
    deltanoalert
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



135
136
137
138
139
140
141
# File 'lib/verizon/models/dto_query_metrics_response.rb', line 135

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} critical: #{@critical.inspect}, major: #{@major.inspect}, minor:"\
  " #{@minor.inspect}, noalert: #{@noalert.inspect}, total: #{@total.inspect}, deltacritical:"\
  " #{@deltacritical.inspect}, deltamajor: #{@deltamajor.inspect}, deltaminor:"\
  " #{@deltaminor.inspect}, deltanoalert: #{@deltanoalert.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



127
128
129
130
131
132
# File 'lib/verizon/models/dto_query_metrics_response.rb', line 127

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} critical: #{@critical}, major: #{@major}, minor: #{@minor}, noalert:"\
  " #{@noalert}, total: #{@total}, deltacritical: #{@deltacritical}, deltamajor:"\
  " #{@deltamajor}, deltaminor: #{@deltaminor}, deltanoalert: #{@deltanoalert}>"
end