File Coverage

lib/WebService/Gyazo/Image.pm
Criterion Covered Total %
statement 18 22 81.8
branch 2 4 50.0
condition 2 6 33.3
subroutine 6 6 100.0
pod 4 4 100.0
total 32 42 76.1


line stmt bran cond sub pod time code
1             package WebService::Gyazo::Image;
2              
3             # Packages
4 9     9   5690 use strict;
  9         16  
  9         349  
5 9     9   53 use warnings;
  9         15  
  9         4101  
6              
7             sub new {
8 4     4 1 2592 my $self = shift;
9 4         18 my %args = @_;
10 4         17 $self = bless(\%args, $self);
11            
12 4         43 return $self;
13             }
14              
15             sub getSiteUrl {
16 3     3 1 506 my ($self) = @_;
17              
18 3 50 33     35 unless (defined $self->{id} and $self->{id} =~ m#^\w+$#) {
19 0         0 $self->{id} = 'Wrong image id!';
20 0         0 return 0;
21             }
22              
23 3         24 return 'http://gyazo.com/'.$self->{id};
24             }
25              
26             sub getImageUrl {
27 3     3 1 510 my ($self) = @_;
28              
29 3 50 33     38 unless (defined $self->{id} and $self->{id} =~ m#^\w+$#) {
30 0         0 $self->{id} = 'Wrong image id!';
31 0         0 return 0;
32             }
33              
34 3         27 return 'http://gyazo.com/'.$self->{id}.'.png';
35             }
36              
37             sub getImageId {
38 3     3 1 1586 my ($self) = @_;
39 3         30 return $self->{id};
40             }
41              
42             1;
43              
44             __END__