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 7     7   1723 use strict;
  7         10  
  7         162  
5 7     7   29 use warnings;
  7         7  
  7         2185  
6              
7             sub new {
8 4     4 1 1699 my $self = shift;
9 4         10 my %args = @_;
10 4         9 $self = bless(\%args, $self);
11              
12 4         30 return $self;
13             }
14              
15             sub getSiteUrl {
16 3     3 1 468 my ($self) = @_;
17              
18 3 50 33     26 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         16 return 'http://gyazo.com/'.$self->{id};
24             }
25              
26             sub getImageUrl {
27 3     3 1 310 my ($self) = @_;
28              
29 3 50 33     30 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         19 return 'http://gyazo.com/'.$self->{id}.'.png';
35             }
36              
37             sub getImageId {
38 3     3 1 757 my ($self) = @_;
39 3         21 return $self->{id};
40             }
41              
42             1;
43              
44             __END__