Class: Hubspot::Cms::Performance::PerformanceView

Inherits:
Object
  • Object
show all
Defined in:
lib/hubspot/codegen/cms/performance/models/performance_view.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ PerformanceView

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 152

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Hubspot::Cms::Performance::PerformanceView` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Hubspot::Cms::Performance::PerformanceView`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'_403')
    self._403 = attributes[:'_403']
  end

  if attributes.key?(:'_404')
    self._404 = attributes[:'_404']
  end

  if attributes.key?(:'_500')
    self._500 = attributes[:'_500']
  end

  if attributes.key?(:'_504')
    self._504 = attributes[:'_504']
  end

  if attributes.key?(:'start_datetime')
    self.start_datetime = attributes[:'start_datetime']
  end

  if attributes.key?(:'response_time_ms')
    self.response_time_ms = attributes[:'response_time_ms']
  end

  if attributes.key?(:'_95th')
    self._95th = attributes[:'_95th']
  end

  if attributes.key?(:'total_requests')
    self.total_requests = attributes[:'total_requests']
  end

  if attributes.key?(:'cache_hit_rate')
    self.cache_hit_rate = attributes[:'cache_hit_rate']
  end

  if attributes.key?(:'_99th')
    self._99th = attributes[:'_99th']
  end

  if attributes.key?(:'total_request_time')
    self.total_request_time = attributes[:'total_request_time']
  end

  if attributes.key?(:'_100_x')
    self._100_x = attributes[:'_100_x']
  end

  if attributes.key?(:'_50th')
    self._50th = attributes[:'_50th']
  end

  if attributes.key?(:'cache_hits')
    self.cache_hits = attributes[:'cache_hits']
  end

  if attributes.key?(:'_20_x')
    self._20_x = attributes[:'_20_x']
  end

  if attributes.key?(:'_30_x')
    self._30_x = attributes[:'_30_x']
  end

  if attributes.key?(:'_40_x')
    self._40_x = attributes[:'_40_x']
  end

  if attributes.key?(:'end_timestamp')
    self.end_timestamp = attributes[:'end_timestamp']
  end

  if attributes.key?(:'_50_x')
    self._50_x = attributes[:'_50_x']
  end

  if attributes.key?(:'start_timestamp')
    self.start_timestamp = attributes[:'start_timestamp']
  end

  if attributes.key?(:'end_datetime')
    self.end_datetime = attributes[:'end_datetime']
  end

  if attributes.key?(:'avg_origin_response_time')
    self.avg_origin_response_time = attributes[:'avg_origin_response_time']
  end
end

Instance Attribute Details

#_100_xObject

The number of responses that had an http status code between 1000-1999.



52
53
54
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 52

def _100_x
  @_100_x
end

#_20_xObject

The number of responses that had an http status code between 200-299.



61
62
63
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 61

def _20_x
  @_20_x
end

#_30_xObject

The number of responses that had an http status code between 300-399.



64
65
66
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 64

def _30_x
  @_30_x
end

#_403Object

The number of responses that had an http status code of 403.



21
22
23
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 21

def _403
  @_403
end

#_404Object

The number of responses that had an http status code of 404.



24
25
26
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 24

def _404
  @_404
end

#_40_xObject

The number of responses that had an http status code between 400-499.



67
68
69
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 67

def _40_x
  @_40_x
end

#_500Object

The number of responses that had an http status code of 500.



27
28
29
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 27

def _500
  @_500
end

#_504Object

The number of responses that had an http status code of 504.



30
31
32
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 30

def _504
  @_504
end

#_50_xObject

The number of responses that had an http status code between 500-599.



73
74
75
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 73

def _50_x
  @_50_x
end

#_50thObject

The 50th percentile response time.



55
56
57
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 55

def _50th
  @_50th
end

#_95thObject

The 95th percentile response time.



38
39
40
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 38

def _95th
  @_95th
end

#_99thObject

The 99th percentile response time.



47
48
49
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 47

def _99th
  @_99th
end

#avg_origin_response_timeObject

The average response time in milliseconds from the origin to the edge.



