Class: Twilio::REST::Taskrouter::V1::WorkspaceContext::WorkerContext::ReservationInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, workspace_sid: nil, worker_sid: nil, sid: nil) ⇒ ReservationInstance

Initialize the ReservationInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String)

    The SID of the Account that created this Reservation resource.

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb', line 764

def initialize(version, payload , workspace_sid: nil, worker_sid: nil, sid: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'account_sid' => payload['account_sid'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
        'reservation_status' => payload['reservation_status'],
        'sid' => payload['sid'],
        'task_sid' => payload['task_sid'],
        'worker_name' => payload['worker_name'],
        'worker_sid' => payload['worker_sid'],
        'workspace_sid' => payload['workspace_sid'],
        'url' => payload['url'],
        'links' => payload['links'],
    }

    # Context
    @instance_context = nil
    @params = { 'workspace_sid' => workspace_sid  || @properties['workspace_sid']  ,'worker_sid' => worker_sid  || @properties['worker_sid']  ,'sid' => sid  || @properties['sid']  , }
end

Instance Method Details

#account_sidString

Returns The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the WorkerReservation resource.

Returns:



801
802
803
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb', line 801

def 
    @properties['account_sid']
end

#contextReservationContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



792
793
794
795
796
797
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb', line 792

def context
    unless @instance_context
        @instance_context = ReservationContext.new(@version , @params['workspace_sid'], @params['worker_sid'], @params['sid'])
    end
    @instance_context
end

#date_createdTime

Returns The date and time in GMT when the resource was created specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.

Returns:



807
808
809
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb', line 807

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns The date and time in GMT when the resource was last updated specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.

Returns:



813
814
815
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb', line 813

def date_updated
    @properties['date_updated']
end

#fetchReservationInstance

Fetch the ReservationInstance

Returns:



868
869
870
871
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb', line 868

def fetch

    context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



1051
1052
1053
1054
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb', line 1051

def inspect
    values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Taskrouter.V1.ReservationInstance #{values}>"
end

Returns The URLs of related resources.

Returns:

  • (Hash)

    The URLs of related resources.



861
862
863
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb', line 861

def links
    @properties['links']
end

#reservation_statusStatus

Returns:

  • (Status)


819
820
821
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb', line 819

def reservation_status
    @properties['reservation_status']
end

#sidString

Returns The unique string that we created to identify the WorkerReservation resource.

Returns:

  • (String)

    The unique string that we created to identify the WorkerReservation resource.



825
826
827
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb', line 825

def sid
    @properties['sid']
end

#task_sidString

Returns The SID of the reserved Task resource.

Returns:

  • (String)

    The SID of the reserved Task resource.



831
832
833
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb', line 831

def task_sid
    @properties['task_sid']
end

#to_sObject

Provide a user friendly representation



1044
1045
1046
1047
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb', line 1044

def to_s
    values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Taskrouter.V1.ReservationInstance #{values}>"
end

#update(reservation_status: :unset, worker_activity_sid: :unset, instruction: :unset, dequeue_post_work_activity_sid: :unset, dequeue_from: :unset, dequeue_record: :unset, dequeue_timeout: :unset, dequeue_to: :unset, dequeue_status_callback_url: :unset, call_from: :unset, call_record: :unset, call_timeout: :unset, call_to: :unset, call_url: :unset, call_status_callback_url: :unset, call_accept: :unset, redirect_call_sid: :unset, redirect_accept: :unset, redirect_url: :unset, to: :unset, from: :unset, status_callback: :unset, status_callback_method: :unset, status_callback_event: :unset, timeout: :unset, record: :unset, muted: :unset, beep: :unset, start_conference_on_enter: :unset, end_conference_on_exit: :unset, wait_url: :unset, wait_method: :unset, early_media: :unset, max_participants: :unset, conference_status_callback: :unset, conference_status_callback_method: :unset, conference_status_callback_event: :unset, conference_record: :unset, conference_trim: :unset, recording_channels: :unset, recording_status_callback: :unset, recording_status_callback_method: :unset, conference_recording_status_callback: :unset, conference_recording_status_callback_method: :unset, region: :unset, sip_auth_username: :unset, sip_auth_password: :unset, dequeue_status_callback_event: :unset, post_work_activity_sid: :unset, end_conference_on_customer_exit: :unset, beep_on_customer_entrance: :unset, jitter_buffer_size: :unset, if_match: :unset) ⇒ ReservationInstance

Update the ReservationInstance

Parameters:

  • reservation_status (Status) (defaults to: :unset)
  • worker_activity_sid (String) (defaults to: :unset)

    The new worker activity SID if rejecting a reservation.

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

    The assignment instruction for the reservation.

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

    The SID of the Activity resource to start after executing a Dequeue instruction.

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

    The caller ID of the call to the worker when executing a Dequeue instruction.

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

    Whether to record both legs of a call when executing a Dequeue instruction or which leg to record.

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

    The timeout for call when executing a Dequeue instruction.

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

    The contact URI of the worker when executing a Dequeue instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the [E.164](www.twilio.com/docs/glossary/what-e164) formatted phone number, depending on the destination.

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

    The callback URL for completed call event when executing a Dequeue instruction.

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

    The Caller ID of the outbound call when executing a Call instruction.

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

    Whether to record both legs of a call when executing a Call instruction.

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

    The timeout for a call when executing a Call instruction.

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

    The contact URI of the worker when executing a Call instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the [E.164](www.twilio.com/docs/glossary/what-e164) formatted phone number, depending on the destination.

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

    TwiML URI executed on answering the worker’s leg as a result of the Call instruction.

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

    The URL to call for the completed call event when executing a Call instruction.

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

    Whether to accept a reservation when executing a Call instruction.

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

    The Call SID of the call parked in the queue when executing a Redirect instruction.

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

    Whether the reservation should be accepted when executing a Redirect instruction.

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

    TwiML URI to redirect the call to when executing the Redirect instruction.

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

    The Contact URI of the worker when executing a Conference instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the [E.164](www.twilio.com/docs/glossary/what-e164) formatted phone number, depending on the destination.

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

    The caller ID of the call to the worker when executing a Conference instruction.

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

    The URL we should call using the status_callback_method to send status information to your application.

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

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

  • status_callback_event (Array[CallStatus]) (defaults to: :unset)

    The call progress events that we will send to status_callback. Can be: initiated, ringing, answered, or completed.

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

    The timeout for a call when executing a Conference instruction.

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

    Whether to record the participant and their conferences, including the time between conferences. Can be true or false and the default is false.

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

    Whether the agent is muted in the conference. Defaults to false.

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

    Whether to play a notification beep when the participant joins or when to play a beep. Can be: true, false, onEnter, or onExit. The default value is true.

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

    Whether to start the conference when the participant joins, if it has not already started. Can be: true or false and the default is true. If false and the conference has not started, the participant is muted and hears background music until another participant starts the conference.

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

    Whether to end the conference when the agent leaves.

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

    The URL we should call using the wait_method for the music to play while participants are waiting for the conference to start. 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.

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

    Whether to allow an agent to hear the state of the outbound call, including ringing or disconnect messages. The default is true.

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

    The maximum number of participants allowed in the conference. Can be a positive integer from 2 to 250. The default value is 250.

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

    The URL we should call using the conference_status_callback_method when the conference events in conference_status_callback_event occur. Only the value set by the first participant to join the conference is used. Subsequent conference_status_callback values are ignored.

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

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

  • conference_status_callback_event (Array[ConferenceEvent]) (defaults to: :unset)

    The conference status events that we will send to conference_status_callback. Can be: start, end, join, leave, mute, hold, speaker.

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

    Whether to record the conference the participant is joining or when to record the conference. Can be: true, false, record-from-start, and do-not-record. The default value is false.

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

    Whether to trim leading and trailing silence from your recorded conference audio files. Can be: trim-silence or do-not-trim and defaults to trim-silence.

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

    The recording channels for the final recording. Can be: mono or dual and the default is mono.

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

    The URL that we should call using the recording_status_callback_method when the recording status changes.

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

    The HTTP method we should use when we call recording_status_callback. Can be: GET or POST and defaults to POST.

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

    The URL we should call using the conference_recording_status_callback_method when the conference recording is available.

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

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

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

    The [region](support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls) where we should mix the recorded audio. Can be:us1, us2, ie1, de1, sg1, br1, au1, or jp1.

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

    The SIP username used for authentication.

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

    The SIP password for authentication.

  • dequeue_status_callback_event (Array[String]) (defaults to: :unset)

    The call progress events sent via webhooks as a result of a Dequeue instruction.

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

    The new worker activity SID after executing a Conference instruction.

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

    Whether to end the conference when the customer leaves.

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

    Whether to play a notification beep when the customer joins.

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

    The jitter buffer size for conference. Can be: small, medium, large, off.

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

    The If-Match HTTP request header

Returns:



929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb', line 929

def update(
    reservation_status: :unset, 
    worker_activity_sid: :unset, 
    instruction: :unset, 
    dequeue_post_work_activity_sid: :unset, 
    dequeue_from: :unset, 
    dequeue_record: :unset, 
    dequeue_timeout: :unset, 
    dequeue_to: :unset, 
    dequeue_status_callback_url: :unset, 
    call_from: :unset, 
    call_record: :unset, 
    call_timeout: :unset, 
    call_to: :unset, 
    call_url: :unset, 
    call_status_callback_url: :unset, 
    call_accept: :unset, 
    redirect_call_sid: :unset, 
    redirect_accept: :unset, 
    redirect_url: :unset, 
    to: :unset, 
    from: :unset, 
    status_callback: :unset, 
    status_callback_method: :unset, 
    status_callback_event: :unset, 
    timeout: :unset, 
    record: :unset, 
    muted: :unset, 
    beep: :unset, 
    start_conference_on_enter: :unset, 
    end_conference_on_exit: :unset, 
    wait_url: :unset, 
    wait_method: :unset, 
    early_media: :unset, 
    max_participants: :unset, 
    conference_status_callback: :unset, 
    conference_status_callback_method: :unset, 
    conference_status_callback_event: :unset, 
    conference_record: :unset, 
    conference_trim: :unset, 
    recording_channels: :unset, 
    recording_status_callback: :unset, 
    recording_status_callback_method: :unset, 
    conference_recording_status_callback: :unset, 
    conference_recording_status_callback_method: :unset, 
    region: :unset, 
    sip_auth_username: :unset, 
    sip_auth_password: :unset, 
    dequeue_status_callback_event: :unset, 
    post_work_activity_sid: :unset, 
    end_conference_on_customer_exit: :unset, 
    beep_on_customer_entrance: :unset, 
    jitter_buffer_size: :unset, 
    if_match: :unset
)

    context.update(
        reservation_status: reservation_status, 
        worker_activity_sid: worker_activity_sid, 
        instruction: instruction, 
        dequeue_post_work_activity_sid: dequeue_post_work_activity_sid, 
        dequeue_from: dequeue_from, 
        dequeue_record: dequeue_record, 
        dequeue_timeout: dequeue_timeout, 
        dequeue_to: dequeue_to, 
        dequeue_status_callback_url: dequeue_status_callback_url, 
        call_from: call_from, 
        call_record: call_record, 
        call_timeout: call_timeout, 
        call_to: call_to, 
        call_url: call_url, 
        call_status_callback_url: call_status_callback_url, 
        call_accept: call_accept, 
        redirect_call_sid: redirect_call_sid, 
        redirect_accept: redirect_accept, 
        redirect_url: redirect_url, 
        to: to, 
        from: from, 
        status_callback: status_callback, 
        status_callback_method: status_callback_method, 
        status_callback_event: status_callback_event, 
        timeout: timeout, 
        record: record, 
        muted: muted, 
        beep: beep, 
        start_conference_on_enter: start_conference_on_enter, 
        end_conference_on_exit: end_conference_on_exit, 
        wait_url: wait_url, 
        wait_method: wait_method, 
        early_media: early_media, 
        max_participants: max_participants, 
        conference_status_callback: conference_status_callback, 
        conference_status_callback_method: conference_status_callback_method, 
        conference_status_callback_event: conference_status_callback_event, 
        conference_record: conference_record, 
        conference_trim: conference_trim, 
        recording_channels: recording_channels, 
        recording_status_callback: recording_status_callback, 
        recording_status_callback_method: recording_status_callback_method, 
        conference_recording_status_callback: conference_recording_status_callback, 
        conference_recording_status_callback_method: conference_recording_status_callback_method, 
        region: region, 
        sip_auth_username: sip_auth_username, 
        sip_auth_password: sip_auth_password, 
        dequeue_status_callback_event: dequeue_status_callback_event, 
        post_work_activity_sid: post_work_activity_sid, 
        end_conference_on_customer_exit: end_conference_on_customer_exit, 
        beep_on_customer_entrance: beep_on_customer_entrance, 
        jitter_buffer_size: jitter_buffer_size, 
        if_match: if_match, 
    )
end

#urlString

Returns The absolute URL of the WorkerReservation resource.

Returns:

  • (String)

    The absolute URL of the WorkerReservation resource.



855
856
857
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb', line 855

def url
    @properties['url']
end

#worker_nameString

Returns The friendly_name of the Worker that is reserved.

Returns:

  • (String)

    The friendly_name of the Worker that is reserved.



837
838
839
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb', line 837

def worker_name
    @properties['worker_name']
end

#worker_sidString

Returns The SID of the reserved Worker resource.

Returns:

  • (String)

    The SID of the reserved Worker resource.



843
844
845
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb', line 843

def worker_sid
    @properties['worker_sid']
end

#workspace_sidString

Returns The SID of the Workspace that this worker is contained within.

Returns:

  • (String)

    The SID of the Workspace that this worker is contained within.



849
850
851
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb', line 849

def workspace_sid
    @properties['workspace_sid']
end