File Coverage

blib/lib/WWW/BigDoor/URL.pm
Criterion Covered Total %
statement 18 20 90.0
branch 2 4 50.0
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 26 30 86.6


line stmt bran cond sub pod time code
1             package WWW::BigDoor::URL;
2              
3 3     3   42703 use strict;
  3         7  
  3         108  
4 3     3   18 use warnings;
  3         5  
  3         89  
5              
6 3     3   17 use Carp;
  3         6  
  3         271  
7             #use Smart::Comments -ENV;
8              
9 3     3   15 use base qw(WWW::BigDoor::Resource Class::Accessor);
  3         58  
  3         1234  
10              
11             __PACKAGE__->follow_best_practice;
12             __PACKAGE__->mk_accessors( qw(id read_only url attributes is_for_end_user_ui is_media_url) );
13              
14             # FIXME DRY with Attribute
15             sub associate_with {
16 1     1 1 4243 my ( $self, $resource, $client ) = @_;
17              
18 1 50       7 unless ( defined $self->get_id ) {
19 0         0 croak 'URL should have ID - save before associating';
20             }
21 1 50       20 unless ( defined $resource->get_id ) {
22 0         0 croak 'Object should have ID - save before associating';
23             }
24 1         16 my $ep = $self->_end_point;
25              
26 1         7 my $result = $client->POST(
27             sprintf( '%s/%s/%s/%s',
28             $ep, $self->get_id, $resource->get_resource_name,
29             $resource->get_id ),
30             {format => 'json'}
31             );
32 1         9 return $result;
33             }
34              
35             1;
36             __END__