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:



278
279
280
281
282
283
284
285
286
287
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 278

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



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

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



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

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:



323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 323

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:



344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 344

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



446
447
448
449
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 446

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

#to_sObject

Provide a user friendly representation



439
440
441
442
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 439

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:



373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 373

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:



404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 404

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