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

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/api/v2010/account/recording.rb,
lib/twilio-ruby/rest/api/v2010/account/recording/add_on_result.rb,
lib/twilio-ruby/rest/api/v2010/account/recording/transcription.rb,
lib/twilio-ruby/rest/api/v2010/account/recording/add_on_result/payload.rb,
lib/twilio-ruby/rest/api/v2010/account/recording/add_on_result/payload/data.rb

Defined Under Namespace

Classes: AddOnResultContext, AddOnResultInstance, AddOnResultList, AddOnResultPage, TranscriptionContext, TranscriptionInstance, TranscriptionList, TranscriptionPage

Instance Method Summary collapse

Constructor Details

#initialize(version, account_sid, sid) ⇒ RecordingContext

Initialize the RecordingContext

Parameters:

  • version (Version)

    Version that contains the resource

  • account_sid (String)

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

  • sid (String)

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



175
176
177
178
179
180
181
182
183
184
185
# File 'lib/twilio-ruby/rest/api/v2010/account/recording.rb', line 175

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

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

    # Dependents
    @add_on_results = nil
    @transcriptions = nil
end

Instance Method Details

#add_on_results(sid = :unset) ⇒ AddOnResultList, AddOnResultContext

Access the add_on_results

Returns:

Raises:

  • (ArgumentError)


228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# File 'lib/twilio-ruby/rest/api/v2010/account/recording.rb', line 228

def add_on_results(sid=:unset)

    raise ArgumentError, 'sid cannot be nil' if sid.nil?

    if sid != :unset
        return AddOnResultContext.new(@version, @solution[:account_sid], @solution[:sid],sid )
    end

    unless @add_on_results
        @add_on_results = AddOnResultList.new(
            @version, account_sid: @solution[:account_sid], reference_sid: @solution[:sid], )
    end

 @add_on_results
end

#deleteBoolean

Delete the RecordingInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



189
190
191
192
193
194
195
196
# File 'lib/twilio-ruby/rest/api/v2010/account/recording.rb', line 189

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    @version.delete('DELETE', @uri, headers: headers)
end

#fetch(include_soft_deleted: :unset) ⇒ RecordingInstance

Fetch the RecordingInstance

Parameters:

  • include_soft_deleted (Boolean) (defaults to: :unset)

    A boolean parameter indicating whether to retrieve soft deleted recordings or not. Recordings metadata are kept after deletion for a retention period of 40 days.

Returns:



202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
# File 'lib/twilio-ruby/rest/api/v2010/account/recording.rb', line 202

def fetch(
    include_soft_deleted: :unset
)

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

#inspectObject

Provide a detailed, user friendly representation



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

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

#to_sObject

Provide a user friendly representation



265
266
267
268
# File 'lib/twilio-ruby/rest/api/v2010/account/recording.rb', line 265

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

#transcriptions(sid = :unset) ⇒ TranscriptionList, TranscriptionContext

Access the transcriptions

Returns:

Raises:

  • (ArgumentError)


247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
# File 'lib/twilio-ruby/rest/api/v2010/account/recording.rb', line 247

def transcriptions(sid=:unset)

    raise ArgumentError, 'sid cannot be nil' if sid.nil?

    if sid != :unset
        return TranscriptionContext.new(@version, @solution[:account_sid], @solution[:sid],sid )
    end

    unless @transcriptions
        @transcriptions = TranscriptionList.new(
            @version, account_sid: @solution[:account_sid], recording_sid: @solution[:sid], )
    end

 @transcriptions
end