NAME

WWW::BackpackTF::Listing - Class representing a classified listing

SYNOPSIS

  use WWW::BackpackTF;
  use Data::Dumper qw/Dumper/;
  use POSIX qw/strftime/;

  my $bp = WWW::BackpackTF->new(key => '...');
  my $steamid = $ARGV[0];
  my @listings = $bp->get_user_listings($steamid);
  my $listing = $listings[0];

  say 'Item: ', Dumper $listing->item;
  say 'The user is selling this item' if $listing->is_selling;
  say 'The user is buying this item'  if $listing->is_buying;
  my %currencies = %{$listing->currencies};
  say 'Price: ', join ' + ', map { "$currencies{$_} $_" } keys %currencies;
  say 'Details: ', $listing->details;
  say 'Created at: ',     strftime '%c', localtime $listing->created;
  say 'Last bumped at: ', strftime '%c', localtime $listing->bump;

DESCRIPTION

WWW::BackpackTF::Listing is a class representing a classified listing.

METHODS

item

The item being sold, as a hashref. Contains keys like defindex and quality.

currencies

The price of the listing, as a hashref. The keys are the internal names of the currencies (can be identified using get_currencies in WWW::BackpackTF) and the values are the amounts.

details

The message on the listing

bump

UNIX timestamp of when the listing was last bumped.

created

UNIX timestamp of when the listing was created.

id

The internal ID of the listing.

is_selling

True if the user is selling this item.

is_buying

True if the user is buying this item.

intent

1 if the user is selling the item, 0 if the user is buying.

SEE ALSO

http://backpack.tf/api/IGetPrices

AUTHOR

Marius Gavrilescu, <marius@ieval.ro>

COPYRIGHT AND LICENSE

Copyright (C) 2014-2017 by Marius Gavrilescu

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.18.2 or, at your option, any later version of Perl 5 you may have available.