Twilio/Rest/Conversations/V1/Service/Configuration/Notification.pm

filter: Statementstmt 88.2% 45 / 51 Branchbran n/a Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 85.7% 18 / 21 Podpod n/a totaltotal 85.3% 64 / 75 CC 2 SCAR 2.1
CC
2
Cov
87%
update
2.0
fetch
2.0
update
2.0
CRAP 1.2
« Twilio/Rest/Conversations/V1/Configuration/Webhook.pm ↑ Summary Twilio/Rest/Conversations/V1/Service/Configuration/Webhook.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Conversations::V1::Service::Configuration::Notification;
3  
4 2 ▶use 5.016;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 our $VERSION = '2.001';
8  
9 package Twilio::Rest::Conversations::V1::Service::Configuration::NotificationContext;
10  
11 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 2 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 2 my ($class, $version, $chat_service_sid) = @_;
17 2 my $self = $class->SUPER::new($version);
18 2 $self->{solution} = { chat_service_sid => $chat_service_sid };
19 2 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($chat_service_sid),
20 '/Configuration/Notifications';
21 2 return $self;
22 }
23  
24 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
25 1 my ($self) = @_;
26  
27 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
28 1 return $self->_build_instance($response);
29 }
30  
31 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
32 1 my ($self, $options) = @_;
33 1 ▶ $options //= {};
Condition50%1/2
$options //= {}
l!l
10
MC/DC0%0/1
$options //= {}
$options
Truth table50%1/2
A
A= $options
Aresult
11
00
34  
35 my $data = {
36 'AddedToConversation.Enabled' =>
37 Twilio::Serialize::boolean_to_string($options->{added_to_conversation_enabled}),
38 'AddedToConversation.Sound' => $options->{added_to_conversation_sound},
39 'AddedToConversation.Template' => $options->{added_to_conversation_template},
40 LogEnabled => Twilio::Serialize::boolean_to_string($options->{log_enabled}),
41 'NewMessage.BadgeCountEnabled' =>
42 Twilio::Serialize::boolean_to_string($options->{new_message_badge_count_enabled}),
43 'NewMessage.Enabled' => Twilio::Serialize::boolean_to_string($options->{new_message_enabled}),
44 'NewMessage.Sound' => $options->{new_message_sound},
45 'NewMessage.Template' => $options->{new_message_template},
46 'NewMessage.WithMedia.Enabled' =>
47 Twilio::Serialize::boolean_to_string($options->{new_message_with_media_enabled}),
48 'NewMessage.WithMedia.Template' => $options->{new_message_with_media_template},
49 'RemovedFromConversation.Enabled' =>
50 Twilio::Serialize::boolean_to_string($options->{removed_from_conversation_enabled}),
51 'RemovedFromConversation.Sound' => $options->{removed_from_conversation_sound},
52 'RemovedFromConversation.Template' => $options->{removed_from_conversation_template},
53 1 };
54  
55 my $response =
56 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
57 1 return $self->_build_instance($response);
58 }
59  
60 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
61 2 my ($self, $response) = @_;
62 return Twilio::Rest::Conversations::V1::Service::Configuration::NotificationInstance->new(
63 2 $self->{version}, $response->get_content, $self->{solution}{chat_service_sid});
64 }
65  
66 package Twilio::Rest::Conversations::V1::Service::Configuration::NotificationInstance;
67  
68 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
69  
70 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
71  
72 2 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
73 2 my ($class, $version, $payload, $chat_service_sid) = @_;
74 2 my $self = $class->SUPER::new($version, $payload);
75 2 $self->{solution} = { chat_service_sid => $chat_service_sid };
76 2 return $self;
77 }
78  
79 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
80 0 my ($self, @arguments) = @_;
81 0 return $self->_context->fetch(@arguments);
82 }
83  
84 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
85 0 my ($self, @arguments) = @_;
86 0 return $self->_context->update(@arguments);
87 }
88  
89 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
90 0 my ($self) = @_;
91 return Twilio::Rest::Conversations::V1::Service::Configuration::NotificationContext->new(
92 0 $self->{version}, $self->{solution}{chat_service_sid});
93 }
94  
95 2 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
96 2 ▶sub added_to_conversation { return $_[0]{properties}{added_to_conversation} }
Subroutine added_to_conversation: called CC=1 SCAR=0.0
97 2 ▶sub chat_service_sid { return $_[0]{properties}{chat_service_sid} }
Subroutine chat_service_sid: called CC=1 SCAR=0.0
98 2 ▶sub log_enabled { return $_[0]{properties}{log_enabled} }
Subroutine log_enabled: called CC=1 SCAR=0.0
99 2 ▶sub new_message { return $_[0]{properties}{new_message} }
Subroutine new_message: called CC=1 SCAR=0.0
100 2 ▶sub removed_from_conversation { return $_[0]{properties}{removed_from_conversation} }
Subroutine removed_from_conversation: called CC=1 SCAR=0.0
101 2 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
102  
103 2 1;
104  
105 __END__
« Twilio/Rest/Conversations/V1/Configuration/Webhook.pm ↑ Summary Twilio/Rest/Conversations/V1/Service/Configuration/Webhook.pm »