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 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 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.



610
611
612
613
614
615
616
617
618
619
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 610

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



623
624
625
626
627
628
629
630
631
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 623

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



636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 636

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:



655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 655

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:



676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 676

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



838
839
840
841
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 838

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

#to_sObject

Provide a user friendly representation



831
832
833
834
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 831

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 TwiML instruction.

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



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
759
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 715

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 TwiML instruction.

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



776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 776

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