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

Public Class Methods

new(version, payload, workspace_sid: nil, worker_sid: nil, sid: nil) click to toggle source

Initialize the ReservationInstance @param [Version] version Version that contains the resource @param [Hash] payload payload that contains response from Twilio @param [String] workspace_sid The SID of the Workspace that this worker is

contained within.

@param [String] worker_sid The SID of the reserved Worker resource. @param [String] sid The SID of the WorkerReservation resource to fetch. @return [ReservationInstance] ReservationInstance

Calls superclass method Twilio::REST::InstanceResource::new
    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb
417 def initialize(version, payload, workspace_sid: nil, worker_sid: nil, sid: nil)
418   super(version)
419 
420   # Marshaled Properties
421   @properties = {
422       'account_sid' => payload['account_sid'],
423       'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
424       'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
425       'reservation_status' => payload['reservation_status'],
426       'sid' => payload['sid'],
427       'task_sid' => payload['task_sid'],
428       'worker_name' => payload['worker_name'],
429       'worker_sid' => payload['worker_sid'],
430       'workspace_sid' => payload['workspace_sid'],
431       'url' => payload['url'],
432       'links' => payload['links'],
433   }
434 
435   # Context
436   @instance_context = nil
437   @params = {
438       'workspace_sid' => workspace_sid,
439       'worker_sid' => worker_sid,
440       'sid' => sid || @properties['sid'],
441   }
442 end

Public Instance Methods

account_sid() click to toggle source

@return [String] The SID of the Account that created the resource

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb
462 def account_sid
463   @properties['account_sid']
464 end
context() click to toggle source

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context @return [ReservationContext] ReservationContext for this ReservationInstance

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb
448 def context
449   unless @instance_context
450     @instance_context = ReservationContext.new(
451         @version,
452         @params['workspace_sid'],
453         @params['worker_sid'],
454         @params['sid'],
455     )
456   end
457   @instance_context
458 end
date_created() click to toggle source

@return [Time] The ISO 8601 date and time in GMT when the resource was created

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb
468 def date_created
469   @properties['date_created']
470 end
date_updated() click to toggle source

@return [Time] The ISO 8601 date and time in GMT when the resource was last updated

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb
474 def date_updated
475   @properties['date_updated']
476 end
fetch() click to toggle source

Fetch the ReservationInstance @return [ReservationInstance] Fetched ReservationInstance

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb
529 def fetch
530   context.fetch
531 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb
729 def inspect
730   values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
731   "<Twilio.Taskrouter.V1.ReservationInstance #{values}>"
732 end
reservation_status() click to toggle source

@return [reservation.Status] The current status of the reservation

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb
480 def reservation_status
481   @properties['reservation_status']
482 end
sid() click to toggle source

@return [String] The unique string that identifies the resource

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb
486 def sid
487   @properties['sid']
488 end
task_sid() click to toggle source

@return [String] The SID of the reserved Task resource

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb
492 def task_sid
493   @properties['task_sid']
494 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb
722 def to_s
723   values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
724   "<Twilio.Taskrouter.V1.ReservationInstance #{values}>"
725 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) click to toggle source

Update the ReservationInstance @param [reservation.Status] reservation_status The new status of the

reservation. Can be: `pending`, `accepted`, `rejected`, `timeout`, `canceled`,
or `rescinded`.

@param [String] worker_activity_sid The new worker activity SID if rejecting a

reservation.

@param [String] instruction The assignment instruction for the reservation. @param [String] dequeue_post_work_activity_sid The SID of the Activity resource

to start after executing a Dequeue instruction.

@param [String] dequeue_from The caller ID of the call to the worker when

executing a Dequeue instruction.

@param [String] dequeue_record Whether to record both legs of a call when

executing a Dequeue instruction or which leg to record.

@param [String] dequeue_timeout The timeout for call when executing a Dequeue

instruction.

