« Twilio/Jwt/TaskRouter/TaskQueueCapability.pm
↑ Summary
Twilio/Jwt/TaskRouter/WorkspaceCapability.pm »
| 1 | package Twilio::Jwt::TaskRouter::WorkerCapability; | ||
| 2 | |||
| 3 | 2 | ▶ | use 5.016; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 2 | ▶ | use parent 'Twilio::Jwt::TaskRouter::CapabilityToken'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 2 | our $VERSION = '2.001'; | |
| 9 | |||
| 10 | 3 | ▶ | sub new { |
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||
| 11 | 3 | my ($class, $account_sid, $auth_token, $workspace_sid, $worker_sid, $base_url, $base_ws_url) = @_; | |
| 12 | |||
| 13 | 3 | my $self = $class->SUPER::new($account_sid, $auth_token, $workspace_sid, $worker_sid, undef, | |
| 14 | $base_url, $base_ws_url); | ||
| 15 | |||
| 16 | 3 | $self->{tasks_url} = "$self->{base_url}/Tasks/**"; | |
| 17 | 3 | $self->{activity_url} = "$self->{base_url}/Activities"; | |
| 18 | 3 | $self->{worker_reservations_url} = "$self->{resource_url}/Reservations/**"; | |
| 19 | |||
| 20 | 3 | $self->allow($self->{activity_url}, 'GET', undef, undef); | |
| 21 | 3 | $self->allow($self->{tasks_url}, 'GET', undef, undef); | |
| 22 | 3 | $self->allow($self->{worker_reservations_url}, 'GET', undef, undef); | |
| 23 | 3 | return $self; | |
| 24 | } | ||
| 25 | |||
| 26 | 3 | ▶ | sub setup_resource { |
|
Subroutine
setup_resource: called CC=1 SCAR=0.0
Pod
documented
| |||
| 27 | 3 | my ($self) = @_; | |
| 28 | 3 | $self->{resource_url} = "$self->{base_url}/Workers/$self->{channel_id}"; | |
| 29 | 3 | return; | |
| 30 | } | ||
| 31 | |||
| 32 | 1 | ▶ | sub allow_activity_updates { |
|
Subroutine
allow_activity_updates: called CC=1 SCAR=0.0
Pod
documented
| |||
| 33 | 1 | my ($self) = @_; | |
| 34 | 1 | $self->allow($self->{resource_url}, 'POST', {}, { ActivitySid => { required => \1 } }); | |
| 35 | 1 | return; | |
| 36 | } | ||
| 37 | |||
| 38 | 1 | ▶ | sub allow_reservation_updates { |
|
Subroutine
allow_reservation_updates: called CC=1 SCAR=0.0
Pod
documented
| |||
| 39 | 1 | my ($self) = @_; | |
| 40 | 1 | $self->allow($self->{tasks_url}, 'POST'); | |
| 41 | 1 | $self->allow($self->{worker_reservations_url}, 'POST'); | |
| 42 | 1 | return; | |
| 43 | } | ||
| 44 | |||
| 45 | 2 | 1; | |
| 46 | |||
| 47 | __END__ | ||