class Twilio::REST::Taskrouter::V1::WorkspaceContext::EventList
Public Class Methods
Initialize the EventList
@param [Version] version Version
that contains the resource @param [String] workspace_sid The SID of the Workspace that contains the Event. @return [EventList] EventList
Twilio::REST::ListResource::new
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb 20 def initialize(version, workspace_sid: nil) 21 super(version) 22 23 # Path Solution 24 @solution = {workspace_sid: workspace_sid} 25 @uri = "/Workspaces/#{@solution[:workspace_sid]}/Events" 26 end
Public Instance Methods
When passed a block, yields EventInstance
records from the API. This operation lazily loads records as efficiently as possible until the limit is reached.
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb 143 def each 144 limits = @version.read_limits 145 146 page = self.page(page_size: limits[:page_size], ) 147 148 @version.stream(page, 149 limit: limits[:limit], 150 page_limit: limits[:page_limit]).each {|x| yield x} 151 end
Retrieve a single page of EventInstance
records from the API. Request
is executed immediately. @param [String] target_url API-generated URL for the requested results page @return [Page] Page
of EventInstance
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb 213 def get_page(target_url) 214 response = @version.domain.request( 215 'GET', 216 target_url 217 ) 218 EventPage.new(@version, response, @solution) 219 end
Lists EventInstance
records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. @param [Time] end_date Only include Events
that occurred on or before this date,
specified in GMT as an {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601] date-time.
@param [String] event_type The type of Events
to read. Returns only Events
of
the type specified.
@param [String] minutes The period of events to read in minutes. Returns only
Events that occurred since this many minutes in the past. The default is `15` minutes. Task Attributes for Events occuring more 43,200 minutes ago will be redacted.
@param [String] reservation_sid The SID of the Reservation with the Events
to
read. Returns only Events that pertain to the specified Reservation.
@param [Time] start_date Only include Events
from on or after this date and
time, specified in {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601] format. Task Attributes for Events older than 30 days will be redacted.
@param [String] task_queue_sid The SID of the TaskQueue with the Events
to read.
Returns only the Events that pertain to the specified TaskQueue.
@param [String] task_sid The SID of the Task with the Events
to read. Returns
only the Events that pertain to the specified Task.
@param [String] worker_sid The SID of the Worker with the Events
to read.
Returns only the Events that pertain to the specified Worker.
@param [String] workflow_sid The SID of the Workflow with the Events
to read.
Returns only the Events that pertain to the specified Workflow.
@param [String] task_channel The TaskChannel with the Events
to read. Returns
only the Events that pertain to the specified TaskChannel.
@param [String] sid The SID of the Event resource to read. @param [Integer] limit Upper limit for the number of records to return. stream()
guarantees to never return more than limit. Default is no limit
@param [Integer] page_size Number of records to fetch per request, when
not set will use the default value of 50 records. If no page_size is defined but a limit is defined, stream() will attempt to read the limit with the most efficient page size, i.e. min(limit, 1000)
@return [Array] Array of up to limit results
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb 64 def list(end_date: :unset, event_type: :unset, minutes: :unset, reservation_sid: :unset, start_date: :unset, task_queue_sid: :unset, task_sid: :unset, worker_sid: :unset, workflow_sid: :unset, task_channel: :unset, sid: :unset, limit: nil, page_size: nil) 65 self.stream( 66 end_date: end_date, 67 event_type: event_type, 68 minutes: minutes, 69 reservation_sid: reservation_sid, 70 start_date: start_date, 71 task_queue_sid: task_queue_sid, 72 task_sid: task_sid, 73 worker_sid: worker_sid, 74 workflow_sid: workflow_sid, 75 task_channel: task_channel, 76 sid: sid, 77 limit: limit, 78 page_size: page_size 79 ).entries 80 end
Retrieve a single page of EventInstance
records from the API. Request
is executed immediately. @param [Time] end_date Only include Events
that occurred on or before this date,
specified in GMT as an {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601] date-time.
@param [String] event_type The type of Events
to read. Returns only Events
of
the type specified.
@param [String] minutes The period of events to read in minutes. Returns only
Events that occurred since this many minutes in the past. The default is `15` minutes. Task Attributes for Events occuring more 43,200 minutes ago will be redacted.
@param [String] reservation_sid The SID of the Reservation with the Events
to
read. Returns only Events that pertain to the specified Reservation.
@param [Time] start_date Only include Events
from on or after this date and
time, specified in {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601] format. Task Attributes for Events older than 30 days will be redacted.
@param [String] task_queue_sid The SID of the TaskQueue with the Events
to read.
Returns only the Events that pertain to the specified TaskQueue.
@param [String] task_sid The SID of the Task with the Events
to read. Returns
only the Events that pertain to the specified Task.
@param [String] worker_sid The SID of the Worker with the Events
to read.
Returns only the Events that pertain to the specified Worker.
@param [String] workflow_sid The SID of the Workflow with the Events
to read.
Returns only the Events that pertain to the specified Workflow.
@param [String] task_channel The TaskChannel with the Events
to read. Returns
only the Events that pertain to the specified TaskChannel.
@param [String] sid The SID of the Event resource to read. @param [String] page_token PageToken provided by the API @param [Integer] page_number Page
Number, this value is simply for client state @param [Integer] page_size Number of records to return, defaults to 50 @return [Page] Page
of EventInstance
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb 185 def page(end_date: :unset, event_type: :unset, minutes: :unset, reservation_sid: :unset, start_date: :unset, task_queue_sid: :unset, task_sid: :unset, worker_sid: :unset, workflow_sid: :unset, task_channel: :unset, sid: :unset, page_token: :unset, page_number: :unset, page_size: :unset) 186 params = Twilio::Values.of({ 187 'EndDate' => Twilio.serialize_iso8601_datetime(end_date), 188 'EventType' => event_type, 189 'Minutes' => minutes, 190 'ReservationSid' => reservation_sid, 191 'StartDate' => Twilio.serialize_iso8601_datetime(start_date), 192 'TaskQueueSid' => task_queue_sid, 193 'TaskSid' => task_sid, 194 'WorkerSid' => worker_sid, 195 'WorkflowSid' => workflow_sid, 196 'TaskChannel' => task_channel, 197 'Sid' => sid, 198 'PageToken' => page_token, 199 'Page' => page_number, 200 'PageSize' => page_size, 201 }) 202 203 response = @version.page('GET', @uri, params: params) 204 205 EventPage.new(@version, response, @solution) 206 end
Streams EventInstance
records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached. @param [Time] end_date Only include Events
that occurred on or before this date,
specified in GMT as an {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601] date-time.
@param [String] event_type The type of Events
to read. Returns only Events
of
the type specified.
@param [String] minutes The period of events to read in minutes. Returns only
Events that occurred since this many minutes in the past. The default is `15` minutes. Task Attributes for Events occuring more 43,200 minutes ago will be redacted.
@param [String] reservation_sid The SID of the Reservation with the Events
to
read. Returns only Events that pertain to the specified Reservation.
@param [Time] start_date Only include Events
from on or after this date and
time, specified in {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601] format. Task Attributes for Events older than 30 days will be redacted.
@param [String] task_queue_sid The SID of the TaskQueue with the Events
to read.
Returns only the Events that pertain to the specified TaskQueue.
@param [String] task_sid The SID of the Task with the Events
to read. Returns
only the Events that pertain to the specified Task.
@param [String] worker_sid The SID of the Worker with the Events
to read.
Returns only the Events that pertain to the specified Worker.
@param [String] workflow_sid The SID of the Workflow with the Events
to read.
Returns only the Events that pertain to the specified Workflow.
@param [String] task_channel The TaskChannel with the Events
to read. Returns
only the Events that pertain to the specified TaskChannel.
@param [String] sid The SID of the Event resource to read. @param [Integer] limit Upper limit for the number of records to return. stream()
guarantees to never return more than limit. Default is no limit.
@param [Integer] page_size Number of records to fetch per request, when
not set will use the default value of 50 records. If no page_size is defined but a limit is defined, stream() will attempt to read the limit with the most efficient page size, i.e. min(limit, 1000)
@return [Enumerable] Enumerable that will yield up to limit results
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb 118 def stream(end_date: :unset, event_type: :unset, minutes: :unset, reservation_sid: :unset, start_date: :unset, task_queue_sid: :unset, task_sid: :unset, worker_sid: :unset, workflow_sid: :unset, task_channel: :unset, sid: :unset, limit: nil, page_size: nil) 119 limits = @version.read_limits(limit, page_size) 120 121 page = self.page( 122 end_date: end_date, 123 event_type: event_type, 124 minutes: minutes, 125 reservation_sid: reservation_sid, 126 start_date: start_date, 127 task_queue_sid: task_queue_sid, 128 task_sid: task_sid, 129 worker_sid: worker_sid, 130 workflow_sid: workflow_sid, 131 task_channel: task_channel, 132 sid: sid, 133 page_size: limits[:page_size], 134 ) 135 136 @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) 137 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb 223 def to_s 224 '#<Twilio.Taskrouter.V1.EventList>' 225 end