Mattermost/Util/UserAgent.pm

filter: Statementstmt 100% 18 / 18 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 100% 22 / 22 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Mattermost/Role/UserAgent.pm ↑ Summary Mattermost/V4/API/Object/Analytics/Old.pm »
1 package WebService::Mattermost::Util::UserAgent;
2  
3 # ABSTRACT: Internal user agent.
4  
5 14 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 14 ▶use Mojo::UserAgent;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 14 ▶use Types::Standard qw(Bool InstanceOf Int);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 ################################################################################
10  
11 14 has ua => (is => 'ro', isa => InstanceOf['Mojo::UserAgent'], lazy => 1, builder => 1);
12  
13 14 has inactivity_timeout => (is => 'ro', isa => Int, default => 15);
14 14 has max_redirects => (is => 'ro', isa => Int, default => 5);
15  
16 ################################################################################
17  
18 sub _build_ua {
19 23 ▶ my $self = shift;
Subroutine _build_ua: called CC=1 SCAR=0.0
20  
21 23 my $ua = Mojo::UserAgent->new();
22  
23 23 $ua->max_redirects($self->max_redirects);
24 23 $ua->inactivity_timeout($self->inactivity_timeout);
25  
26 23 return $ua;
27 }
28  
29 ################################################################################
30  
31 14 1;
32  
33 __END__
34  
35 =pod
36  
37 =encoding UTF-8
38  
39 =head1 NAME
40  
41 WebService::Mattermost::Util::UserAgent - Internal user agent.
42  
43 =head1 VERSION
44  
45 version 0.28
46  
47 =head1 DESCRIPTION
48  
49 Adds standard parameters to C<Mojo::UserAgent>.
50  
51 =head2 ATTRIBUTES
52  
53 =over 4
54  
55 =item C<ua>
56  
57 A C<Mojo::Log> object.
58  
59 =item C<inactivity_timeout()>
60  
61 The default inactivity timeout (15 seconds).
62  
63 =item C<max_redirects()>
64  
65 The default maximum number of redirects (5).
66  
67 =back
68  
69 =head1 AUTHOR
70  
71 Mike Jones <mike@netsplit.org.uk>
72  
73 =head1 COPYRIGHT AND LICENSE
74  
75 This software is Copyright (c) 2020 by Mike Jones.
76  
77 This is free software, licensed under:
78  
79 The MIT (X11) License
80  
81 =cut
« Mattermost/Role/UserAgent.pm ↑ Summary Mattermost/V4/API/Object/Analytics/Old.pm »