Class: Twilio::REST::Autopilot::V1::AssistantContext::TaskContext::TaskActionsInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_actions.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, assistant_sid: nil, task_sid: nil) ⇒ TaskActionsInstance

Initialize the TaskActionsInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String)

    The SID of the Account that created this TaskActions resource.

  • sid (String)

    The SID of the Call resource to fetch.



152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_actions.rb', line 152

def initialize(version, payload , assistant_sid: nil, task_sid: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'account_sid' => payload['account_sid'],
        'assistant_sid' => payload['assistant_sid'],
        'task_sid' => payload['task_sid'],
        'url' => payload['url'],
        'data' => payload['data'],
    }

    # Context
    @instance_context = nil
    @params = { 'assistant_sid' => assistant_sid  || @properties['assistant_sid']  ,'task_sid' => task_sid  || @properties['task_sid']  , }
end

Instance Method Details

#account_sidString

Returns The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the TaskActions resource.

Returns:



182
183
184
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_actions.rb', line 182

def 
    @properties['account_sid']
end

#assistant_sidString

Returns The SID of the [Assistant](www.twilio.com/docs/autopilot/api/assistant) that is the parent of the Task associated with the resource.

Returns:



188
189
190
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_actions.rb', line 188

def assistant_sid
    @properties['assistant_sid']
end

#contextTaskActionsContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



173
174
175
176
177
178
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_actions.rb', line 173

def context
    unless @instance_context
        @instance_context = TaskActionsContext.new(@version , @params['assistant_sid'], @params['task_sid'])
    end
    @instance_context
end

#dataHash

Returns The JSON string that specifies the [actions](www.twilio.com/docs/autopilot/actions) that instruct the Assistant on how to perform the task.

Returns:



206
207
208
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_actions.rb', line 206

def data
    @properties['data']
end

#fetchTaskActionsInstance

Fetch the TaskActionsInstance

Returns:



213
214
215
216
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_actions.rb', line 213

def fetch

    context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



240
241
242
243
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_actions.rb', line 240

def inspect
    values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Autopilot.V1.TaskActionsInstance #{values}>"
end

#task_sidString

Returns The SID of the [Task](www.twilio.com/docs/autopilot/api/task) associated with the resource.

Returns:



194
195
196
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_actions.rb', line 194

def task_sid
    @properties['task_sid']
end

#to_sObject

Provide a user friendly representation



233
234
235
236
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_actions.rb', line 233

def to_s
    values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Autopilot.V1.TaskActionsInstance #{values}>"
end

#update(actions: :unset) ⇒ TaskActionsInstance

Update the TaskActionsInstance

Parameters:

Returns:



222
223
224
225
226
227
228
229
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_actions.rb', line 222

def update(
    actions: :unset
)

    context.update(
        actions: actions, 
    )
end

#urlString

Returns The absolute URL of the TaskActions resource.

Returns:

  • (String)

    The absolute URL of the TaskActions resource.



200
201
202
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_actions.rb', line 200

def url
    @properties['url']
end