lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb in twilio-ruby-5.0.0.rc21 vs lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb in twilio-ruby-5.0.0.rc22
- old
+ new
@@ -43,11 +43,11 @@
# @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
- def list(end_date: nil, event_type: nil, minutes: nil, reservation_sid: nil, start_date: nil, task_queue_sid: nil, task_sid: nil, worker_sid: nil, workflow_sid: nil, limit: nil, page_size: nil)
+ 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, limit: nil, page_size: nil)
self.stream(
end_date: end_date,
event_type: event_type,
minutes: minutes,
reservation_sid: reservation_sid,
@@ -79,11 +79,11 @@
# @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
- def stream(end_date: nil, event_type: nil, minutes: nil, reservation_sid: nil, start_date: nil, task_queue_sid: nil, task_sid: nil, worker_sid: nil, workflow_sid: nil, limit: nil, page_size: nil)
+ 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, limit: nil, page_size: nil)
limits = @version.read_limits(limit, page_size)
page = self.page(
end_date: end_date,
event_type: event_type,
@@ -145,12 +145,12 @@
# @param [String] workflow_sid The workflow_sid
# @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
- def page(end_date: nil, event_type: nil, minutes: nil, reservation_sid: nil, start_date: nil, task_queue_sid: nil, task_sid: nil, worker_sid: nil, workflow_sid: nil, page_token: nil, page_number: nil, page_size: nil)
- params = {
+ 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, page_token: :unset, page_number: :unset, page_size: :unset)
+ params = Twilio::Values.of({
'EndDate' => Twilio.serialize_iso8601(end_date),
'EventType' => event_type,
'Minutes' => minutes,
'ReservationSid' => reservation_sid,
'StartDate' => Twilio.serialize_iso8601(start_date),
@@ -159,20 +159,33 @@
'WorkerSid' => worker_sid,
'WorkflowSid' => workflow_sid,
'PageToken' => page_token,
'Page' => page_number,
'PageSize' => page_size,
- }
+ })
response = @version.page(
'GET',
@uri,
params
)
- return EventPage.new(@version, response, @solution)
+ EventPage.new(@version, response, @solution)
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
+ def get_page(target_url)
+ response = @version.domain.request(
+ 'GET',
+ target_url
+ )
+ EventPage.new(@version, response, @solution)
+ end
+
+ ##
# Provide a user friendly representation
def to_s
'#<Twilio.Taskrouter.V1.EventList>'
end
end
@@ -195,11 +208,11 @@
##
# Build an instance of EventInstance
# @param [Hash] payload Payload response from the API
# @return [EventInstance] EventInstance
def get_instance(payload)
- return EventInstance.new(
+ EventInstance.new(
@version,
payload,
workspace_sid: @solution[:workspace_sid],
)
end
@@ -231,18 +244,18 @@
##
# Fetch a EventInstance
# @return [EventInstance] Fetched EventInstance
def fetch
- params = {}
+ params = Twilio::Values.of({})
payload = @version.fetch(
'GET',
@uri,
params,
)
- return EventInstance.new(
+ EventInstance.new(
@version,
payload,
workspace_sid: @solution[:workspace_sid],
sid: @solution[:sid],
)
\ No newline at end of file