Twilio/Rest/Insights/V3/QueryJob.pm

filter: Statementstmt 86.9% 73 / 84 Branchbran n/a Conditioncond 57.1% 4 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 85.2% 29 / 34 Podpod n/a totaltotal 82.1% 106 / 129 CC 4 SCAR 2.6
CC
4
Cov
85%
create
2.0
page
2.0
new
2.0
CRAP 1.3
« Twilio/Rest/Api/V2010/Account/IncomingPhoneNumber/AssignedAddOn.pm ↑ Summary Twilio/Rest/Supersim/V1/SmsCommand.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Insights::V3::QueryJob;
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::Insights::V3::QueryJobList;
10  
11 2 ▶use parent 'Twilio::ListResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 3 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 3 my ($class, $version) = @_;
17 3 my $self = $class->SUPER::new($version);
18 3 $self->{solution} = {};
19 3 $self->{uri} = '/InsightsDomains/Conversations/QueryJobs';
20 3 return $self;
21 }
22  
23 1 ▶sub create {
Subroutine create: called CC=2 SCAR=7.0
24 1 my ($self, $body, $options) = @_;
25 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
26  
27 1 my $data = Twilio::Serialize::json_body($body, {});
28  
29 my $response = $self->{version}->handle_request(
30 'POST',
31 $self->{uri},
32 'create',
33 {
34 data => $data,
35 headers => {
36 'Content-Type' => 'application/json',
37 'Idempotency-Key' => $options->{idempotency_key},
38 }
39 }
40 1 );
41 return Twilio::Rest::Insights::V3::QueryJobInstance->new($self->{version},
42 1 $response->get_content);
43 }
44  
45 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
46 0 my ($self, @arguments) = @_;
47 0 return $self->read_records(@arguments);
48 }
49  
50 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
51 0 my ($self, @arguments) = @_;
52 0 return $self->stream_records(@arguments);
53 }
54  
55 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
56 1 my ($self, $options, $page_size, $page_token) = @_;
57 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
58  
59 my $params = {
60 status => $options->{status},
61 1 pageSize => $page_size,
62 pageToken => $page_token,
63 };
64  
65 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
66 1 return $self->_build_page($response);
67 }
68  
69 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
70 0 my ($self, $target_url) = @_;
71 0 my $client = $self->{version}->get_domain->get_client;
72 0 return $self->_build_page($client->request('GET', $target_url));
73 }
74  
75 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
76 1 my ($self, $response) = @_;
77 return Twilio::Rest::Insights::V3::QueryJobPage->new($self->{version}, $response,
78 1 $self->{solution});
79 }
80  
81 1 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
82 1 my ($self, $operation_id) = @_;
83 1 return Twilio::Rest::Insights::V3::QueryJobContext->new($self->{version}, $operation_id);
84 }
85  
86 package Twilio::Rest::Insights::V3::QueryJobPage;
87  
88 2 ▶use parent 'Twilio::TokenPaginationPage';
Subroutine BEGIN: called CC=1 SCAR=0.0
89  
90 1 ▶sub records_key { return 'items' }
Subroutine records_key: called CC=1 SCAR=0.0
91  
92 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
93 1 my ($self, $payload) = @_;
94 1 return Twilio::Rest::Insights::V3::QueryJobInstance->new($self->{version}, $payload);
95 }
96  
97 package Twilio::Rest::Insights::V3::QueryJobContext;
98  
99 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
100  
101 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
102  
103 1 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
104 1 my ($class, $version, $operation_id) = @_;
105 1 my $self = $class->SUPER::new($version);
106 1 $self->{solution} = { operation_id => $operation_id };
107 1 $self->{uri} = join q{}, '/InsightsDomains/Conversations/QueryJobs/',
108 Twilio::Serialize::path_segment($operation_id);
109 1 return $self;
110 }
111  
112 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
113 1 my ($self) = @_;
114  
115 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
116 1 return $self->_build_instance($response);
117 }
118  
119 1 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
120 1 my ($self, $response) = @_;
121 return Twilio::Rest::Insights::V3::QueryJobInstance->new($self->{version},
122 1 $response->get_content, $self->{solution}{operation_id});
123 }
124  
125 package Twilio::Rest::Insights::V3::QueryJobInstance;
126  
127 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
128  
129 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
130  
131 3 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
132 3 my ($class, $version, $payload, $operation_id) = @_;
133 3 my $self = $class->SUPER::new($version, $payload);
134 3 ▶ $self->{solution} = { operation_id => $operation_id // $self->{properties}{operationId} };
Condition66%2/3
$operation_id // $self->{"properties"}{"operationId"}
l!l&&r!l&&!r
120
MC/DC0%0/2
$operation_id // $self->{"properties"}{"operationId"}
$operation_id $self->{"properties"}{"operationId"}
Truth table66%2/3
A // B
A= $operation_idB= $self->{"properties"}{"operationId"}
ABresult
1X1
011
000
135 3 return $self;
136 }
137  
138 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
139 0 my ($self, @arguments) = @_;
140 0 return $self->_context->fetch(@arguments);
141 }
142  
143 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
144 0 my ($self) = @_;
145 return Twilio::Rest::Insights::V3::QueryJobContext->new($self->{version},
146 0 $self->{solution}{operation_id});
147 }
148  
149 2 ▶sub completed_at { return Twilio::Deserialize::date_time($_[0]{properties}{completedAt}) }
Subroutine completed_at: called CC=1 SCAR=0.0
150 3 ▶sub created_at { return Twilio::Deserialize::date_time($_[0]{properties}{createdAt}) }
Subroutine created_at: called CC=1 SCAR=0.0
151 2 ▶sub error { return $_[0]{properties}{error} }
Subroutine error: called CC=1 SCAR=0.0
152 3 ▶sub operation_id { return $_[0]{properties}{operationId} }
Subroutine operation_id: called CC=1 SCAR=0.0
153 2 ▶sub result_id { return $_[0]{properties}{resultId} }
Subroutine result_id: called CC=1 SCAR=0.0
154 2 ▶sub result_retention_period { return $_[0]{properties}{resultRetentionPeriod} }
Subroutine result_retention_period: called CC=1 SCAR=0.0
155 2 ▶sub result_url { return $_[0]{properties}{resultUrl} }
Subroutine result_url: called CC=1 SCAR=0.0
156 3 ▶sub status { return $_[0]{properties}{status} }
Subroutine status: called CC=1 SCAR=0.0
157 3 ▶sub status_url { return $_[0]{properties}{statusUrl} }
Subroutine status_url: called CC=1 SCAR=0.0
158  
159 2 1;
160  
161 __END__
« Twilio/Rest/Api/V2010/Account/IncomingPhoneNumber/AssignedAddOn.pm ↑ Summary Twilio/Rest/Supersim/V1/SmsCommand.pm »