Object::eBay::ListingDetails - Represents an item's listing details


Object-eBay documentation Contained in the Object-eBay distribution.

Index


Code Index:

NAME

Top

Object::eBay::ListingDetails - Represents an item's listing details

SYNOPSIS

Top

    # assuming that $item contains an Object::eBay::Item object
    my $end_time = $item->listing_details->end_time();
    print "Ends: $end_time\n";   # "Ends: 2005-09-03T12:18:19.21.000Z"

DESCRIPTION

Top

Represents listing details about an eBay item.

METHODS

Top

new

Objects of class Object::eBay::ListingDetails cannot be constructed directly.

end_datetime

Similar to end_time except it returns a DateTime object. If this method is invoked, you must have a version of the DateTime package installed.

end_time

Returns an ISO8601 formatted string indicating the UTC time that the item is scheduled to end. If the item has ended, it indicates the time when the item ended.

is_buy_it_now_available

Returns an Object::eBay::Boolean object indicating whether or not this auction has buy it now available at the moment. An auction might be listed with a Buy It Now price but once a bid is placed, Buy It Now is no longer available. There are some other business rules which might affect whether or not Buy It Now is available. See http://xrl.us/dwo72 for some details.

start_datetime

Similar to start_time except it returns a DateTime object. If this method is invoked, you must have a version of the DateTime package installed.

start_time

Returns an ISO8601 formatted string indicating the UTC time that the item started.

DIAGNOSTICS

Top

None

CONFIGURATION AND ENVIRONMENT

Top

Object::eBay::ListingDetails requires no configuration files or environment variables.

DEPENDENCIES

Top

* Class::Std
* Object::eBay

INCOMPATIBILITIES

Top

None known.

BUGS AND LIMITATIONS

Top

Please report any bugs or feature requests to bug-object-ebay-listingdetails at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Object-eBay. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

Top

You can find documentation for this module with the perldoc command.

    perldoc Object::eBay

You can also look for information at:

* AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/Object-eBay

* CPAN Ratings

http://cpanratings.perl.org/d/Object-eBay

* RT: CPAN's request tracker

http://rt.cpan.org/NoAuth/Bugs.html?Dist=Object-eBay

* Search CPAN

http://search.cpan.org/dist/Object-eBay

ACKNOWLEDGEMENTS

Top

AUTHOR

Top

Michael Hendricks <michael@ndrix.org>

LICENSE AND COPYRIGHT

Top


Object-eBay documentation Contained in the Object-eBay distribution.

package Object::eBay::ListingDetails;
our $VERSION = '0.4.0';

use Class::Std; {
    use warnings;
    use strict;
    use base qw( Object::eBay );

    # ListingDetails is a second-class citizen because there's no eBay API
    # call that returns just a ListingDetails object.
    sub api_call       { q{} };
    sub response_field { q{} };

    __PACKAGE__->simple_attributes(qw{
        EndTime
        StartTime
    });

    __PACKAGE__->complex_attributes({
        BuyItNowAvailable => {  # we'll wrap this in is_buy_it_now_available
            class => 'Boolean',
        }
    });

    # this is necessary because BuyItNowAvailable is missing
    # if the BIN price is 0
    sub is_buy_it_now_available {
        my ($self) = @_;
        my $answer = eval { $self->buy_it_now_available };
        my $exception = $@;
        return $answer if not $exception;

        if ( $exception =~ m/Can't find 'BuyItNowAvailable' via/ ) {
            return Object::eBay::Boolean->new({
                object_details => 'false',
            });
        }
        die $exception;  # rethrow the exception
    }

    sub end_datetime {
        my ($self) = @_;
        my $iso = $self->end_time or die "EndTime was unavailable\n";
        return $self->_make_datetime($iso);
    }

    sub start_datetime {
        my ($self) = @_;
        my $iso = $self->start_time or die "StartTime was unavailable\n";
        return $self->_make_datetime($iso);
    }
}

1;

__END__