ACME2/Authorization.pm

filter: Statementstmt 54.3% 25 / 46 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 8 / 12 Podpod 75.0% 3 / 4 totaltotal 56.2% 36 / 64 CC 4 SCAR 13.9
CC
4
Cov
52%
challenges
12.0
update
6.0
wildcard
2.0
CRAP 4.0
« ACME2/HTTP_Tiny.pm ↑ Summary ACME2/X/Empty.pm »
1 package Net::ACME2::Authorization;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 =encoding utf-8
7  
8 =head1 NAME
9  
10 Net::ACME2::Authorization
11  
12 =head1 DESCRIPTION
13  
14 The ACME Authorization object.
15  
16 =cut
17  
18 1 ▶use parent qw( Net::ACME2::AccessorBase );
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 1 ▶use Call::Context ();
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 1 ▶use Net::ACME2::Challenge ();
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 #Pre-load challenge classes.
25 1 ▶use Net::ACME2::Challenge::http_01 ();
Subroutine BEGIN: called CC=1 SCAR=0.0
26 1 ▶use Net::ACME2::Challenge::dns_01 ();
Subroutine BEGIN: called CC=1 SCAR=0.0
27  
28 1 use constant _ACCESSORS => (
29 'id',
30 'expires',
31 'status',
32 1 ▶);
Subroutine BEGIN: called CC=1 SCAR=0.0
33  
34 =head1 ACCESSORS
35  
36 These provide text strings as defined in the ACME specification.
37  
38 =over
39  
40 =item * B<id()>
41  
42 =item * B<status()>
43  
44 =item * B<expires()>
45  
46 =back
47  
48 =head1 OTHER METHODS
49  
50 =head2 I<OBJ>->wildcard()
51  
52 Returns a Perl boolean that indicates whether the authorization is
53 for a wildcard DNS name.
54  
55 =cut
56  
57 sub wildcard {
58 0 ▶ my ($self) = @_;
Subroutine wildcard: not called CC=1 SCAR=6.9
Pod documented
59  
60 0 return !!$self->{'_wildcard'};
61 }
62  
63 =head2 I<OBJ>->identifier()
64  
65 The order’s identifier, as a hash reference.
66 The content matches the ACME specification. (NB: Wildcard
67 authorizations do B<NOT> contain the leading C<*.> in the
68 C<value>.)
69  
70 =cut
71  
72 sub identifier {
73 0 ▶ my ($self) = @_;
Subroutine identifier: not called CC=1 SCAR=6.9
Pod documented
74  
75 0 return { %{ $self->{'_identifier'} } };
76 }
77  
78 =head2 I<OBJ>->challenges()
79  
80 The order’s challenges, as a list of L<Net::ACME2::Challenge>
81 instances. (C<http-01> challenges will be instances of
82 L<Net::ACME2::Challenge::http_01>.)
83  
84 =cut
85  
86 sub challenges {
87 0 ▶ my ($self) = @_;
Subroutine challenges: not called CC=3 SCAR=24.8
Pod documented
88  
89 0 Call::Context::must_be_list();
90  
91 0 my @challenges;
92  
93 0 for my $c ( @{ $self->{'_challenges'} } ) {
94 0 my $class = 'Net::ACME2::Challenge';
95  
96 0 my $module_leaf = $c->{'type'};
97 0 $module_leaf =~ tr<-><_>;
98 0 $class .= "::$module_leaf";
99  
100 #Ignore unrecognized challenges.
101 0 ▶ next if !$class->can('new');
Branch: 1 branch
BranchTrueFalseTotal
unless $class->can("new") 0 0 0
102  
103 0 push @challenges, $class->new( %$c );
104 }
105  
106 0 return @challenges;
107 }
108  
109 sub update {
110 0 ▶ my ($self, $new_hr) = @_;
Subroutine update: not called CC=2 SCAR=17.9
Pod undocumented
111  
112 0 for my $name ( 'status', 'challenges' ) {
113 0 $self->{"_$name"} = $new_hr->{$name};
114 }
115  
116 0 return $self;
117 }
118  
119 1 1;
« ACME2/HTTP_Tiny.pm ↑ Summary ACME2/X/Empty.pm »