Class: Twilio::REST::Api::V2010::AccountContext::ConferenceContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/api/v2010/account/conference.rb,
lib/twilio-ruby/rest/api/v2010/account/conference/recording.rb,
lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb

Defined Under Namespace

Classes: ParticipantContext, ParticipantInstance, ParticipantList, ParticipantPage, RecordingContext, RecordingInstance, RecordingList, RecordingPage

Instance Method Summary collapse

Constructor Details

#initialize(version, account_sid, sid) ⇒ ConferenceContext

Initialize the ConferenceContext

Parameters:

  • version (Version)

    Version that contains the resource

  • account_sid (String)

    The SID of the Account that created the Conference resource(s) to fetch.

  • sid (String)

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


215
216
217
218
219
220
221
222
223
224
225
# File 'lib/twilio-ruby/rest/api/v2010/account/conference.rb', line 215

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

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

  # Dependents
  @participants = nil
  @recordings = nil
end

Instance Method Details

#fetchConferenceInstance

Fetch the ConferenceInstance

Returns:


230
231
232
233
234
235
236
237
238
239
# File 'lib/twilio-ruby/rest/api/v2010/account/conference.rb', line 230

def fetch
  payload = @version.fetch('GET', @uri)

  ConferenceInstance.new(
      @version,
      payload,
      account_sid: @solution[:account_sid],
      sid: @solution[:sid],
  )
end

#inspectObject

Provide a detailed, user friendly representation


322
323
324
325
# File 'lib/twilio-ruby/rest/api/v2010/account/conference.rb', line 322

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

#participants(call_sid = :unset) ⇒ ParticipantList, ParticipantContext

Access the participants

Returns:

Raises:

  • (ArgumentError)

273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# File 'lib/twilio-ruby/rest/api/v2010/account/conference.rb', line 273

def participants(call_sid=:unset)
  raise ArgumentError, 'call_sid cannot be nil' if call_sid.nil?

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

  unless @participants
    @participants = ParticipantList.new(
        @version,
        account_sid: @solution[:account_sid],
        conference_sid: @solution[:sid],
    )
  end

  @participants
end

#recordings(sid = :unset) ⇒ RecordingList, RecordingContext

Access the recordings

Returns:

Raises:

  • (ArgumentError)

295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
# File 'lib/twilio-ruby/rest/api/v2010/account/conference.rb', line 295

def recordings(sid=:unset)
  raise ArgumentError, 'sid cannot be nil' if sid.nil?

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

  unless @recordings
    @recordings = RecordingList.new(
        @version,
        account_sid: @solution[:account_sid],
        conference_sid: @solution[:sid],
    )
  end

  @recordings
end

#to_sObject

Provide a user friendly representation


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

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

#update(status: :unset, announce_url: :unset, announce_method: :unset) ⇒ ConferenceInstance

Update the ConferenceInstance

Parameters:

  • status (conference.UpdateStatus) (defaults to: :unset)

    The new status of the resource. Can be: Can be: `init`, `in-progress`, or `completed`. Specifying `completed` will end the conference and hang up all participants

  • announce_url (String) (defaults to: :unset)

    The URL we should call to announce something into the conference. The URL can return an MP3, a WAV, or a TwiML document with `<Play>` or `<Say>`.

  • announce_method (String) (defaults to: :unset)

    The HTTP method used to call `announce_url`. Can be: `GET` or `POST` and the default is `POST`

Returns:


252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
# File 'lib/twilio-ruby/rest/api/v2010/account/conference.rb', line 252

def update(status: :unset, announce_url: :unset, announce_method: :unset)
  data = Twilio::Values.of({
      'Status' => status,
      'AnnounceUrl' => announce_url,
      'AnnounceMethod' => announce_method,
  })

  payload = @version.update('POST', @uri, data: data)

  ConferenceInstance.new(
      @version,
      payload,
      account_sid: @solution[:account_sid],
      sid: @solution[:sid],
  )
end