File Coverage

blib/lib/SNS/Notification.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 16 16 100.0


line stmt bran cond sub pod time code
1             package SNS::Notification;
2 1     1   1233 use Moo;
  1         11636  
  1         4  
3 1     1   2123 use Types::Standard qw/Str/;
  1         76361  
  1         11  
4              
5             our $VERSION = '0.03';
6              
7             has Timestamp => (is => 'ro', isa => Str, required => 1);
8             has TopicArn => (is => 'ro', isa => Str, required => 1);
9             has Type => (is => 'ro', isa => Str, required => 1);
10             has MessageId => (is => 'ro', isa => Str, required => 1);
11             has Message => (is => 'ro', isa => Str, required => 1);
12             has UnsubscribeURL => (is => 'ro', isa => Str, required => 1);
13             has Signature => (is => 'ro', isa => Str, required => 1);
14             has SignatureVersion => (is => 'ro', isa => Str, required => 1);
15             has Subject => (is => 'ro', isa => Str);
16             has SigningCertURL => (is => 'ro', isa => Str, required => 1);
17              
18              
19 1     1   1004 no Moo;
  1         3  
  1         8  
20 1     1   250 no Types::Standard;
  1         2  
  1         8  
21              
22             1;
23             ### main pod documentation begin ###
24              
25             =encoding UTF-8
26              
27             =head1 NAME
28              
29             SNS::Notification - An object for representing SNS Notifications
30              
31             =head1 SYNOPSIS
32              
33             use SNS::Notification;
34             my $not = SNS::Notification->new(
35             Timestamp => ...
36             ... required attributes ...
37             );
38             #do something with $obj
39              
40             my $body = decode_json($sns_message);
41             my $sns = eval { SNS::Notification->new($body) };
42             if ($@) {
43             die "Doesn't look like an SNS::Message to me";
44             }
45             print $sns->Message;
46              
47             =head1 DESCRIPTION
48              
49             This module holds an object for representing an SNS messsage. It tries
50             to validate that all appropiate fields are present.
51              
52             This is really just a module for other modules that work with SNS to
53             depend on (and not reimplement it constantly).
54              
55             =head1 SEE ALSO
56              
57             L
58              
59             L
60              
61             L
62              
63             =head1 COPYRIGHT and LICENSE
64              
65             Copyright (c) 2020 by Jose Luis Martinez
66              
67             This code is distributed under the Apache 2 License. The full text of the license can be found in the LICENSE file included with this module.
68              
69             =cut