lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb in twilio-ruby-5.0.0.rc21 vs lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb in twilio-ruby-5.0.0.rc22

- old
+ new

@@ -37,11 +37,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(friendly_name: nil, evaluate_worker_attributes: nil, worker_sid: nil, limit: nil, page_size: nil) + def list(friendly_name: :unset, evaluate_worker_attributes: :unset, worker_sid: :unset, limit: nil, page_size: nil) self.stream( friendly_name: friendly_name, evaluate_worker_attributes: evaluate_worker_attributes, worker_sid: worker_sid, limit: limit, @@ -61,11 +61,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(friendly_name: nil, evaluate_worker_attributes: nil, worker_sid: nil, limit: nil, page_size: nil) + def stream(friendly_name: :unset, evaluate_worker_attributes: :unset, worker_sid: :unset, limit: nil, page_size: nil) limits = @version.read_limits(limit, page_size) page = self.page( friendly_name: friendly_name, evaluate_worker_attributes: evaluate_worker_attributes, @@ -109,54 +109,67 @@ # @param [String] worker_sid The worker_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 TaskQueueInstance - def page(friendly_name: nil, evaluate_worker_attributes: nil, worker_sid: nil, page_token: nil, page_number: nil, page_size: nil) - params = { + def page(friendly_name: :unset, evaluate_worker_attributes: :unset, worker_sid: :unset, page_token: :unset, page_number: :unset, page_size: :unset) + params = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'EvaluateWorkerAttributes' => evaluate_worker_attributes, 'WorkerSid' => worker_sid, 'PageToken' => page_token, 'Page' => page_number, 'PageSize' => page_size, - } + }) response = @version.page( 'GET', @uri, params ) - return TaskQueuePage.new(@version, response, @solution) + TaskQueuePage.new(@version, response, @solution) end ## # Retrieve a single page of TaskQueueInstance records from the API. # Request is executed immediately. + # @param [String] target_url API-generated URL for the requested results page + # @return [Page] Page of TaskQueueInstance + def get_page(target_url) + response = @version.domain.request( + 'GET', + target_url + ) + TaskQueuePage.new(@version, response, @solution) + end + + ## + # Retrieve a single page of TaskQueueInstance records from the API. + # Request is executed immediately. # @param [String] friendly_name The friendly_name # @param [String] reservation_activity_sid The reservation_activity_sid # @param [String] assignment_activity_sid The assignment_activity_sid # @param [String] target_workers The target_workers # @param [String] max_reserved_workers The max_reserved_workers # @param [task_queue.TaskOrder] task_order The task_order # @return [TaskQueueInstance] Newly created TaskQueueInstance - def create(friendly_name: nil, reservation_activity_sid: nil, assignment_activity_sid: nil, target_workers: nil, max_reserved_workers: nil, task_order: nil) - data = { + def create(friendly_name: nil, reservation_activity_sid: nil, assignment_activity_sid: nil, target_workers: :unset, max_reserved_workers: :unset, task_order: :unset) + data = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'ReservationActivitySid' => reservation_activity_sid, 'AssignmentActivitySid' => assignment_activity_sid, 'TargetWorkers' => target_workers, 'MaxReservedWorkers' => max_reserved_workers, 'TaskOrder' => task_order, - } + }) payload = @version.create( 'POST', @uri, data: data ) - return TaskQueueInstance.new( + TaskQueueInstance.new( @version, payload, workspace_sid: @solution[:workspace_sid], ) end @@ -186,11 +199,11 @@ ## # Build an instance of TaskQueueInstance # @param [Hash] payload Payload response from the API # @return [TaskQueueInstance] TaskQueueInstance def get_instance(payload) - return TaskQueueInstance.new( + TaskQueueInstance.new( @version, payload, workspace_sid: @solution[:workspace_sid], ) end @@ -226,19 +239,19 @@ ## # Fetch a TaskQueueInstance # @return [TaskQueueInstance] Fetched TaskQueueInstance def fetch - params = {} + params = Twilio::Values.of({}) payload = @version.fetch( 'GET', @uri, params, ) - return TaskQueueInstance.new( + TaskQueueInstance.new( @version, payload, workspace_sid: @solution[:workspace_sid], sid: @solution[:sid], ) @@ -251,27 +264,27 @@ # @param [String] reservation_activity_sid The reservation_activity_sid # @param [String] assignment_activity_sid The assignment_activity_sid # @param [String] max_reserved_workers The max_reserved_workers # @param [task_queue.TaskOrder] task_order The task_order # @return [TaskQueueInstance] Updated TaskQueueInstance - def update(friendly_name: nil, target_workers: nil, reservation_activity_sid: nil, assignment_activity_sid: nil, max_reserved_workers: nil, task_order: nil) - data = { + def update(friendly_name: :unset, target_workers: :unset, reservation_activity_sid: :unset, assignment_activity_sid: :unset, max_reserved_workers: :unset, task_order: :unset) + data = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'TargetWorkers' => target_workers, 'ReservationActivitySid' => reservation_activity_sid, 'AssignmentActivitySid' => assignment_activity_sid, 'MaxReservedWorkers' => max_reserved_workers, 'TaskOrder' => task_order, - } + }) payload = @version.update( 'POST', @uri, data: data, ) - return TaskQueueInstance.new( + TaskQueueInstance.new( @version, payload, workspace_sid: @solution[:workspace_sid], sid: @solution[:sid], ) @@ -279,11 +292,11 @@ ## # Deletes the TaskQueueInstance # @return [Boolean] true if delete succeeds, true otherwise def delete - return @version.delete('delete', @uri) + @version.delete('delete', @uri) end ## # Access the task_queues_statistics # @return [TaskQueuesStatisticsList] TaskQueuesStatisticsList @@ -300,11 +313,11 @@ ## # Access the task_queue_statistics # @return [TaskQueueStatisticsList] TaskQueueStatisticsList def task_queue_statistics - return TaskQueueStatisticsContext.new( + TaskQueueStatisticsContext.new( @version, @solution[:workspace_sid], @solution[:sid], ) end @@ -445,10 +458,10 @@ # @param [String] reservation_activity_sid The reservation_activity_sid # @param [String] assignment_activity_sid The assignment_activity_sid # @param [String] max_reserved_workers The max_reserved_workers # @param [task_queue.TaskOrder] task_order The task_order # @return [TaskQueueInstance] Updated TaskQueueInstance - def update(friendly_name: nil, target_workers: nil, reservation_activity_sid: nil, assignment_activity_sid: nil, max_reserved_workers: nil, task_order: nil) + def update(friendly_name: :unset, target_workers: :unset, reservation_activity_sid: :unset, assignment_activity_sid: :unset, max_reserved_workers: :unset, task_order: :unset) context.update( friendly_name: friendly_name, target_workers: target_workers, reservation_activity_sid: reservation_activity_sid, assignment_activity_sid: assignment_activity_sid, \ No newline at end of file