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

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, account_sid: nil, call_sid: nil, sid: nil) ⇒ RecordingInstance

Initialize the RecordingInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String) (defaults to: nil)

    The SID of the Account that created this Recording resource.

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 302

def initialize(version, payload , account_sid: nil, call_sid: nil, sid: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'account_sid' => payload['account_sid'],
        'api_version' => payload['api_version'],
        'call_sid' => payload['call_sid'],
        'conference_sid' => payload['conference_sid'],
        'date_created' => Twilio.deserialize_rfc2822(payload['date_created']),
        'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']),
        'start_time' => Twilio.deserialize_rfc2822(payload['start_time']),
        'duration' => payload['duration'],
        'sid' => payload['sid'],
        'price' => payload['price'],
        'uri' => payload['uri'],
        'encryption_details' => payload['encryption_details'],
        'price_unit' => payload['price_unit'],
        'status' => payload['status'],
        'channels' => payload['channels'] == nil ? payload['channels'] : payload['channels'].to_i,
        'source' => payload['source'],
        'error_code' => payload['error_code'] == nil ? payload['error_code'] : payload['error_code'].to_i,
        'track' => payload['track'],
    }

    # Context
    @instance_context = nil
    @params = { 'account_sid' =>   ,'call_sid' => call_sid  || @properties['call_sid']  ,'sid' => sid  || @properties['sid']  , }
end

Instance Method Details

#account_sidString

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

Returns:



345
346
347
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 345

def 
    @properties['account_sid']
end

#api_versionString

Returns The API version used to make the recording.

Returns:

  • (String)

    The API version used to make the recording.



351
352
353
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 351

def api_version
    @properties['api_version']
end

#call_sidString

Returns The SID of the [Call](www.twilio.com/docs/voice/api/call-resource) the Recording resource is associated with.

Returns:



357
358
359
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 357

def call_sid
    @properties['call_sid']
end

#channelsString

Returns The number of channels in the final recording file. Can be: ‘1`, or `2`. Separating a two leg call into two separate channels of the recording file is supported in [Dial](www.twilio.com/docs/voice/twiml/dial#attributes-record) and [Outbound Rest API](www.twilio.com/docs/voice/make-calls) record options.

Returns:



429
430
431
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 429

def channels
    @properties['channels']
end

#conference_sidString

Returns The Conference SID that identifies the conference associated with the recording, if a conference recording.

Returns:

  • (String)

    The Conference SID that identifies the conference associated with the recording, if a conference recording.



363
364
365
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 363

def conference_sid
    @properties['conference_sid']
end

#contextRecordingContext

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

Returns:



336
337
338
339
340
341
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 336

def context
    unless @instance_context
        @instance_context = RecordingContext.new(@version , @params['account_sid'], @params['call_sid'], @params['sid'])
    end
    @instance_context
end

#date_createdTime

Returns The date and time in GMT that the resource was created specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.

Returns:



369
370
371
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 369

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns The date and time in GMT that the resource was last updated, specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.

Returns:



375
376
377
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 375

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the RecordingInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



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

def delete

    context.delete
end

#durationString

Returns The length of the recording in seconds.

Returns:

  • (String)

    The length of the recording in seconds.



387
388
389
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 387

def duration
    @properties['duration']
end

#encryption_detailsHash

Returns How to decrypt the recording if it was encrypted using [Call Recording Encryption](www.twilio.com/docs/voice/tutorials/voice-recording-encryption) feature.

Returns:



411
412
413
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 411

def encryption_details
    @properties['encryption_details']
end

#error_codeString

Returns The error code that describes why the recording is ‘absent`. The error code is described in our [Error Dictionary](www.twilio.com/docs/api/errors). This value is null if the recording `status` is not `absent`.

Returns:

  • (String)

    The error code that describes why the recording is ‘absent`. The error code is described in our [Error Dictionary](www.twilio.com/docs/api/errors). This value is null if the recording `status` is not `absent`.



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

def error_code
    @properties['error_code']
end

#fetchRecordingInstance

Fetch the RecordingInstance

Returns:



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

def fetch

    context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



492
493
494
495
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 492

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

#priceFloat

Returns The one-time cost of creating the recording in the ‘price_unit` currency.

Returns:

  • (Float)

    The one-time cost of creating the recording in the ‘price_unit` currency.



399
400
401
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 399

def price
    @properties['price']
end

#price_unitString

Returns The currency used in the ‘price` property. Example: `USD`.

Returns:

  • (String)

    The currency used in the ‘price` property. Example: `USD`.



417
418
419
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 417

def price_unit
    @properties['price_unit']
end

#sidString

Returns The unique string that that we created to identify the Recording resource.

Returns:

  • (String)

    The unique string that that we created to identify the Recording resource.



393
394
395
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 393

def sid
    @properties['sid']
end

#sourceSource

Returns:

  • (Source)


435
436
437
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 435

def source
    @properties['source']
end

#start_timeTime

Returns The start time of the recording in GMT and in [RFC 2822](www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format.

Returns:



381
382
383
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 381

def start_time
    @properties['start_time']
end

#statusStatus

Returns:

  • (Status)


423
424
425
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 423

def status
    @properties['status']
end

#to_sObject

Provide a user friendly representation



485
486
487
488
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 485

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

#trackString

Returns The recorded track. Can be: ‘inbound`, `outbound`, or `both`.

Returns:

  • (String)

    The recorded track. Can be: ‘inbound`, `outbound`, or `both`.



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

def track
    @properties['track']
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:



472
473
474
475
476
477
478
479
480
481
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 472

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

    context.update(
        status: status, 
        pause_behavior: pause_behavior, 
    )
end

#uriString

Returns The URI of the resource, relative to ‘api.twilio.com`.

Returns:

  • (String)

    The URI of the resource, relative to ‘api.twilio.com`.



405
406
407
# File 'lib/twilio-ruby/rest/api/v2010/account/call/recording.rb', line 405

def uri
    @properties['uri']
end