Class: ApiReference::EventVolumeParams

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

Overview

EventVolumeParams Model.

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:, limit: 20, cursor: SKIP, timeframe_end: SKIP) ⇒ EventVolumeParams

Returns a new instance of EventVolumeParams.



62
63
64
65
66
67
68
# File 'lib/api_reference/models/event_volume_params.rb', line 62

def initialize(timeframe_start:, limit: 20, cursor: SKIP,
               timeframe_end: SKIP)
  @limit = limit unless limit == SKIP
  @cursor = cursor unless cursor == SKIP
  @timeframe_start = timeframe_start
  @timeframe_end = timeframe_end unless timeframe_end == SKIP
end

Instance Attribute Details

#cursorString

Cursor for pagination. This can be populated by the next_cursor value returned from the initial request.

Returns:

  • (String)


20
21
22
# File 'lib/api_reference/models/event_volume_params.rb', line 20

def cursor
  @cursor
end

#limitInteger

The number of items to fetch. Defaults to 20.

Returns:

  • (Integer)


15
16
17
# File 'lib/api_reference/models/event_volume_params.rb', line 15

def limit
  @limit
end

#timeframe_endDateTime

The end of the timeframe, exclusive, in which to return event volume. If not specified, the current time is used. All datetime values are converted to UTC time.If the specified time isn't hour-aligned, the response includes the event volumecount for the hour the time falls in.

Returns:

  • (DateTime)


34
35
36
# File 'lib/api_reference/models/event_volume_params.rb', line 34

def timeframe_end
  @timeframe_end
end

#timeframe_startDateTime

The start of the timeframe, inclusive, in which to return event volume. All datetime values are converted to UTC time. If the specified time isn't hour-aligned, the response includes the event volume count for the hour the time falls in.

Returns:

  • (DateTime)


27
28
29
# File 'lib/api_reference/models/event_volume_params.rb', line 27

def timeframe_start
  @timeframe_start
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/api_reference/models/event_volume_params.rb', line 71

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
  limit = hash['limit'] ||= 20
  cursor = hash.key?('cursor') ? hash['cursor'] : SKIP
  timeframe_end = if hash.key?('timeframe_end')
                    (DateTimeHelper.from_rfc3339(hash['timeframe_end']) if hash['timeframe_end'])
                  else
                    SKIP
                  end

  # Create object from extracted values.
  EventVolumeParams.new(timeframe_start: timeframe_start,
                        limit: limit,
                        cursor: cursor,
                        timeframe_end: timeframe_end)
end

.namesObject

A mapping from model property names to API property names.



37
38
39
40
41
42
43
44
# File 'lib/api_reference/models/event_volume_params.rb', line 37

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

.nullablesObject

An array for nullable fields



56
57
58
59
60
# File 'lib/api_reference/models/event_volume_params.rb', line 56

def self.nullables
  %w[
    cursor
  ]
end

.optionalsObject

An array for optional fields



47
48
49
50
51
52
53
# File 'lib/api_reference/models/event_volume_params.rb', line 47

def self.optionals
  %w[
    limit
    cursor
    timeframe_end
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



109
110
111
112
113
# File 'lib/api_reference/models/event_volume_params.rb', line 109

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

#to_custom_timeframe_endObject



97
98
99
# File 'lib/api_reference/models/event_volume_params.rb', line 97

def to_custom_timeframe_end
  DateTimeHelper.to_rfc3339(timeframe_end)
end

#to_custom_timeframe_startObject



93
94
95
# File 'lib/api_reference/models/event_volume_params.rb', line 93

def to_custom_timeframe_start
  DateTimeHelper.to_rfc3339(timeframe_start)
end

#to_sObject

Provides a human-readable string representation of the object.



102
103
104
105
106
# File 'lib/api_reference/models/event_volume_params.rb', line 102

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