File Coverage

lib/WebService/Gyazo/B/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::B::Image;
2              
3             # Packages
4 9     9   7292 use strict;
  9         16  
  9         237  
5 9     9   42 use warnings;
  9         14  
  9         2822  
6              
7             sub new {
8 4     4 1 1527 my $self = shift;
9 4         18 my %args = @_;
10 4         9 $self = bless(\%args, $self);
11              
12 4         61 return $self;
13             }
14              
15             sub getSiteUrl {
16 3     3 1 521 my ($self) = @_;
17              
18 3 50 33     51 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         21 return 'http://gyazo.com/'.$self->{id};
24             }
25              
26             sub getImageUrl {
27 3     3 1 336 my ($self) = @_;
28              
29 3 50 33     33 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         25 return 'http://gyazo.com/'.$self->{id}.'.png';
35             }
36              
37             sub getImageId {
38 3     3 1 800 my ($self) = @_;
39 3         33 return $self->{id};
40             }
41              
42             1;
43              
44             __END__