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

- old
+ new

@@ -35,11 +35,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, limit: nil, page_size: nil) + def list(friendly_name: :unset, limit: nil, page_size: nil) self.stream( friendly_name: friendly_name, limit: limit, page_size: page_size ).entries @@ -55,11 +55,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, limit: nil, page_size: nil) + def stream(friendly_name: :unset, limit: nil, page_size: nil) limits = @version.read_limits(limit, page_size) page = self.page( friendly_name: friendly_name, page_size: limits[:page_size], @@ -97,51 +97,64 @@ # @param [String] friendly_name The friendly_name # @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 WorkflowInstance - def page(friendly_name: nil, page_token: nil, page_number: nil, page_size: nil) - params = { + def page(friendly_name: :unset, page_token: :unset, page_number: :unset, page_size: :unset) + params = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'PageToken' => page_token, 'Page' => page_number, 'PageSize' => page_size, - } + }) response = @version.page( 'GET', @uri, params ) - return WorkflowPage.new(@version, response, @solution) + WorkflowPage.new(@version, response, @solution) end ## # Retrieve a single page of WorkflowInstance records from the API. # Request is executed immediately. + # @param [String] target_url API-generated URL for the requested results page + # @return [Page] Page of WorkflowInstance + def get_page(target_url) + response = @version.domain.request( + 'GET', + target_url + ) + WorkflowPage.new(@version, response, @solution) + end + + ## + # Retrieve a single page of WorkflowInstance records from the API. + # Request is executed immediately. # @param [String] friendly_name The friendly_name # @param [String] configuration The configuration # @param [String] assignment_callback_url The assignment_callback_url # @param [String] fallback_assignment_callback_url The # fallback_assignment_callback_url # @param [String] task_reservation_timeout The task_reservation_timeout # @return [WorkflowInstance] Newly created WorkflowInstance - def create(friendly_name: nil, configuration: nil, assignment_callback_url: nil, fallback_assignment_callback_url: nil, task_reservation_timeout: nil) - data = { + def create(friendly_name: nil, configuration: nil, assignment_callback_url: :unset, fallback_assignment_callback_url: :unset, task_reservation_timeout: :unset) + data = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'Configuration' => configuration, 'AssignmentCallbackUrl' => assignment_callback_url, 'FallbackAssignmentCallbackUrl' => fallback_assignment_callback_url, 'TaskReservationTimeout' => task_reservation_timeout, - } + }) payload = @version.create( 'POST', @uri, data: data ) - return WorkflowInstance.new( + WorkflowInstance.new( @version, payload, workspace_sid: @solution[:workspace_sid], ) end @@ -171,11 +184,11 @@ ## # Build an instance of WorkflowInstance # @param [Hash] payload Payload response from the API # @return [WorkflowInstance] WorkflowInstance def get_instance(payload) - return WorkflowInstance.new( + WorkflowInstance.new( @version, payload, workspace_sid: @solution[:workspace_sid], ) end @@ -210,19 +223,19 @@ ## # Fetch a WorkflowInstance # @return [WorkflowInstance] Fetched WorkflowInstance def fetch - params = {} + params = Twilio::Values.of({}) payload = @version.fetch( 'GET', @uri, params, ) - return WorkflowInstance.new( + WorkflowInstance.new( @version, payload, workspace_sid: @solution[:workspace_sid], sid: @solution[:sid], ) @@ -235,26 +248,26 @@ # @param [String] fallback_assignment_callback_url The # fallback_assignment_callback_url # @param [String] configuration The configuration # @param [String] task_reservation_timeout The task_reservation_timeout # @return [WorkflowInstance] Updated WorkflowInstance - def update(friendly_name: nil, assignment_callback_url: nil, fallback_assignment_callback_url: nil, configuration: nil, task_reservation_timeout: nil) - data = { + def update(friendly_name: :unset, assignment_callback_url: :unset, fallback_assignment_callback_url: :unset, configuration: :unset, task_reservation_timeout: :unset) + data = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'AssignmentCallbackUrl' => assignment_callback_url, 'FallbackAssignmentCallbackUrl' => fallback_assignment_callback_url, 'Configuration' => configuration, 'TaskReservationTimeout' => task_reservation_timeout, - } + }) payload = @version.update( 'POST', @uri, data: data, ) - return WorkflowInstance.new( + WorkflowInstance.new( @version, payload, workspace_sid: @solution[:workspace_sid], sid: @solution[:sid], ) @@ -262,18 +275,18 @@ ## # Deletes the WorkflowInstance # @return [Boolean] true if delete succeeds, true otherwise def delete - return @version.delete('delete', @uri) + @version.delete('delete', @uri) end ## # Access the statistics # @return [WorkflowStatisticsList] WorkflowStatisticsList def statistics - return WorkflowStatisticsContext.new( + WorkflowStatisticsContext.new( @version, @solution[:workspace_sid], @solution[:sid], ) end @@ -404,10 +417,10 @@ # @param [String] fallback_assignment_callback_url The # fallback_assignment_callback_url # @param [String] configuration The configuration # @param [String] task_reservation_timeout The task_reservation_timeout # @return [WorkflowInstance] Updated WorkflowInstance - def update(friendly_name: nil, assignment_callback_url: nil, fallback_assignment_callback_url: nil, configuration: nil, task_reservation_timeout: nil) + def update(friendly_name: :unset, assignment_callback_url: :unset, fallback_assignment_callback_url: :unset, configuration: :unset, task_reservation_timeout: :unset) context.update( friendly_name: friendly_name, assignment_callback_url: assignment_callback_url, fallback_assignment_callback_url: fallback_assignment_callback_url, configuration: configuration, \ No newline at end of file