Class: Twilio::REST::Taskrouter::V1::WorkspaceContext::ActivityContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/taskrouter/v1/workspace/activity.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, workspace_sid, sid) ⇒ ActivityContext

Initialize the ActivityContext

Parameters:

  • version (Version)

    Version that contains the resource

  • workspace_sid (String)

    The SID of the Workspace with the Activity resources to update.

  • sid (String)

    The SID of the Activity resource to update.



180
181
182
183
184
185
186
187
188
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/activity.rb', line 180

def initialize(version, workspace_sid, sid)
    super(version)

    # Path Solution
    @solution = { workspace_sid: workspace_sid, sid: sid,  }
    @uri = "/Workspaces/#{@solution[:workspace_sid]}/Activities/#{@solution[:sid]}"

    
end

Instance Method Details

#deleteBoolean

Delete the ActivityInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



192
193
194
195
196
197
198
199
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/activity.rb', line 192

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    @version.delete('DELETE', @uri, headers: headers)
end

#fetchActivityInstance

Fetch the ActivityInstance

Returns:



204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/activity.rb', line 204

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    ActivityInstance.new(
        @version,
        payload,
        workspace_sid: @solution[:workspace_sid],
        sid: @solution[:sid],
    )
end

#inspectObject

Provide a detailed, user friendly representation



258
259
260
261
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/activity.rb', line 258

def inspect
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Taskrouter.V1.ActivityContext #{context}>"
end

#to_sObject

Provide a user friendly representation



251
252
253
254
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/activity.rb', line 251

def to_s
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Taskrouter.V1.ActivityContext #{context}>"
end

#update(friendly_name: :unset) ⇒ ActivityInstance

Update the ActivityInstance

Parameters:

  • friendly_name (String) (defaults to: :unset)

    A descriptive string that you create to describe the Activity resource. It can be up to 64 characters long. These names are used to calculate and expose statistics about Workers, and provide visibility into the state of each Worker. Examples of friendly names include: ‘on-call`, `break`, and `email`.

Returns:



225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/activity.rb', line 225

def update(
    friendly_name: :unset
)

    data = Twilio::Values.of({
        'FriendlyName' => friendly_name,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.update('POST', @uri, data: data, headers: headers)
    ActivityInstance.new(
        @version,
        payload,
        workspace_sid: @solution[:workspace_sid],
        sid: @solution[:sid],
    )
end