81
82
83
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 81

def avg_origin_response_time
  @avg_origin_response_time
end

#cache_hit_rateObject

The percentage of requests that were served cached responses.



44
45
46
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 44

def cache_hit_rate
  @cache_hit_rate
end

#cache_hitsObject

The total number of requests that were served cached responses.



58
59
60
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 58

def cache_hits
  @cache_hits
end

#end_datetimeObject

Returns the value of attribute end_datetime.



78
79
80
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 78

def end_datetime
  @end_datetime
end

#end_timestampObject

The timestamp in milliseconds of the end of this interval.



70
71
72
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 70

def end_timestamp
  @end_timestamp
end

#response_time_msObject

The average response time in milliseconds.



35
36
37
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 35

def response_time_ms
  @response_time_ms
end

#start_datetimeObject

Returns the value of attribute start_datetime.



32
33
34
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 32

def start_datetime
  @start_datetime
end

#start_timestampObject

The timestamp in milliseconds of the start of this interval.



76
77
78
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 76

def start_timestamp
  @start_timestamp
end

#total_request_timeObject

Returns the value of attribute total_request_time.



49
50
51
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 49

def total_request_time
  @total_request_time
end

#total_requestsObject

The total number of requests received in this period.



41
42
43
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 41

def total_requests
  @total_requests
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



112
113
114
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 112

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 84

