File Coverage

blib/lib/WebService/GData/YouTube/Feed/Complaint.pm
Criterion Covered Total %
statement 29 35 82.8
branch 5 8 62.5
condition n/a
subroutine 8 9 88.8
pod 3 3 100.0
total 45 55 81.8


line stmt bran cond sub pod time code
1             package WebService::GData::YouTube::Feed::Complaint;
2              
3 3     3   44678 use WebService::GData;
  3         7  
  3         20  
4 3     3   19 use base 'WebService::GData::Feed::Entry';
  3         7  
  3         1012  
5 3     3   18 use WebService::GData::Constants qw(:all);
  3         7  
  3         2226  
6 3     3   699 use WebService::GData::YouTube::Constants qw(:all);
  3         14  
  3         1454  
7 3     3   694 use WebService::GData::YouTube::StagingServer ();
  3         7  
  3         7137  
8             our $VERSION = 0.01_01;
9              
10             our $BASE_URI = BASE_URI . PROJECTION . '/videos/';
11             our $WRITE_BASE_URI = $BASE_URI;
12              
13             if(WebService::GData::YouTube::StagingServer->is_on){
14             $WRITE_BASE_URI = STAGING_BASE_URI . PROJECTION . '/videos/';
15             }
16              
17             sub __init {
18 1     1   4 my ( $this, $feed, $req ) = @_;
19              
20 1 50       6 if ( ref($feed) eq 'HASH' ) {
21 1         12 $this->SUPER::__init( $feed, $req );
22             }
23             else {
24 0         0 $this->SUPER::__init( {}, $feed );#$feed ==$req here
25             }
26 1         3 push @{$this->category},{
  1         26  
27             term => 'SPAM',
28             scheme => 'http://gdata.youtube.com/schemas/2007/complaint-reasons.cat'
29             };
30             }
31              
32             sub video_id {
33 2     2 1 8 my ( $this, $id ) = @_;
34 2 100       7 if ($id) {
35 1         2 $this->{_video_id} = $id;
36 1         3 return $id;
37             }
38 1         5 return $this->{_video_id};
39             }
40              
41             sub reason {
42 3     3 1 7 my ( $this, $reason ) = @_;
43 3 100       7 if ($reason) {
44 1         8 $this->category->[0]->term($reason);
45             }
46 3         19 return $this->category->[0]->term;
47             }
48              
49             sub save {
50 0     0 1   my $this = shift;
51              
52 0 0         if ( $this->video_id ) {
53 0           my $content= XML_HEADER . $this->serialize();
54 0           my $ret =$this->{_request}->insert( $WRITE_BASE_URI . $this->video_id . '/complaints/', $content );
55 0           return $ret;
56             }
57             }
58              
59             "The earth is blue like an orange.";
60              
61             __END__