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:



292
293
294
295
296
297
298
299
300
301
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 292

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



305
306
307
308
309
310
311
312
313
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 305

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    

    @version.delete('DELETE', @uri, headers: headers)
end

#delete_with_metadataBoolean

Delete the RecordingInstanceMetadata

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 318

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
      response = @version.('DELETE', @uri, headers: headers)
      recording_instance = RecordingInstance.new(
          @version,
          response.body,
          account_sid: @solution[:account_sid],
          sid: @solution[:sid],
      )
      RecordingInstanceMetadata.new(@version, recording_instance, response.headers, response.status_code)
end

#fetchRecordingInstance

Fetch the RecordingInstance

Returns:



337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 337

def fetch

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

#fetch_with_metadataRecordingInstance

Fetch the RecordingInstanceMetadata

Returns:



358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 358

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('GET', @uri, headers: headers)
    recording_instance = RecordingInstance.new(
        @version,
        response.body,
        account_sid: @solution[:account_sid],
        call_sid: @solution[:call_sid],
        sid: @solution[:sid],
    )
    RecordingInstanceMetadata.new(
        @version,
        recording_instance,
        response.headers,
        response.status_code
    )
end

#inspectObject

Provide a detailed, user friendly representation



460
461
462
463
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 460

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

#to_sObject

Provide a user friendly representation



453
454
455
456
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 453

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 (Status) (defaults to: nil)
  • 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:



387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 387

def update(
  status: nil, 
  pause_behavior: :unset
)

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

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

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

Update the RecordingInstanceMetadata

Parameters:

  • status (Status) (defaults to: nil)
  • 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:



418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 418

def (
  status: nil, 
  pause_behavior: :unset
)

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

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('POST', @uri, data: data, headers: headers)
    recording_instance = RecordingInstance.new(
        @version,
        response.body,
        account_sid: @solution[:account_sid],
        call_sid: @solution[:call_sid],
        sid: @solution[:sid],
    )
    RecordingInstanceMetadata.new(
        @version,
        recording_instance,
        response.headers,
        response.status_code
    )
end