API/Builder/TemplateMessage.pm

filter: Statementstmt 98.8% 87 / 88 Branchbran n/a Conditioncond 50.0% 5 / 10 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 96.8% 31 / 32 Podpod 0.0% 0 / 4 totaltotal 88.4% 123 / 139 CC 6 SCAR 2.7
CC
6
Cov
94%
new
2.1
new
2.1
new
2.1
CRAP 1.3
« API/Response/AudienceMultipleData.pm ↑ Summary API/Event/Message.pm »
1 package LINE::Bot::API::Builder::TemplateMessage;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶sub new_buttons {
Subroutine new_buttons: called CC=1 SCAR=0.0
Pod undocumented
6 1 my($class, %args) = @_;
7 1 LINE::Bot::API::Builder::TemplateMessage::Buttons->new(%args);
8 }
9  
10 1 ▶sub new_confirm {
Subroutine new_confirm: called CC=1 SCAR=0.0
Pod undocumented
11 1 my($class, %args) = @_;
12 1 LINE::Bot::API::Builder::TemplateMessage::Confirm->new(%args);
13 }
14  
15 1 ▶sub new_carousel {
Subroutine new_carousel: called CC=1 SCAR=0.0
Pod undocumented
16 1 my($class, %args) = @_;
17 1 LINE::Bot::API::Builder::TemplateMessage::Carousel->new(%args);
18 }
19  
20 1 ▶sub new_image_carousel {
Subroutine new_image_carousel: called CC=1 SCAR=0.0
Pod undocumented
21 1 my($class, %args) = @_;
22 1 LINE::Bot::API::Builder::TemplateMessage::ImageCarousel->new(%args);
23 }
24  
25  
26 1 package LINE::Bot::API::Builder::TemplateMessage::ActionBase {
27  
28 6 ▶ sub add_action {
Subroutine add_action: called CC=1 SCAR=0.0
29 6 my($self, $action) = @_;
30 6 push @{ $self->_actions }, $action;
31 6 $self;
32 }
33  
34 3 ▶ sub add_postback_action {
Subroutine add_postback_action: called CC=1 SCAR=0.0
35 3 my($self, %args) = @_;
36 $self->add_action(+{
37 type => 'postback',
38 label => $args{label},
39 data => $args{data},
40 text => $args{text},
41 3 });
42 }
43  
44 3 ▶ sub add_message_action {
Subroutine add_message_action: called CC=1 SCAR=0.0
45 3 my($self, %args) = @_;
46 $self->add_action(+{
47 type => 'message',
48 label => $args{label},
49 text => $args{text},
50 3 });
51 }
52  
53 3 ▶ sub add_uri_action {
Subroutine add_uri_action: called CC=1 SCAR=0.0
54 3 my($self, %args) = @_;
55 $self->add_action(+{
56 type => 'uri',
57 label => $args{label},
58 uri => $args{uri},
59 3 });
60 }
61 }
62  
63 1 package LINE::Bot::API::Builder::TemplateMessage::Buttons {
64 1 ▶ use parent -norequire, 'LINE::Bot::API::Builder::TemplateMessage::ActionBase';
Subroutine BEGIN: called CC=1 SCAR=0.0
65  
66 1 ▶ sub new {
Subroutine new: called CC=2 SCAR=7.2
67 1 my($class, %args) = @_;
68 bless {
69 type => 'template',
70 altText => $args{alt_text},
71 template => +{
72 type => 'buttons',
73 thumbnailImageUrl => $args{image_url},
74 title => $args{title},
75 text => $args{text},
76 1 ▶ actions => $args{actions} // +[],
Condition50%1/2
$args{"actions"} // []
l!l
01
MC/DC0%0/1
$args{"actions"} // []
$args{"actions"}
Truth table50%1/2
A
A= $args{"actions"}
Aresult
11
00
77 },
78 }, $class;
79 }
80  
81 1 ▶ sub build {
Subroutine build: called CC=1 SCAR=0.0
82 1 my($self, ) = @_;
83 1 +{ %{ $self } };
84 }
85  
86 3 ▶ sub _actions { $_[0]{template}{actions} }
Subroutine _actions: called CC=1 SCAR=0.0
87 }
88  
89 1 package LINE::Bot::API::Builder::TemplateMessage::Confirm {
90 1 ▶ use parent -norequire, 'LINE::Bot::API::Builder::TemplateMessage::ActionBase';
Subroutine BEGIN: called CC=1 SCAR=0.0
91  
92 1 ▶ sub new {
Subroutine new: called CC=2 SCAR=7.2
93 1 my($class, %args) = @_;
94 bless {
95 type => 'template',
96 altText => $args{alt_text},
97 template => +{
98 type => 'confirm',
99 text => $args{text},
100 1 ▶ actions => $args{actions} // +[],
Condition50%1/2
$args{"actions"} // []
l!l
01
MC/DC0%0/1
$args{"actions"} // []
$args{"actions"}
Truth table50%1/2
A
A= $args{"actions"}
Aresult
11
00
101 },
102 }, $class;
103 }
104  
105 1 ▶ sub build {
Subroutine build: called CC=1 SCAR=0.0
106 1 my($self, ) = @_;
107 1 +{ %{ $self } };
108 }
109  
110 0 ▶ sub _actions { $_[0]{template}{actions} }
Subroutine _actions: not called CC=1 SCAR=6.9
111 }
112  
113 1 package LINE::Bot::API::Builder::TemplateMessage::Carousel {
114  
115 1 ▶ sub new {
Subroutine new: called CC=2 SCAR=7.2
116 1 my($class, %args) = @_;
117 bless {
118 type => 'template',
119 altText => $args{alt_text},
120 template => +{
121 type => 'carousel',
122 1 ▶ columns => $args{columns} // +[],
Condition50%1/2
$args{"columns"} // []
l!l
01
MC/DC0%0/1
$args{"columns"} // []
$args{"columns"}
Truth table50%1/2
A
A= $args{"columns"}
Aresult
11
00
123 },
124 }, $class;
125 }
126  
127 1 ▶ sub build {
Subroutine build: called CC=1 SCAR=0.0
128 1 my($self, ) = @_;
129 1 +{ %{ $self } };
130 }
131  
132 1 ▶ sub add_column {
Subroutine add_column: called CC=1 SCAR=0.0
133 1 my($self, $column) = @_;
134 1 push @{ $self->{template}{columns} }, $column;
135 1 $self;
136 }
137 }
138  
139 1 package LINE::Bot::API::Builder::TemplateMessage::ImageCarousel {
140  
141 1 ▶ sub new {
Subroutine new: called CC=2 SCAR=7.2
142 1 my($class, %args) = @_;
143 bless {
144 type => 'template',
145 altText => $args{alt_text},
146 template => +{
147 type => 'image_carousel',
148 1 ▶ columns => $args{columns} // +[],
Condition50%1/2
$args{"columns"} // []
l!l
01
MC/DC0%0/1
$args{"columns"} // []
$args{"columns"}
Truth table50%1/2
A
A= $args{"columns"}
Aresult
11
00
149 },
150 }, $class;
151 }
152  
153 1 ▶ sub build {
Subroutine build: called CC=1 SCAR=0.0
154 1 my($self, ) = @_;
155 1 +{ %{ $self } };
156 }
157  
158 3 ▶ sub add_column {
Subroutine add_column: called CC=1 SCAR=0.0
159 3 my($self, $column) = @_;
160 3 push @{ $self->{template}{columns} }, $column;
161 3 $self;
162 }
163 }
164  
165 1 package LINE::Bot::API::Builder::TemplateMessage::Column {
166 1 ▶ use parent -norequire, 'LINE::Bot::API::Builder::TemplateMessage::ActionBase';
Subroutine BEGIN: called CC=1 SCAR=0.0
167  
168 1 ▶ sub new {
Subroutine new: called CC=2 SCAR=7.2
169 1 my($class, %args) = @_;
170 bless {
171 thumbnailImageUrl => $args{image_url},
172 title => $args{title},
173 text => $args{text},
174 1 ▶ actions => $args{actions} // +[],
Condition50%1/2
$args{"actions"} // []
l!l
01
MC/DC0%0/1
$args{"actions"} // []
$args{"actions"}
Truth table50%1/2
A
A= $args{"actions"}
Aresult
11
00
175 }, $class;
176 }
177  
178 1 ▶ sub build {
Subroutine build: called CC=1 SCAR=0.0
179 1 my($self, ) = @_;
180 1 +{ %{ $self } };
181 }
182  
183 3 ▶ sub _actions { $_[0]{actions} }
Subroutine _actions: called CC=1 SCAR=0.0
184 }
185  
186 1 package LINE::Bot::API::Builder::TemplateMessage::ImageColumn {
187 1 ▶ use parent -norequire, 'LINE::Bot::API::Builder::TemplateMessage::ActionBase';
Subroutine BEGIN: called CC=1 SCAR=0.0
188  
189 3 ▶ sub new {
Subroutine new: called CC=1 SCAR=0.0
190 3 my($class, %args) = @_;
191 bless {
192 imageUrl => $args{image_url},
193 3 action => undef,
194 }, $class;
195 }
196  
197 3 ▶ sub build {
Subroutine build: called CC=1 SCAR=0.0
198 3 my($self, ) = @_;
199 3 +{ %{ $self } };
200 }
201  
202 3 ▶ sub add_action {
Subroutine add_action: called CC=1 SCAR=0.0
203 3 my($self, $action) = @_;
204 3 $self->{action} = $action;
205 3 $self;
206 }
207 }
208  
209 1 1;
« API/Response/AudienceMultipleData.pm ↑ Summary API/Event/Message.pm »