def self.attribute_map
  {
    :'_403' => :'403',
    :'_404' => :'404',
    :'_500' => :'500',
    :'_504' => :'504',
    :'start_datetime' => :'startDatetime',
    :'response_time_ms' => :'responseTimeMs',
    :'_95th' => :'95th',
    :'total_requests' => :'totalRequests',
    :'cache_hit_rate' => :'cacheHitRate',
    :'_99th' => :'99th',
    :'total_request_time' => :'totalRequestTime',
    :'_100_x' => :'100X',
    :'_50th' => :'50th',
    :'cache_hits' => :'cacheHits',
    :'_20_x' => :'20X',
    :'_30_x' => :'30X',
    :'_40_x' => :'40X',
    :'end_timestamp' => :'endTimestamp',
    :'_50_x' => :'50X',
    :'start_timestamp' => :'startTimestamp',
    :'end_datetime' => :'endDatetime',
    :'avg_origin_response_time' => :'avgOriginResponseTime'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



406
407
408
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 406

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



145
146
147
148
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 145

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 117

def self.openapi_types
  {
    :'_403' => :'Integer',
    :'_404' => :'Integer',
    :'_500' => :'Integer',
    :'_504' => :'Integer',
    :'start_datetime' => :'String',
    :'response_time_ms' => :'Integer',
    :'_95th' => :'Integer',
    :'total_requests' => :'Integer',
    :'cache_hit_rate' => :'Float',
    :'_99th' => :'Integer',
    :'total_request_time' => :'Integer',
    :'_100_x' => :'Integer',
    :'_50th' => :'Integer',
    :'cache_hits' => :'Integer',
    :'_20_x' => :'Integer',
    :'_30_x' => :'Integer',
    :'_40_x' => :'Integer',
    :'end_timestamp' => :'Integer',
    :'_50_x' => :'Integer',
    :'start_timestamp' => :'Integer',
    :'end_datetime' => :'String',
    :'avg_origin_response_time' => :'Integer'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 364

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      _403 == o._403 &&
      _404 == o._404 &&
      _500 == o._500 &&
      _504 == o._504 &&
      start_datetime == o.start_datetime &&
      response_time_ms == o.response_time_ms &&
      _95th == o._95th &&
      total_requests == o.total_requests &&
      cache_hit_rate == o.cache_hit_rate &&
      _99th == o._99th &&
      total_request_time == o.total_request_time &&
      _100_x == o._100_x &&
      _50th == o._50th &&
      cache_hits == o.cache_hits &&
      _20_x == o._20_x &&
      _30_x == o._30_x &&
      _40_x == o._40_x &&
      end_timestamp == o.end_timestamp &&
      _50_x == o._50_x &&
      start_timestamp == o.start_timestamp &&
      end_datetime == o.end_datetime &&
      avg_origin_response_time == o.avg_origin_response_time
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 437

def _deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = Hubspot::Cms::Performance.const_get(type)
    klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



508
509
510
511
512
513
514
515
516
517
518
519
520
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 508

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 413

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  self.class.openapi_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      self.send("#{key}=", nil)
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


393
394
395
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 393

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



399
400
401
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 399

def hash
  [_403, _404, _500, _504, start_datetime, response_time_ms, _95th, total_requests, cache_hit_rate, _99th, total_request_time, _100_x, _50th, cache_hits, _20_x, _30_x, _40_x, end_timestamp, _50_x, start_timestamp, end_datetime, avg_origin_response_time].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 256

def list_invalid_properties
  invalid_properties = Array.new
  if @_403.nil?
    invalid_properties.push('invalid value for "_403", _403 cannot be nil.')
  end

  if @_404.nil?
    invalid_properties.push('invalid value for "_404", _404 cannot be nil.')
  end

  if @_500.nil?
    invalid_properties.push('invalid value for "_500", _500 cannot be nil.')
  end

  if @_504.nil?
    invalid_properties.push('invalid value for "_504", _504 cannot be nil.')
  end

  if @response_time_ms.nil?
    invalid_properties.push('invalid value for "response_time_ms", response_time_ms cannot be nil.')
  end

  if @_95th.nil?
    invalid_properties.push('invalid value for "_95th", _95th cannot be nil.')
  end

  if @total_requests.nil?
    invalid_properties.push('invalid value for "total_requests", total_requests cannot be nil.')
  end

  if @cache_hit_rate.nil?
    invalid_properties.push('invalid value for "cache_hit_rate", cache_hit_rate cannot be nil.')
  end

  if @_99th.nil?
    invalid_properties.push('invalid value for "_99th", _99th cannot be nil.')
  end

  if @_100_x.nil?
    invalid_properties.push('invalid value for "_100_x", _100_x cannot be nil.')
  end

  if @_50th.nil?
    invalid_properties.push('invalid value for "_50th", _50th cannot be nil.')
  end

  if @cache_hits.nil?
    invalid_properties.push('invalid value for "cache_hits", cache_hits cannot be nil.')
  end

  if @_20_x.nil?
    invalid_properties.push('invalid value for "_20_x", _20_x cannot be nil.')
  end

  if @_30_x.nil?
    invalid_properties.push('invalid value for "_30_x", _30_x cannot be nil.')
  end

  if @_40_x.nil?
    invalid_properties.push('invalid value for "_40_x", _40_x cannot be nil.')
  end

  if @end_timestamp.nil?
    invalid_properties.push('invalid value for "end_timestamp", end_timestamp cannot be nil.')
  end

  if @_50_x.nil?
    invalid_properties.push('invalid value for "_50_x", _50_x cannot be nil.')
  end

  if @start_timestamp.nil?
    invalid_properties.push('invalid value for "start_timestamp", start_timestamp cannot be nil.')
  end

  if @avg_origin_response_time.nil?
    invalid_properties.push('invalid value for "avg_origin_response_time", avg_origin_response_time cannot be nil.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



484
485
486
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 484

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



490
491
492
493
494
495
496
497
498
499
500
501
502
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 490

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



478
479
480
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 478

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 339

def valid?
  return false if @_403.nil?
  return false if @_404.nil?
  return false if @_500.nil?
  return false if @_504.nil?
  return false if @response_time_ms.nil?
  return false if @_95th.nil?
  return false if @total_requests.nil?
  return false if @cache_hit_rate.nil?
  return false if @_99th.nil?
  return false if @_100_x.nil?
  return false if @_50th.nil?
  return false if @cache_hits.nil?
  return false if @_20_x.nil?
  return false if @_30_x.nil?
  return false if @_40_x.nil?
  return false if @end_timestamp.nil?
  return false if @_50_x.nil?
  return false if @start_timestamp.nil?
  return false if @avg_origin_response_time.nil?
  true
end