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

#to_hash, #to_json

Constructor Details

#initialize(query_status = SKIP, start = SKIP, mend = SKIP, query_result = SKIP) ⇒ MECPerformanceMetrics

Returns a new instance of MECPerformanceMetrics.



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

def initialize(query_status = SKIP, start = SKIP, mend = SKIP,
               query_result = SKIP)
  @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
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.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/verizon/models/mec_performance_metrics.rb', line 63

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 object from extracted values.
  MECPerformanceMetrics.new(query_status,
                            start,
                            mend,
                            query_result)
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