Class: ApiReference::EventSearchCriteria

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

Overview

EventSearchCriteria 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(event_ids:, timeframe_start: SKIP, timeframe_end: SKIP) ⇒ EventSearchCriteria

Returns a new instance of EventSearchCriteria.



55
56
57
58
59
# File 'lib/api_reference/models/event_search_criteria.rb', line 55

def initialize(event_ids:, timeframe_start: SKIP, timeframe_end: SKIP)
  @event_ids = event_ids
  @timeframe_start = timeframe_start unless timeframe_start == SKIP
  @timeframe_end = timeframe_end unless timeframe_end == SKIP
end

Instance Attribute Details

#event_idsArray[String]

This is an explicit array of IDs to filter by. Note that an event's ID is the idempotency_key that was originally used for ingestion, and this only supports events that have not been amended. Values in this array will be treated case sensitively.

Returns:

  • (Array[String])


18
19
20
# File 'lib/api_reference/models/event_search_criteria.rb', line 18

def event_ids
  @event_ids
end

#timeframe_endDateTime

The end of the timeframe, exclusive, in which to search events. If not specified, the current time is used.

Returns:

  • (DateTime)


28
29
30
# File 'lib/api_reference/models/event_search_criteria.rb', line 28

def timeframe_end
  @timeframe_end
end

#timeframe_startDateTime

The start of the timeframe, inclusive, in which to search events. If not specified, the one week ago is used.

Returns:

  • (DateTime)


23
24
25
# File 'lib/api_reference/models/event_search_criteria.rb', line 23

def timeframe_start
  @timeframe_start
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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_search_criteria.rb', line 62

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  event_ids = hash.key?('event_ids') ? hash['event_ids'] : nil
  timeframe_start = if hash.key?('timeframe_start')
                      (DateTimeHelper.from_rfc3339(hash['timeframe_start']) if hash['timeframe_start'])
                    else
                      SKIP
                    end
  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.
  EventSearchCriteria.new(event_ids: event_ids,
                          timeframe_start: timeframe_start,
                          timeframe_end: timeframe_end)
end

.namesObject

A mapping from model property names to API property names.



31
32
33
34
35
36
37
# File 'lib/api_reference/models/event_search_criteria.rb', line 31

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

.nullablesObject

An array for nullable fields



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

def self.nullables
  %w[
    timeframe_start
    timeframe_end
  ]
end

.optionalsObject

An array for optional fields



40
41
42
43
44
45
# File 'lib/api_reference/models/event_search_criteria.rb', line 40

def self.optionals
  %w[
    timeframe_start
    timeframe_end
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

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

#to_custom_timeframe_endObject



88
89
90
# File 'lib/api_reference/models/event_search_criteria.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_search_criteria.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_search_criteria.rb', line 93

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