class Hubspot::Cms::Performance::PerformanceView

Attributes

_100_x[RW]

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

_20_x[RW]

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

_30_x[RW]

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

_403[RW]

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

_404[RW]

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

_40_x[RW]

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

_500[RW]

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

_504[RW]

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

_50_x[RW]

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

_50th[RW]

The 50th percentile response time.

_95th[RW]

The 95th percentile response time.

_99th[RW]

The 99th percentile response time.

avg_origin_response_time[RW]

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

cache_hit_rate[RW]

The percentage of requests that were served cached responses.

cache_hits[RW]

The total number of requests that were served cached responses.

end_datetime[RW]
end_timestamp[RW]

The timestamp in milliseconds of the end of this interval.

response_time_ms[RW]

The average response time in milliseconds.

start_datetime[RW]
start_timestamp[RW]

The timestamp in milliseconds of the start of this interval.

total_request_time[RW]
total_requests[RW]

The total number of requests received in this period.

Public Class Methods

attribute_map() click to toggle source

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

# 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) click to toggle source

Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself

# File lib/hubspot/codegen/cms/performance/models/performance_view.rb, line 415
def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end
new(attributes = {}) click to toggle source

Initializes the object @param [Hash] attributes Model attributes in the form of hash

# 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
openapi_nullable() click to toggle source

List of attributes with nullable: true

# File lib/hubspot/codegen/cms/performance/models/performance_view.rb, line 139
def self.openapi_nullable
  Set.new([
  ])
end
openapi_types() click to toggle source

Attribute type mapping.

# 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

Public Instance Methods

==(o) click to toggle source

Checks equality by comparing each attribute. @param [Object] Object to be compared

# 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) click to toggle source

Deserializes the data based on type @param string type Data type @param string value Value to be deserialized @return [Object] Deserialized data

# 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) click to toggle source

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash

# 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) click to toggle source

Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself

# 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) click to toggle source

@see the `==` method @param [Object] Object to be compared

# File lib/hubspot/codegen/cms/performance/models/performance_view.rb, line 402
def eql?(o)
  self == o
end
hash() click to toggle source

Calculates hash code according to all attributes. @return [Integer] Hash code

# 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_properties() click to toggle source

Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properties with the reasons

# 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_body() click to toggle source

to_body is an alias to to_hash (backward compatibility) @return [Hash] Returns the object in the form of hash

# File lib/hubspot/codegen/cms/performance/models/performance_view.rb, line 488
def to_body
  to_hash
end
to_hash() click to toggle source

Returns the object in the form of hash @return [Hash] Returns the object in the form of hash

# 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_s() click to toggle source

Returns the string representation of the object @return [String] String presentation of the object

# File lib/hubspot/codegen/cms/performance/models/performance_view.rb, line 482
def to_s
  to_hash.to_s
end
valid?() click to toggle source

Check to see if the all the properties in the model are valid @return true if the model is valid

# 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