]>
iEval git - www-backpacktf.git/blob - lib/WWW/BackpackTF/Listing.pm
1 package WWW
::BackpackTF
::Listing
;
6 our $VERSION = '0.002001';
9 my ($class, $content) = @_;
10 bless $content, $class
13 sub id
{ shift->{id
} }
14 sub currencies
{ shift->{currencies
} }
15 sub item
{ shift->{item
} }
16 sub details
{ shift->{details
} }
17 sub bump
{ shift->{bump
} }
18 sub created
{ shift->{created
} }
19 sub intent
{ shift->{intent
} }
20 sub is_selling
{ shift->intent == 1 }
21 sub is_buying
{ shift->intent == 0 }
30 WWW::BackpackTF::Listing - Class representing a classified listing
35 use Data::Dumper qw/Dumper/;
36 use POSIX qw/strftime/;
38 my $bp = WWW::BackpackTF->new(key => '...');
39 my $steamid = $ARGV[0];
40 my @listings = $bp->get_user_listings($steamid);
41 my $listing = $listings[0];
43 say 'Item: ', Dumper $listing->item;
44 say 'The user is selling this item' if $listing->is_selling;
45 say 'The user is buying this item' if $listing->is_buying;
46 my %currencies = %{$listing->currencies};
47 say 'Price: ', join ' + ', map { "$currencies{$_} $_" } keys %currencies;
48 say 'Details: ', $listing->details;
49 say 'Created at: ', strftime '%c', localtime $listing->created;
50 say 'Last bumped at: ', strftime '%c', localtime $listing->bump;
54 WWW::BackpackTF::Listing is a class representing a classified listing.
62 The item being sold, as a hashref. Contains keys like C<defindex> and
67 The price of the listing, as a hashref. The keys are the internal
68 names of the currencies (can be identified using B<get_currencies> in
69 L<WWW::BackpackTF>) and the values are the amounts.
73 The message on the listing
77 UNIX timestamp of when the listing was last bumped.
81 UNIX timestamp of when the listing was created.
85 The internal ID of the listing.
89 True if the user is selling this item.
93 True if the user is buying this item.
97 1 if the user is selling the item, 0 if the user is buying.
103 L<http://backpack.tf/api/IGetPrices>
107 Marius Gavrilescu, E<lt>marius@ieval.roE<gt>
109 =head1 COPYRIGHT AND LICENSE
111 Copyright (C) 2014-2017 by Marius Gavrilescu
113 This library is free software; you can redistribute it and/or modify
114 it under the same terms as Perl itself, either Perl version 5.18.2 or,
115 at your option, any later version of Perl 5 you may have available.
This page took 0.051911 seconds and 5 git commands to generate.