@param [String] dequeue_to 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}[https://www.twilio.com/docs/glossary/what-e164]
formatted phone number, depending on the destination.

@param [String] dequeue_status_callback_url The callback URL for completed call

event when executing a Dequeue instruction.

@param [String] call_from The Caller ID of the outbound call when executing a

Call instruction.

@param [String] call_record Whether to record both legs of a call when executing

a Call instruction.

@param [String] call_timeout The timeout for a call when executing a Call

instruction.

@param [String] call_to 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}[https://www.twilio.com/docs/glossary/what-e164] formatted
phone number, depending on the destination.

@param [String] call_url TwiML URI executed on answering the worker's leg as a

result of the Call instruction.

@param [String] call_status_callback_url The URL to call for the completed call

event when executing a Call instruction.

@param [Boolean] call_accept Whether to accept a reservation when executing a

Call instruction.

@param [String] redirect_call_sid The Call SID of the call parked in the queue

when executing a Redirect instruction.

@param [Boolean] redirect_accept Whether the reservation should be accepted when

executing a Redirect instruction.

@param [String] redirect_url TwiML URI to redirect the call to when executing

the Redirect instruction.

@param [String] to 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}[https://www.twilio.com/docs/glossary/what-e164] formatted
phone number, depending on the destination.

@param [String] from The caller ID of the call to the worker when executing a

Conference instruction.

@param [String] status_callback The URL we should call using the

`status_callback_method` to send status information to your application.

@param [String] status_callback_method The HTTP method we should use to call

`status_callback`. Can be: `POST` or `GET` and the default is `POST`.

@param [Array] status_callback_event The call progress

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

@param [String] timeout The timeout for a call when executing a Conference

instruction.

@param [Boolean] record Whether to record the participant and their conferences,

including the time between conferences. Can be `true` or `false` and the default
is `false`.

@param [Boolean] muted Whether the agent is muted in the conference. Defaults to

`false`.

@param [String] beep 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`.

@param [Boolean] start_conference_on_enter 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.

@param [Boolean] end_conference_on_exit Whether to end the conference when the

agent leaves.

@param [String] wait_url 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}[https://www.twilio.com/labs/twimlets/holdmusic].

@param [String] wait_method 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.

@param [Boolean] early_media Whether to allow an agent to hear the state of the

outbound call, including ringing or disconnect messages. The default is `true`.

@param [String] max_participants The maximum number of participants allowed in

the conference. Can be a positive integer from `2` to `250`. The default value
is `250`.

@param [String] conference_status_callback 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.

@param [String] conference_status_callback_method The HTTP method we should use

to call `conference_status_callback`. Can be: `GET` or `POST` and defaults to
`POST`.

@param [Array] conference_status_callback_event The

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

@param [String] conference_record 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`.

@param [String] conference_trim 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`.

@param [String] recording_channels The recording channels for the final

recording. Can be: `mono` or `dual` and the default is `mono`.

@param [String] recording_status_callback The URL that we should call using the

`recording_status_callback_method` when the recording status changes.

@param [String] recording_status_callback_method The HTTP method we should use

when we call `recording_status_callback`. Can be: `GET` or `POST` and defaults
to `POST`.

@param [String] conference_recording_status_callback The URL we should call

using the `conference_recording_status_callback_method` when the conference
recording is available.

@param [String] conference_recording_status_callback_method The HTTP method we

should use to call `conference_recording_status_callback`. Can be: `GET` or
`POST` and defaults to `POST`.

@param [String] region The

{region}[https://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`, `ie1`, `de1`, `sg1`,
`br1`, `au1`, or `jp1`.

@param [String] sip_auth_username The SIP username used for authentication. @param [String] sip_auth_password The SIP password for authentication. @param [Array] dequeue_status_callback_event The call progress events

sent via webhooks as a result of a Dequeue instruction.

@param [String] post_work_activity_sid The new worker activity SID after

executing a Conference instruction.

@param [Boolean] end_conference_on_customer_exit Whether to end the conference

when the customer leaves.

@param [Boolean] beep_on_customer_entrance Whether to play a notification beep

when the customer joins.

@return [ReservationInstance] Updated ReservationInstance

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb
664 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)
665   context.update(
666       reservation_status: reservation_status,
667       worker_activity_sid: worker_activity_sid,
668       instruction: instruction,
669       dequeue_post_work_activity_sid: dequeue_post_work_activity_sid,
670       dequeue_from: dequeue_from,
671       dequeue_record: dequeue_record,
672       dequeue_timeout: dequeue_timeout,
673       dequeue_to: dequeue_to,
674       dequeue_status_callback_url: dequeue_status_callback_url,
675       call_from: call_from,
676       call_record: call_record,
677       call_timeout: call_timeout,
678       call_to: call_to,
679       call_url: call_url,
680       call_status_callback_url: call_status_callback_url,
681       call_accept: call_accept,
682       redirect_call_sid: redirect_call_sid,
683       redirect_accept: redirect_accept,
684       redirect_url: redirect_url,
685       to: to,
686       from: from,
687       status_callback: status_callback,
688       status_callback_method: status_callback_method,
689       status_callback_event: status_callback_event,
690       timeout: timeout,
691       record: record,
692       muted: muted,
693       beep: beep,
694       start_conference_on_enter: start_conference_on_enter,
695       end_conference_on_exit: end_conference_on_exit,
696       wait_url: wait_url,
697       wait_method: wait_method,
698       early_media: early_media,
699       max_participants: max_participants,
700       conference_status_callback: conference_status_callback,
701       conference_status_callback_method: conference_status_callback_method,
702       conference_status_callback_event: conference_status_callback_event,
703       conference_record: conference_record,
704       conference_trim: conference_trim,
705       recording_channels: recording_channels,
706       recording_status_callback: recording_status_callback,
707       recording_status_callback_method: recording_status_callback_method,
708       conference_recording_status_callback: conference_recording_status_callback,
709       conference_recording_status_callback_method: conference_recording_status_callback_method,
710       region: region,
711       sip_auth_username: sip_auth_username,
712       sip_auth_password: sip_auth_password,
713       dequeue_status_callback_event: dequeue_status_callback_event,
714       post_work_activity_sid: post_work_activity_sid,
715       end_conference_on_customer_exit: end_conference_on_customer_exit,
716       beep_on_customer_entrance: beep_on_customer_entrance,
717   )
718 end
url() click to toggle source

@return [String] The absolute URL of the WorkerReservation resource

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb
516 def url
517   @properties['url']
518 end
worker_name() click to toggle source

@return [String] The friendly_name of the Worker that is reserved

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb
498 def worker_name
499   @properties['worker_name']
500 end
worker_sid() click to toggle source

@return [String] The SID of the reserved Worker resource

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb
504 def worker_sid
505   @properties['worker_sid']
506 end
workspace_sid() click to toggle source

@return [String] The SID of the Workspace that this worker is contained within.

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb
510 def workspace_sid
511   @properties['workspace_sid']
512 end