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 unique id of the [Account](www.twilio.com/docs/iam/api/account) that created this conference

  • conference_sid (String)

    The string that uniquely identifies the conference this participant is in.

  • call_sid (String)

    The Participant’s unique Call SID.



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

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

Deletes the ParticipantInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



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

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

#fetchParticipantInstance

Fetch a ParticipantInstance

Returns:



335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 335

def fetch
  params = Twilio::Values.of({})

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

  ParticipantInstance.new(
      @version,
      payload,
      account_sid: @solution[:account_sid],
      conference_sid: @solution[:conference_sid],
      call_sid: @solution[:call_sid],
  )
end

#to_sObject

Provide a user friendly representation



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

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) ⇒ ParticipantInstance

Update the ParticipantInstance

Parameters:

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

    Specifying ‘true` will mute the participant, while `false` will un-mute. Anything other than `true` or `false` is interpreted as `false`.

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

    Specifying ‘true` will hold the participant, while `false` will remove them from hold.

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

    The ‘HoldUrl’ attribute lets you specify a URL for music that plays when a participant is on hold. The URL may be an MP3, a WAV or a TwiML document that uses ‘<Play>`, `<Say>` or `<Redirect>`.

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

    Specify the HTTP method Twilio should use to request your ‘HoldUrl`, either `GET` or `POST`. Defaults to `GET`.

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

    The ‘AnnounceUrl’ attribute lets you specify a URL for announcing something to the participant. The URL may return an MP3, a WAV or a TwiML document with ‘<Play>` or `<Say>`.

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

    Specify the HTTP method Twilio should use to request your ‘AnnounceUrl`, either `GET` or `POST`. Defaults to `POST`.

Returns:



371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 371

def update(muted: :unset, hold: :unset, hold_url: :unset, hold_method: :unset, announce_url: :unset, announce_method: :unset)
  data = Twilio::Values.of({
      'Muted' => muted,
      'Hold' => hold,
      'HoldUrl' => hold_url,
      'HoldMethod' => hold_method,
      'AnnounceUrl' => announce_url,
      'AnnounceMethod' => announce_method,
  })

  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