Class: Verizon::MecPerformanceMetrics

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

Overview

Response to query the most recent data for Key Performance Indicators (KPIs) like network availability, MEC hostnames and more.

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(query_status: SKIP, start: SKIP, mend: SKIP, query_result: SKIP, additional_properties: nil) ⇒ MecPerformanceMetrics

Returns a new instance of MecPerformanceMetrics.



54
55
56
57
58
59
60
61
62
63
64
# File 'lib/verizon/models/mec_performance_metrics.rb', line 54

def initialize(query_status: SKIP, start: SKIP, mend: SKIP,
               query_result: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @query_status = query_status unless query_status == SKIP
  @start = start unless start == SKIP
  @mend = mend unless mend == SKIP
  @query_result = query_result unless query_result == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#mendString

Timestamp of the query’s end , format:mm/dd/yyyy, hr:min:sec.

Returns:

  • (String)


23
24
25
# File 'lib/verizon/models/mec_performance_metrics.rb', line 23

def mend
  @mend
end

#query_resultArray[MecPerformanceQueryResult]

MEC performance query result.

Returns:



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

def query_result
  @query_result
end

#query_statusString

Success or Failed.

Returns:

  • (String)


15
16
17
# File 'lib/verizon/models/mec_performance_metrics.rb', line 15

def query_status
  @query_status
end

#startString

Timestamp of the query’s start, format:mm/dd/yyyy,hr:min:sec.

Returns:

  • (String)


19
20
21
# File 'lib/verizon/models/mec_performance_metrics.rb', line 19

def start
  @start
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/verizon/models/mec_performance_metrics.rb', line 67

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  query_status = hash.key?('QueryStatus') ? hash['QueryStatus'] : SKIP
  start = hash.key?('Start') ? hash['Start'] : SKIP
  mend = hash.key?('End') ? hash['End'] : SKIP
  # Parameter is an array, so we need to iterate through it
  query_result = nil
  unless hash['QueryResult'].nil?
    query_result = []
    hash['QueryResult'].each do |structure|
      query_result << (MecPerformanceQueryResult.from_hash(structure) if structure)
    end
  end

  query_result = SKIP unless hash.key?('QueryResult')

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  MecPerformanceMetrics.new(query_status: query_status,
                            start: start,
                            mend: mend,
                            query_result: query_result,
                            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



30
31
32
33
34
35
36
37
# File 'lib/verizon/models/mec_performance_metrics.rb', line 30

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['query_status'] = 'QueryStatus'
  @_hash['start'] = 'Start'
  @_hash['mend'] = 'End'
  @_hash['query_result'] = 'QueryResult'
  @_hash
end

.nullablesObject

An array for nullable fields



50
51
52
# File 'lib/verizon/models/mec_performance_metrics.rb', line 50

def self.nullables
  []
end

.optionalsObject

An array for optional fields



40
41
42
43
44
45
46
47
# File 'lib/verizon/models/mec_performance_metrics.rb', line 40

def self.optionals
  %w[
    query_status
    start
    mend
    query_result
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} query_status: #{@query_status.inspect}, start: #{@start.inspect}, mend:"\
  " #{@mend.inspect}, query_result: #{@query_result.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



101
102
103
104
105
# File 'lib/verizon/models/mec_performance_metrics.rb', line 101

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} query_status: #{@query_status}, start: #{@start}, mend: #{@mend},"\
  " query_result: #{@query_result}, additional_properties: #{@additional_properties}>"
end