Class: Twilio::REST::Api::V2010::AccountContext::CallContext::RecordingContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/api/v2010/account/call/recording.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, account_sid, call_sid, sid) ⇒ RecordingContext

Initialize the RecordingContext

Parameters:

  • version (Version)

    Version that contains the resource

  • account_sid (String)

    The SID of the Account that created the Recording resource to fetch.

  • call_sid (String)

    The Call SID of the resource to fetch.

  • sid (String)

    The Twilio-provided string that uniquely identifies the Recording resource to fetch.


238
239
240
241
242
243
244
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 238

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

  # Path Solution
  @solution = {account_sid: , call_sid: call_sid, sid: sid, }
  @uri = "/Accounts/#{@solution[:account_sid]}/Calls/#{@solution[:call_sid]}/Recordings/#{@solution[:sid]}.json"
end

Instance Method Details

#deleteBoolean

Delete the RecordingInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise


288
289
290
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 288

def delete
   @version.delete('DELETE', @uri)
end

#fetchRecordingInstance

Fetch the RecordingInstance

Returns:


273
274
275
276
277
278
279
280
281
282
283
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 273

def fetch
  payload = @version.fetch('GET', @uri)

  RecordingInstance.new(
      @version,
      payload,
      account_sid: @solution[:account_sid],
      call_sid: @solution[:call_sid],
      sid: @solution[:sid],
  )
end

#inspectObject

Provide a detailed, user friendly representation


301
302
303
304
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 301

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

#to_sObject

Provide a user friendly representation


294
295
296
297
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 294

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

#update(status: nil, pause_behavior: :unset) ⇒ RecordingInstance

Update the RecordingInstance

Parameters:

  • status (recording.Status) (defaults to: nil)

    The new status of the recording. Can be: `stopped`, `paused`, `in-progress`.

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

    Whether to record during a pause. Can be: `skip` or `silence` and the default is `silence`. `skip` does not record during the pause period, while `silence` will replace the actual audio of the call with silence during the pause period. This parameter only applies when setting `status` is set to `paused`.

Returns:


256
257
258
259
260
261
262
263
264
265
266
267
268
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 256

def update(status: nil, pause_behavior: :unset)
  data = Twilio::Values.of({'Status' => status, 'PauseBehavior' => pause_behavior, })

  payload = @version.update('POST', @uri, data: data)

  RecordingInstance.new(
      @version,
      payload,
      account_sid: @solution[:account_sid],
      call_sid: @solution[:call_sid],
      sid: @solution[:sid],
  )
end