File Coverage

blib/lib/WebService/PagerDuty.pm
Criterion Covered Total %
statement 31 36 86.1
branch 0 2 0.0
condition n/a
subroutine 12 15 80.0
pod 3 4 75.0
total 46 57 80.7


line stmt bran cond sub pod time code
1             #!/usr/bin/env perl -w
2              
3             ## workaround for PkgVersion
4             ## no critic
5             package WebService::PagerDuty;
6             {
7             $WebService::PagerDuty::VERSION = '1.20131219.1627';
8             }
9             ## use critic
10 2     2   186310 use strict;
  2         6  
  2         84  
11 2     2   11 use warnings;
  2         5  
  2         165  
12              
13 2     2   10 use base qw/ WebService::PagerDuty::Base /;
  2         4  
  2         1290  
14 2     2   4389 use URI;
  2         24342  
  2         224  
15 2     2   2387 use WebService::PagerDuty::Event;
  2         6  
  2         20  
16 2     2   1657 use WebService::PagerDuty::Incidents;
  2         5  
  2         15  
17 2     2   1265 use WebService::PagerDuty::Schedules;
  2         5  
  2         17  
18              
19             __PACKAGE__->mk_ro_accessors(
20             qw/
21             user
22             password
23             api_key
24             subdomain
25             use_ssl
26             event_url
27             incidents_url
28             schedules_url
29             /
30             );
31              
32             sub new {
33 1     1 1 14 my $self = shift;
34             $self->SUPER::new(
35             _defaults => {
36 0     0   0 use_ssl => sub { 1 },
37             event_url => sub {
38 0     0   0 my $self = shift;
39 0 0       0 URI->new( ( $self->use_ssl ? 'https' : 'http' ) . '://events.pagerduty.com/generic/2010-04-15/create_event.json' );
40             },
41             incidents_url => sub {
42 1     1   3 my $self = shift;
43 1         7 URI->new( 'https://' . $self->subdomain . '.pagerduty.com/api/v1/incidents' );
44             },
45             schedules_url => sub {
46 1     1   2 my $self = shift;
47 1         5 URI->new( 'https://' . $self->subdomain . '.pagerduty.com/api/v1/schedules' );
48             },
49             },
50             @_
51 1         32 );
52             }
53              
54             sub event {
55 0     0 0 0 my $self = shift;
56 0         0 return WebService::PagerDuty::Event->new(
57             url => $self->event_url,
58             @_
59             );
60             }
61              
62             sub incidents {
63 1     1 1 2793 my $self = shift;
64 1         9 return WebService::PagerDuty::Incidents->new(
65             url => $self->incidents_url,
66             user => $self->user,
67             password => $self->password,
68             api_key => $self->api_key,
69             @_
70             );
71             }
72              
73             sub schedules {
74 1     1 1 331 my $self = shift;
75 1         5 return WebService::PagerDuty::Schedules->new(
76             url => $self->schedules_url,
77             user => $self->user,
78             password => $self->password,
79             api_key => $self->api_key,
80             @_
81             );
82             }
83              
84             1;
85              
86             __END__