| 1 | package Net::ACME2::Order; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | =encoding utf-8 | ||
| 7 | |||
| 8 | =head1 NAME | ||
| 9 | |||
| 10 | Net::ACME2::Order | ||
| 11 | |||
| 12 | =head1 DESCRIPTION | ||
| 13 | |||
| 14 | The ACME Order object. | ||
| 15 | |||
| 16 | =cut | ||
| 17 | |||
| 18 | use parent qw( Net::ACME2::AccessorBase ); | ||
| 19 | |||
| 20 | use Call::Context (); | ||
| 21 | |||
| 22 | use constant _ACCESSORS => ( | ||
| 23 | 'id', | ||
| 24 | 'status', | ||
| 25 | 'expires', | ||
| 26 | 'notBefore', | ||
| 27 | 'notAfter', | ||
| 28 | 'certificate', | ||
| 29 | 'finalize', | ||
| 30 | ); | ||
| 31 | |||
| 32 | =head1 ACCESSORS | ||
| 33 | |||
| 34 | These provide text strings as defined in the ACME specification. | ||
| 35 | |||
| 36 | =over | ||
| 37 | |||
| 38 | =item * B<id()> | ||
| 39 | |||
| 40 | =item * B<status()> | ||
| 41 | |||
| 42 | =item * B<expires()> | ||
| 43 | |||
| 44 | =item * B<notBefore()> | ||
| 45 | |||
| 46 | =item * B<notAfter()> | ||
| 47 | |||
| 48 | =item * B<certificate()> | ||
| 49 | |||
| 50 | =item * B<finalize()> | ||
| 51 | |||
| 52 | =back | ||
| 53 | |||
| 54 | =head2 I<OBJ>->authorizations() | ||
| 55 | |||
| 56 | The URLs for the order’s authorizations. | ||
| 57 | |||
| 58 | =cut | ||
| 59 | |||
| 60 | sub authorizations { | ||
| 61 | my ($self) = @_; | ||
| 62 | |||
| 63 | Call::Context::must_be_list(); | ||
| 64 | |||
| 65 | return @{ $self->{'_authorizations'} }; | ||
| 66 | } | ||
| 67 | |||
| 68 | =head2 I<OBJ>->identifiers() | ||
| 69 | |||
| 70 | The order’s identifiers, as a list of hash references. | ||
| 71 | The content matches the ACME specification. | ||
| 72 | |||
| 73 | =cut | ||
| 74 | |||
| 75 | sub identifiers { | ||
| 76 | my ($self) = @_; | ||
| 77 | |||
| 78 | Call::Context::must_be_list(); | ||
| 79 | |||
| 80 | return map { { %$_ } } @{ $self->{'_identifiers'} }; | ||
| 81 | } | ||
| 82 | |||
| 83 | #Only to be called from ACME2.pm? | ||
| 84 | |||
| 85 | sub update { | ||
| 86 | my ($self, $new_hr) = @_; | ||
| 87 | |||
| 88 | for my $name ( 'status', 'certificate' ) { | ||
| 89 | $self->{"_$name"} = $new_hr->{$name}; | ||
| 90 | } | ||
| 91 | |||
| 92 | return $self; | ||
| 93 | } | ||
| 94 | |||
| 95 | 1; |