Class: Twilio::REST::Taskrouter::V1::WorkspaceContext::EventList
- Inherits:
-
ListResource
- Object
- ListResource
- Twilio::REST::Taskrouter::V1::WorkspaceContext::EventList
- Defined in:
- lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb
Instance Method Summary collapse
-
#each ⇒ Object
When passed a block, yields EventInstance records from the API.
-
#get_page(target_url) ⇒ Page
Retrieve a single page of EventInstance records from the API.
-
#initialize(version, workspace_sid: nil) ⇒ EventList
constructor
Initialize the EventList.
-
#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) ⇒ Array
Lists EventInstance records from the API as a list.
-
#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) ⇒ Page
Retrieve a single page of EventInstance records from the API.
-
#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) ⇒ Enumerable
Streams Instance records from the API as an Enumerable.
-
#to_s ⇒ Object
Provide a user friendly representation.
Constructor Details
#initialize(version, workspace_sid: nil) ⇒ EventList
Initialize the EventList
27 28 29 30 31 32 33 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 27 def initialize(version, workspace_sid: nil) super(version) # Path Solution @solution = { workspace_sid: workspace_sid } @uri = "/Workspaces/#{@solution[:workspace_sid]}/Events" end |
Instance Method Details
#each ⇒ Object
When passed a block, yields EventInstance records from the API. This operation lazily loads records as efficiently as possible until the limit is reached.
121 122 123 124 125 126 127 128 129 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 121 def each limits = @version.read_limits page = self.page(page_size: limits[:page_size], ) @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]).each {|x| yield x} end |
#get_page(target_url) ⇒ Page
Retrieve a single page of EventInstance records from the API. Request is executed immediately.
177 178 179 180 181 182 183 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 177 def get_page(target_url) response = @version.domain.request( 'GET', target_url ) EventPage.new(@version, response, @solution) end |
#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) ⇒ Array
Lists EventInstance records from the API as a list. Unlike stream(), this operation is eager and will load ‘limit` records into memory before returning.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 57 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) self.stream( end_date: end_date, event_type: event_type, minutes: minutes, reservation_sid: reservation_sid, start_date: start_date, task_queue_sid: task_queue_sid, task_sid: task_sid, worker_sid: worker_sid, workflow_sid: workflow_sid, task_channel: task_channel, sid: sid, limit: limit, page_size: page_size ).entries end |
#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) ⇒ Page
Retrieve a single page of EventInstance records from the API. Request is executed immediately.
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 149 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) params = Twilio::Values.of({ 'EndDate' => Twilio.serialize_iso8601_datetime(end_date), 'EventType' => event_type, 'Minutes' => minutes, 'ReservationSid' => reservation_sid, 'StartDate' => Twilio.serialize_iso8601_datetime(start_date), 'TaskQueueSid' => task_queue_sid, 'TaskSid' => task_sid, 'WorkerSid' => worker_sid, 'WorkflowSid' => workflow_sid, 'TaskChannel' => task_channel, 'Sid' => sid, 'PageToken' => page_token, 'Page' => page_number, 'PageSize' => page_size, }) response = @version.page('GET', @uri, params: params) EventPage.new(@version, response, @solution) end |
#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) ⇒ Enumerable
Streams Instance records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached.
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 97 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) limits = @version.read_limits(limit, page_size) page = self.page( end_date: end_date, event_type: event_type, minutes: minutes, reservation_sid: reservation_sid, start_date: start_date, task_queue_sid: task_queue_sid, task_sid: task_sid, worker_sid: worker_sid, workflow_sid: workflow_sid, task_channel: task_channel, sid: sid, page_size: limits[:page_size], ) @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) end |
#to_s ⇒ Object
Provide a user friendly representation
188 189 190 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 188 def to_s '#<Twilio.Taskrouter.V1.EventList>' end |