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

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

Instance Method Summary collapse

Constructor Details

#initialize(version, account_sid, conference_sid, call_sid) ⇒ ParticipantContext

Initialize the ParticipantContext

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 Participant resources to update.

  • conference_sid (String)

    The SID of the conference with the participant to update.

  • call_sid (String)

    The [Call](www.twilio.com/docs/voice/api/call-resource) SID or label of the participant to update. Non URL safe characters in a label must be percent encoded, for example, a space character is represented as %20.



314
315
316
317
318
319
320
321
322
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 314

def initialize(version, , conference_sid, call_sid)
    super(version)

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

    
end

Instance Method Details

#deleteBoolean

Delete the ParticipantInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



326
327
328
329
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 326

def delete

    @version.delete('DELETE', @uri)
end

#fetchParticipantInstance

Fetch the ParticipantInstance

Returns:



334
335
336
337
338
339
340
341
342
343
344
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 334

def fetch

    payload = @version.fetch('GET', @uri)
    ParticipantInstance.new(
        @version,
        payload,
        account_sid: @solution[:account_sid],
        conference_sid: @solution[:conference_sid],
        call_sid: @solution[:call_sid],
    )
end

#inspectObject

Provide a detailed, user friendly representation



411
412
413
414
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 411

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

#to_sObject

Provide a user friendly representation



404
405
406
407
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 404

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

#update(muted: :unset, hold: :unset, hold_url: :unset, hold_method: :unset, announce_url: :unset, announce_method: :unset, wait_url: :unset, wait_method: :unset, beep_on_exit: :unset, end_conference_on_exit: :unset, coaching: :unset, call_sid_to_coach: :unset) ⇒ ParticipantInstance

Update the ParticipantInstance

Parameters:

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

    Whether the participant should be muted. Can be ‘true` or `false`. `true` will mute the participant, and `false` will un-mute them. Anything value other than `true` or `false` is interpreted as `false`.

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

    Whether the participant should be on hold. Can be: ‘true` or `false`. `true` puts the participant on hold, and `false` lets them rejoin the conference.

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

    The URL we call using the ‘hold_method` for music that plays when the participant is on hold. The URL may return an MP3 file, a WAV file, or a TwiML document that contains `<Play>`, `<Say>`, `<Pause>`, or `<Redirect>` verbs.

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

    The HTTP method we should use to call ‘hold_url`. Can be: `GET` or `POST` and the default is `GET`.

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

    The URL we call using the ‘announce_method` for an announcement to the participant. The URL may return an MP3 file, a WAV file, or a TwiML document that contains `<Play>`, `<Say>`, `<Pause>`, or `<Redirect>` verbs.

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

    The HTTP method we should use to call ‘announce_url`. Can be: `GET` or `POST` and defaults to `POST`.

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

    The URL we call using the ‘wait_method` for the music to play while participants are waiting for the conference to start. The URL may return an MP3 file, a WAV file, or a TwiML document that contains `<Play>`, `<Say>`, `<Pause>`, or `<Redirect>` verbs. The default value is the URL of our standard hold music. [Learn more about hold music](www.twilio.com/labs/twimlets/holdmusic).

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

    The HTTP method we should use to call ‘wait_url`. Can be `GET` or `POST` and the default is `POST`. When using a static audio file, this should be `GET` so that we can cache the file.

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

    Whether to play a notification beep to the conference when the participant exits. Can be: ‘true` or `false`.

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

    Whether to end the conference when the participant leaves. Can be: ‘true` or `false` and defaults to `false`.

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

    Whether the participant is coaching another call. Can be: ‘true` or `false`. If not present, defaults to `false` unless `call_sid_to_coach` is defined. If `true`, `call_sid_to_coach` must be defined.

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

    The SID of the participant who is being ‘coached`. The participant being coached is the only participant who can hear the participant who is `coaching`.

Returns:



361
362
363
364
365
366
367
368
369
370
371
372
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
398
399
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 361

def update(
    muted: :unset, 
    hold: :unset, 
    hold_url: :unset, 
    hold_method: :unset, 
    announce_url: :unset, 
    announce_method: :unset, 
    wait_url: :unset, 
    wait_method: :unset, 
    beep_on_exit: :unset, 
    end_conference_on_exit: :unset, 
    coaching: :unset, 
    call_sid_to_coach: :unset
)

    data = Twilio::Values.of({
        'Muted' => muted,
        'Hold' => hold,
        'HoldUrl' => hold_url,
        'HoldMethod' => hold_method,
        'AnnounceUrl' => announce_url,
        'AnnounceMethod' => announce_method,
        'WaitUrl' => wait_url,
        'WaitMethod' => wait_method,
        'BeepOnExit' => beep_on_exit,
        'EndConferenceOnExit' => end_conference_on_exit,
        'Coaching' => coaching,
        'CallSidToCoach' => call_sid_to_coach,
    })

    payload = @version.update('POST', @uri, data: data)
    ParticipantInstance.new(
        @version,
        payload,
        account_sid: @solution[:account_sid],
        conference_sid: @solution[:conference_sid],
        call_sid: @solution[:call_sid],
    )
end