File Coverage

blib/lib/Object/eBay/ListingDetails.pm
Criterion Covered Total %
statement 12 28 42.8
branch 0 8 0.0
condition n/a
subroutine 4 9 44.4
pod 5 5 100.0
total 21 50 42.0


line stmt bran cond sub pod time code
1             package Object::eBay::ListingDetails;
2             our $VERSION = '0.5.1';
3              
4 3     3   52683 use Class::Std; {
  3         30847  
  3         19  
5 3     3   650 use warnings;
  3         206  
  3         102  
6 3     3   15 use strict;
  3         7  
  3         93  
7 3     3   14 use base qw( Object::eBay );
  3         6  
  3         2101  
8              
9             # ListingDetails is a second-class citizen because there's no eBay API
10             # call that returns just a ListingDetails object.
11 0     0 1   sub api_call { q{} };
12 0     0 1   sub response_field { q{} };
13              
14             __PACKAGE__->simple_attributes(qw{
15             EndTime
16             StartTime
17             });
18              
19             __PACKAGE__->complex_attributes({
20             BuyItNowAvailable => { # we'll wrap this in is_buy_it_now_available
21             class => 'Boolean',
22             }
23             });
24              
25             # this is necessary because BuyItNowAvailable is missing
26             # if the BIN price is 0
27             sub is_buy_it_now_available {
28 0     0 1   my ($self) = @_;
29 0           my $answer = eval { $self->buy_it_now_available };
  0            
30 0           my $exception = $@;
31 0 0         return $answer if not $exception;
32              
33 0 0         if ( $exception =~ m/Can't find 'BuyItNowAvailable' via/ ) {
34 0           return Object::eBay::Boolean->new({
35             object_details => 'false',
36             });
37             }
38 0           die $exception; # rethrow the exception
39             }
40              
41             sub end_datetime {
42 0     0 1   my ($self) = @_;
43 0 0         my $iso = $self->end_time or die "EndTime was unavailable\n";
44 0           return $self->_make_datetime($iso);
45             }
46              
47             sub start_datetime {
48 0     0 1   my ($self) = @_;
49 0 0         my $iso = $self->start_time or die "StartTime was unavailable\n";
50 0           return $self->_make_datetime($iso);
51             }
52             }
53              
54             1;
55              
56             __END__