lib/twilio-ruby/rest/autopilot/v1/assistant/task.rb in twilio-ruby-5.38.0 vs lib/twilio-ruby/rest/autopilot/v1/assistant/task.rb in twilio-ruby-5.39.0

- old
+ new

@@ -88,15 +88,13 @@ params = Twilio::Values.of({ 'PageToken' => page_token, 'Page' => page_number, 'PageSize' => page_size, }) - response = @version.page( - 'GET', - @uri, - params - ) + + response = @version.page('GET', @uri, params) + TaskPage.new(@version, response, @solution) end ## # Retrieve a single page of TaskInstance records from the API. @@ -110,36 +108,31 @@ ) TaskPage.new(@version, response, @solution) end ## - # Retrieve a single page of TaskInstance records from the API. - # Request is executed immediately. + # Create the TaskInstance # @param [String] unique_name An application-defined string that uniquely # identifies the new resource. It can be used as an alternative to the `sid` in # the URL path to address the resource. This value must be unique and 64 # characters or less in length. # @param [String] friendly_name A descriptive string that you create to describe # the new resource. It is not unique and can be up to 255 characters long. # @param [Hash] actions The JSON string that specifies the # [actions](https://www.twilio.com/docs/autopilot/actions) that instruct the # Assistant on how to perform the task. It is optional and not unique. # @param [String] actions_url The URL from which the Assistant can fetch actions. - # @return [TaskInstance] Newly created TaskInstance + # @return [TaskInstance] Created TaskInstance def create(unique_name: nil, friendly_name: :unset, actions: :unset, actions_url: :unset) data = Twilio::Values.of({ 'UniqueName' => unique_name, 'FriendlyName' => friendly_name, 'Actions' => Twilio.serialize_object(actions), 'ActionsUrl' => actions_url, }) - payload = @version.create( - 'POST', - @uri, - data: data - ) + payload = @version.create('POST', @uri, data: data) TaskInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid], ) end ## @@ -205,21 +198,15 @@ @task_actions = nil @statistics = nil end ## - # Fetch a TaskInstance + # Fetch the TaskInstance # @return [TaskInstance] Fetched TaskInstance def fetch - params = Twilio::Values.of({}) + payload = @version.fetch('GET', @uri) - payload = @version.fetch( - 'GET', - @uri, - params, - ) - TaskInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid], sid: @solution[:sid], ) end ## # Update the TaskInstance @@ -240,24 +227,20 @@ 'UniqueName' => unique_name, 'Actions' => Twilio.serialize_object(actions), 'ActionsUrl' => actions_url, }) - payload = @version.update( - 'POST', - @uri, - data: data, - ) + payload = @version.update('POST', @uri, data: data) TaskInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid], sid: @solution[:sid], ) end ## - # Deletes the TaskInstance + # Delete the TaskInstance # @return [Boolean] true if delete succeeds, false otherwise def delete - @version.delete('delete', @uri) + @version.delete('DELETE', @uri) end ## # Access the fields # @return [FieldList] @@ -438,11 +421,11 @@ def url @properties['url'] end ## - # Fetch a TaskInstance + # Fetch the TaskInstance # @return [TaskInstance] Fetched TaskInstance def fetch context.fetch end @@ -467,10 +450,10 @@ actions_url: actions_url, ) end ## - # Deletes the TaskInstance + # Delete the TaskInstance # @return [Boolean] true if delete succeeds, false otherwise def delete context.delete end \ No newline at end of file