Class: ApiReference::EventVolume

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/api_reference/models/event_volume.rb

Overview

An EventVolume contains the event volume ingested in an hourly window. The timestamp used for the aggregation is the timestamp datetime field on events.

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(timeframe_start:, timeframe_end:, count:, additional_properties: nil) ⇒ EventVolume

Returns a new instance of EventVolume.



46
47
48
49
50
51
52
53
54
55
# File 'lib/api_reference/models/event_volume.rb', line 46

def initialize(timeframe_start:, timeframe_end:, count:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @timeframe_start = timeframe_start
  @timeframe_end = timeframe_end
  @count = count
  @additional_properties = additional_properties
end

Instance Attribute Details

#countInteger

The number of events ingested with a timestamp between the timeframe

Returns:

  • (Integer)


25
26
27
# File 'lib/api_reference/models/event_volume.rb', line 25

def count
  @count
end

#timeframe_endDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


21
22
23
# File 'lib/api_reference/models/event_volume.rb', line 21

def timeframe_end
  @timeframe_end
end

#timeframe_startDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


17
18
19
# File 'lib/api_reference/models/event_volume.rb', line 17

def timeframe_start
  @timeframe_start
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/api_reference/models/event_volume.rb', line 58

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  timeframe_start = if hash.key?('timeframe_start')
                      (DateTimeHelper.from_rfc3339(hash['timeframe_start']) if hash['timeframe_start'])
                    end
  timeframe_end = if hash.key?('timeframe_end')
                    (DateTimeHelper.from_rfc3339(hash['timeframe_end']) if hash['timeframe_end'])
                  end
  count = hash.key?('count') ? hash['count'] : nil

  # 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.
  EventVolume.new(timeframe_start: timeframe_start,
                  timeframe_end: timeframe_end,
                  count: count,
                  additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



28
29
30
31
32
33
34
# File 'lib/api_reference/models/event_volume.rb', line 28

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['timeframe_start'] = 'timeframe_start'
  @_hash['timeframe_end'] = 'timeframe_end'
  @_hash['count'] = 'count'
  @_hash
end

.nullablesObject

An array for nullable fields



42
43
44
# File 'lib/api_reference/models/event_volume.rb', line 42

def self.nullables
  []
end

.optionalsObject

An array for optional fields



37
38
39
# File 'lib/api_reference/models/event_volume.rb', line 37

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



100
101
102
103
104
105
# File 'lib/api_reference/models/event_volume.rb', line 100

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} timeframe_start: #{@timeframe_start.inspect}, timeframe_end:"\
  " #{@timeframe_end.inspect}, count: #{@count.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_custom_timeframe_endObject



88
89
90
# File 'lib/api_reference/models/event_volume.rb', line 88

def to_custom_timeframe_end
  DateTimeHelper.to_rfc3339(timeframe_end)
end

#to_custom_timeframe_startObject



84
85
86
# File 'lib/api_reference/models/event_volume.rb', line 84

def to_custom_timeframe_start
  DateTimeHelper.to_rfc3339(timeframe_start)
end

#to_sObject

Provides a human-readable string representation of the object.



93
94
95
96
97
# File 'lib/api_reference/models/event_volume.rb', line 93

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} timeframe_start: #{@timeframe_start}, timeframe_end: #{@timeframe_end},"\
  " count: #{@count}, additional_properties: #{@additional_properties}>"
end