Class: FdxV660Api::CertificationMetricEntity

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/fdx_v660_api/models/certification_metric_entity.rb

Overview

A single certification performance metric

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(report_start_timestamp: SKIP, report_end_timestamp: SKIP, metrics_name: SKIP, operation_ids: SKIP, response_time_average: SKIP, average_up_time: SKIP, report_timestamp: SKIP, additional_properties: nil) ⇒ CertificationMetricEntity

Returns a new instance of CertificationMetricEntity.



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/fdx_v660_api/models/certification_metric_entity.rb', line 77

def initialize(report_start_timestamp: SKIP, report_end_timestamp: SKIP,
               metrics_name: SKIP, operation_ids: SKIP,
               response_time_average: SKIP, average_up_time: SKIP,
               report_timestamp: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @report_start_timestamp = report_start_timestamp unless report_start_timestamp == SKIP
  @report_end_timestamp = report_end_timestamp unless report_end_timestamp == SKIP
  @metrics_name = metrics_name unless metrics_name == SKIP
  @operation_ids = operation_ids unless operation_ids == SKIP
  @response_time_average = response_time_average unless response_time_average == SKIP
  @average_up_time = average_up_time unless average_up_time == SKIP
  @report_timestamp = report_timestamp unless report_timestamp == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#average_up_timeFloat

See the Certification Performance section that describes how this measurement will be calculated, defines the % of availability during the measurement

Returns:

  • (Float)


40
41
42
# File 'lib/fdx_v660_api/models/certification_metric_entity.rb', line 40

def average_up_time
  @average_up_time
end

#metrics_nameString

Any provider descriptive name for the measurement. Optional, can be omitted if operationIds are returned

Returns:

  • (String)


24
25
26
# File 'lib/fdx_v660_api/models/certification_metric_entity.rb', line 24

def metrics_name
  @metrics_name
end

#operation_idsArray[FdxResourceOperationId]

One or more Operation IDs for which these metrics apply. Optional, can be omitted if metricsName is returned

Returns:



29
30
31
# File 'lib/fdx_v660_api/models/certification_metric_entity.rb', line 29

def operation_ids
  @operation_ids
end

#report_end_timestampDateTime

When the reported metrics period ended

Returns:

  • (DateTime)


19
20
21
# File 'lib/fdx_v660_api/models/certification_metric_entity.rb', line 19

def report_end_timestamp
  @report_end_timestamp
end

#report_start_timestampDateTime

When the reported metrics period began

Returns:

  • (DateTime)


15
16
17
# File 'lib/fdx_v660_api/models/certification_metric_entity.rb', line 15

def report_start_timestamp
  @report_start_timestamp
end

#report_timestampDateTime

Time when these performance and availability metrics were created

Returns:

  • (DateTime)


44
45
46
# File 'lib/fdx_v660_api/models/certification_metric_entity.rb', line 44

def report_timestamp
  @report_timestamp
end

#response_time_averageFloat

The self-reported average response time in milliseconds for all combined data responses

Returns:

  • (Float)


34
35
36
# File 'lib/fdx_v660_api/models/certification_metric_entity.rb', line 34

def response_time_average
  @response_time_average
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



95
96
97
98
99
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
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/fdx_v660_api/models/certification_metric_entity.rb', line 95

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  report_start_timestamp = if hash.key?('reportStartTimestamp')
                             (DateTimeHelper.from_rfc3339(hash['reportStartTimestamp']) if hash['reportStartTimestamp'])
                           else
                             SKIP
                           end
  report_end_timestamp = if hash.key?('reportEndTimestamp')
                           (DateTimeHelper.from_rfc3339(hash['reportEndTimestamp']) if hash['reportEndTimestamp'])
                         else
                           SKIP
                         end
  metrics_name = hash.key?('metricsName') ? hash['metricsName'] : SKIP
  operation_ids = hash.key?('operationIds') ? hash['operationIds'] : SKIP
  response_time_average =
    hash.key?('responseTimeAverage') ? hash['responseTimeAverage'] : SKIP
  average_up_time =
    hash.key?('averageUpTime') ? hash['averageUpTime'] : SKIP
  report_timestamp = if hash.key?('reportTimestamp')
                       (DateTimeHelper.from_rfc3339(hash['reportTimestamp']) if hash['reportTimestamp'])
                     else
                       SKIP
                     end

  # 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.
  CertificationMetricEntity.new(report_start_timestamp: report_start_timestamp,
                                report_end_timestamp: report_end_timestamp,
                                metrics_name: metrics_name,
                                operation_ids: operation_ids,
                                response_time_average: response_time_average,
                                average_up_time: average_up_time,
                                report_timestamp: report_timestamp,
                                additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



47
48
49
50
51
52
53
54
55
56
57
# File 'lib/fdx_v660_api/models/certification_metric_entity.rb', line 47

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['report_start_timestamp'] = 'reportStartTimestamp'
  @_hash['report_end_timestamp'] = 'reportEndTimestamp'
  @_hash['metrics_name'] = 'metricsName'
  @_hash['operation_ids'] = 'operationIds'
  @_hash['response_time_average'] = 'responseTimeAverage'
  @_hash['average_up_time'] = 'averageUpTime'
  @_hash['report_timestamp'] = 'reportTimestamp'
  @_hash
end

.nullablesObject

An array for nullable fields



73
74
75
# File 'lib/fdx_v660_api/models/certification_metric_entity.rb', line 73

def self.nullables
  []
end

.optionalsObject

An array for optional fields



60
61
62
63
64
65
66
67
68
69
70
# File 'lib/fdx_v660_api/models/certification_metric_entity.rb', line 60

def self.optionals
  %w[
    report_start_timestamp
    report_end_timestamp
    metrics_name
    operation_ids
    response_time_average
    average_up_time
    report_timestamp
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



162
163
164
165
166
167
168
169
170
# File 'lib/fdx_v660_api/models/certification_metric_entity.rb', line 162

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} report_start_timestamp: #{@report_start_timestamp.inspect},"\
  " report_end_timestamp: #{@report_end_timestamp.inspect}, metrics_name:"\
  " #{@metrics_name.inspect}, operation_ids: #{@operation_ids.inspect}, response_time_average:"\
  " #{@response_time_average.inspect}, average_up_time: #{@average_up_time.inspect},"\
  " report_timestamp: #{@report_timestamp.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_custom_report_end_timestampObject



143
144
145
# File 'lib/fdx_v660_api/models/certification_metric_entity.rb', line 143

def to_custom_report_end_timestamp
  DateTimeHelper.to_rfc3339(report_end_timestamp)
end

#to_custom_report_start_timestampObject



139
140
141
# File 'lib/fdx_v660_api/models/certification_metric_entity.rb', line 139

def to_custom_report_start_timestamp
  DateTimeHelper.to_rfc3339(report_start_timestamp)
end

#to_custom_report_timestampObject



147
148
149
# File 'lib/fdx_v660_api/models/certification_metric_entity.rb', line 147

def to_custom_report_timestamp
  DateTimeHelper.to_rfc3339(report_timestamp)
end

#to_sObject

Provides a human-readable string representation of the object.



152
153
154
155
156
157
158
159
# File 'lib/fdx_v660_api/models/certification_metric_entity.rb', line 152

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} report_start_timestamp: #{@report_start_timestamp}, report_end_timestamp:"\
  " #{@report_end_timestamp}, metrics_name: #{@metrics_name}, operation_ids:"\
  " #{@operation_ids}, response_time_average: #{@response_time_average}, average_up_time:"\
  " #{@average_up_time}, report_timestamp: #{@report_timestamp}, additional_properties:"\
  " #{@additional_properties}>"
end