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



146
147
148
149
150
151
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
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 146

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_timestamp')
    self.start_timestamp = attributes[:'start_timestamp']
  end

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

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

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

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

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

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

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

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

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

  if attributes.key?(:'_100_x')
    self._100_x = attributes[:'_100_x']
  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?(:'_50_x')
    self._50_x = attributes[:'_50_x']
  end

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

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

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

Instance Attribute Details

#_100_xObject

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



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

def _100_x
  @_100_x
end

#_20_xObject

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



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

def _20_x
  @_20_x
end

#_30_xObject

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



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

def _30_x
  @_30_x
end

#_403Object

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



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

def _403
  @_403
end

#_404Object

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



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

def _404
  @_404
end

#_40_xObject

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



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

def _40_x
  @_40_x
end

#_500Object

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



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

def _500
  @_500
end

#_504Object

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



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

def _504
  @_504
end

#_50_xObject

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



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

def _50_x
  @_50_x
end

#_50thObject

The 50th percentile response time.



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

def _50th
  @_50th
end

#_95thObject

The 95th percentile response time.



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

def _95th
  @_95th
end

#_99thObject

The 99th percentile response time.



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

def _99th
  @_99th
end

#avg_origin_response_timeObject

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



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

def avg_origin_response_time
  @avg_origin_response_time
end

#cache_hit_rateObject

The percentage of requests that were served cached responses.



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

def cache_hit_rate
  @cache_hit_rate
end

#cache_hitsObject

The total number of requests that were served cached responses.



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

def cache_hits
  @cache_hits
end

#end_datetimeObject

Returns the value of attribute end_datetime.



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

def end_datetime
  @end_datetime
end

#end_timestampObject

The timestamp in milliseconds of the end of this interval.



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

def end_timestamp
  @end_timestamp
end

#response_time_msObject

The average response time in milliseconds.



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

def response_time_ms
  @response_time_ms
end

#start_datetimeObject

Returns the value of attribute start_datetime.



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

def start_datetime
  @start_datetime
end

#start_timestampObject

The timestamp in milliseconds of the start of this interval.



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

def start_timestamp
  @start_timestamp
end

#total_request_timeObject

Returns the value of attribute total_request_time.



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

def total_request_time
  @total_request_time
end

#total_requestsObject

The total number of requests received in this period.



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

def total_requests
  @total_requests
end

Class Method Details

.attribute_mapObject

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



83
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
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 83

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



415
416
417
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 415

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

.openapi_nullableObject

List of attributes with nullable: true



139
140
141
142
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 139

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

.openapi_typesObject

Attribute type mapping.



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
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 111

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

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 373

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_timestamp == o.start_timestamp &&
      end_timestamp == o.end_timestamp &&
      start_datetime == o.start_datetime &&
      end_datetime == o.end_datetime &&
      total_requests == o.total_requests &&
      cache_hits == o.cache_hits &&
      cache_hit_rate == o.cache_hit_rate &&
      total_request_time == o.total_request_time &&
      avg_origin_response_time == o.avg_origin_response_time &&
      response_time_ms == o.response_time_ms &&
      _100_x == o._100_x &&
      _20_x == o._20_x &&
      _30_x == o._30_x &&
      _40_x == o._40_x &&
      _50_x == o._50_x &&
      _50th == o._50th &&
      _95th == o._95th &&
      _99th == o._99th
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



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
475
476
477
478
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 443

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.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
    Hubspot::Cms::Performance.const_get(type).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



512
513
514
515
516
517
518
519
520
521
522
523
524
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 512

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



422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 422

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.openapi_types.each_pair do |key, type|
    if 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 # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


402
403
404
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 402

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



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

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

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



250
251
252
253
254
255
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
336
337
338
339
340
341
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 250

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 @start_timestamp.nil?
    invalid_properties.push('invalid value for "start_timestamp", start_timestamp cannot be nil.')
  end

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

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

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

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

  if @cache_hits.nil?
    invalid_properties.push('invalid value for "cache_hits", cache_hits 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 @total_request_time.nil?
    invalid_properties.push('invalid value for "total_request_time", total_request_time 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

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

  if @_100_x.nil?
    invalid_properties.push('invalid value for "_100_x", _100_x 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 @_50_x.nil?
    invalid_properties.push('invalid value for "_50_x", _50_x cannot be nil.')
  end

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

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

  if @_99th.nil?
    invalid_properties.push('invalid value for "_99th", _99th 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



488
489
490
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 488

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



494
495
496
497
498
499
500
501
502
503
504
505
506
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 494

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



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

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



345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
# File 'lib/hubspot/codegen/cms/performance/models/performance_view.rb', line 345

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 @start_timestamp.nil?
  return false if @end_timestamp.nil?
  return false if @start_datetime.nil?
  return false if @end_datetime.nil?
  return false if @total_requests.nil?
  return false if @cache_hits.nil?
  return false if @cache_hit_rate.nil?
  return false if @total_request_time.nil?
  return false if @avg_origin_response_time.nil?
  return false if @response_time_ms.nil?
  return false if @_100_x.nil?
  return false if @_20_x.nil?
  return false if @_30_x.nil?
  return false if @_40_x.nil?
  return false if @_50_x.nil?
  return false if @_50th.nil?
  return false if @_95th.nil?
  return false if @_99th.nil?
  true
end