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.



542
543
544
545
546
547
548
549
550
551
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 542

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



555
556
557
558
559
560
561
562
563
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 555

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    

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

#delete_with_metadataBoolean

Delete the ParticipantInstanceMetadata

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 568

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
      response = @version.('DELETE', @uri, headers: headers)
      participant_instance = ParticipantInstance.new(
          @version,
          response.body,
          account_sid: @solution[:account_sid],
          sid: @solution[:sid],
      )
      ParticipantInstanceMetadata.new(@version, participant_instance, response.headers, response.status_code)
end

#fetchParticipantInstance

Fetch the ParticipantInstance

Returns:



587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 587

def fetch

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

#fetch_with_metadataParticipantInstance

Fetch the ParticipantInstanceMetadata

Returns:



608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 608

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('GET', @uri, headers: headers)
    participant_instance = ParticipantInstance.new(
        @version,
        response.body,
        account_sid: @solution[:account_sid],
        conference_sid: @solution[:conference_sid],
        call_sid: @solution[:call_sid],
    )
    ParticipantInstanceMetadata.new(
        @version,
        participant_instance,
        response.headers,
        response.status_code
    )
end

#inspectObject

Provide a detailed, user friendly representation



770
771
772
773
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 770

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

#to_sObject

Provide a user friendly representation



763
764
765
766
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 763

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 that Twilio calls using the ‘wait_method` before the conference has started. The URL may return an MP3 file, a WAV file, or a TwiML document. The default value is the URL of our standard hold music. If you do not want anything to play while waiting for the conference to start, specify an empty string by setting `wait_url` to `”`. For more details on the allowable verbs within the `waitUrl`, see the `waitUrl` attribute in the [<Conference> TwiML instruction](www.twilio.com/docs/voice/twiml/conference#attributes-waiturl).

  • 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:



647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 647

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,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.update('POST', @uri, data: data, headers: headers)
    ParticipantInstance.new(
        @version,
        payload,
        account_sid: @solution[:account_sid],
        conference_sid: @solution[:conference_sid],
        call_sid: @solution[:call_sid],
    )
end

#update_with_metadata(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 ParticipantInstanceMetadata

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 that Twilio calls using the ‘wait_method` before the conference has started. The URL may return an MP3 file, a WAV file, or a TwiML document. The default value is the URL of our standard hold music. If you do not want anything to play while waiting for the conference to start, specify an empty string by setting `wait_url` to `”`. For more details on the allowable verbs within the `waitUrl`, see the `waitUrl` attribute in the [<Conference> TwiML instruction](www.twilio.com/docs/voice/twiml/conference#attributes-waiturl).

  • 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:



708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 708

def (
  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,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('POST', @uri, data: data, headers: headers)
    participant_instance = ParticipantInstance.new(
        @version,
        response.body,
        account_sid: @solution[:account_sid],
        conference_sid: @solution[:conference_sid],
        call_sid: @solution[:call_sid],
    )
    ParticipantInstanceMetadata.new(
        @version,
        participant_instance,
        response.headers,
        response.status_code
    )
end