Class: Twilio::REST::Api::V2010::AccountContext::TranscriptionInstance

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

Instance Method Summary collapse

Constructor Details

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

Initialize the TranscriptionInstance

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 the Transcription resource.

  • sid (String) (defaults to: nil)

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


211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# File 'lib/twilio-ruby/rest/api/v2010/account/transcription.rb', line 211

def initialize(version, payload, account_sid: nil, sid: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'account_sid' => payload['account_sid'],
      'api_version' => payload['api_version'],
      'date_created' => Twilio.deserialize_rfc2822(payload['date_created']),
      'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']),
      'duration' => payload['duration'],
      'price' => payload['price'].to_f,
      'price_unit' => payload['price_unit'],
      'recording_sid' => payload['recording_sid'],
      'sid' => payload['sid'],
      'status' => payload['status'],
      'transcription_text' => payload['transcription_text'],
      'type' => payload['type'],
      'uri' => payload['uri'],
  }

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

Instance Method Details

#account_sidString

Returns The SID of the Account that created the resource.

Returns:

  • (String)

    The SID of the Account that created the resource


249
250
251
# File 'lib/twilio-ruby/rest/api/v2010/account/transcription.rb', line 249

def 
  @properties['account_sid']
end

#api_versionString

Returns The API version used to create the transcription.

Returns:

  • (String)

    The API version used to create the transcription


255
256
257
# File 'lib/twilio-ruby/rest/api/v2010/account/transcription.rb', line 255

def api_version
  @properties['api_version']
end

#contextTranscriptionContext

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

Returns:


240
241
242
243
244
245
# File 'lib/twilio-ruby/rest/api/v2010/account/transcription.rb', line 240

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

#date_createdTime

Returns The RFC 2822 date and time in GMT that the resource was created.

Returns:

  • (Time)

    The RFC 2822 date and time in GMT that the resource was created


261
262
263
# File 'lib/twilio-ruby/rest/api/v2010/account/transcription.rb', line 261

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The RFC 2822 date and time in GMT that the resource was last updated.

Returns:

  • (Time)

    The RFC 2822 date and time in GMT that the resource was last updated


267
268
269
# File 'lib/twilio-ruby/rest/api/v2010/account/transcription.rb', line 267

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Delete the TranscriptionInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise


335
336
337
# File 'lib/twilio-ruby/rest/api/v2010/account/transcription.rb', line 335

def delete
  context.delete
end

#durationString

Returns The duration of the transcribed audio in seconds.

Returns:

  • (String)

    The duration of the transcribed audio in seconds.


273
274
275
# File 'lib/twilio-ruby/rest/api/v2010/account/transcription.rb', line 273

def duration
  @properties['duration']
end

#fetchTranscriptionInstance

Fetch the TranscriptionInstance

Returns:


328
329
330
# File 'lib/twilio-ruby/rest/api/v2010/account/transcription.rb', line 328

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation


348
349
350
351
# File 'lib/twilio-ruby/rest/api/v2010/account/transcription.rb', line 348

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

#priceString

Returns The charge for the transcription.

Returns:

  • (String)

    The charge for the transcription


279
280
281
# File 'lib/twilio-ruby/rest/api/v2010/account/transcription.rb', line 279

def price
  @properties['price']
end

#price_unitString

Returns The currency in which price is measured.

Returns:

  • (String)

    The currency in which price is measured


285
286
287
# File 'lib/twilio-ruby/rest/api/v2010/account/transcription.rb', line 285

def price_unit
  @properties['price_unit']
end

#recording_sidString

Returns The SID that identifies the transcription's recording.

Returns:

  • (String)

    The SID that identifies the transcription's recording


291
292
293
# File 'lib/twilio-ruby/rest/api/v2010/account/transcription.rb', line 291

def recording_sid
  @properties['recording_sid']
end

#sidString

Returns The unique string that identifies the resource.

Returns:

  • (String)

    The unique string that identifies the resource


297
298
299
# File 'lib/twilio-ruby/rest/api/v2010/account/transcription.rb', line 297

def sid
  @properties['sid']
end

#statustranscription.Status

Returns The status of the transcription.

Returns:

  • (transcription.Status)

    The status of the transcription


303
304
305
# File 'lib/twilio-ruby/rest/api/v2010/account/transcription.rb', line 303

def status
  @properties['status']
end

#to_sObject

Provide a user friendly representation


341
342
343
344
# File 'lib/twilio-ruby/rest/api/v2010/account/transcription.rb', line 341

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

#transcription_textString

Returns The text content of the transcription.

Returns:

  • (String)

    The text content of the transcription.


309
310
311
# File 'lib/twilio-ruby/rest/api/v2010/account/transcription.rb', line 309

def transcription_text
  @properties['transcription_text']
end

#typeString

Returns The transcription type.

Returns:

  • (String)

    The transcription type


315
316
317
# File 'lib/twilio-ruby/rest/api/v2010/account/transcription.rb', line 315

def type
  @properties['type']
end

#uriString

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

Returns:


321
322
323
# File 'lib/twilio-ruby/rest/api/v2010/account/transcription.rb', line 321

def uri
  @properties['uri']
end