]>
Commit | Line | Data |
---|---|---|
1 | package WWW::BackpackTF::MarketItem; | |
2 | ||
3 | use 5.014000; | |
4 | use strict; | |
5 | use warnings; | |
6 | our $VERSION = '0.002001'; | |
7 | ||
8 | sub new{ | |
9 | my ($class, $name, $content) = @_; | |
10 | $content->{name} = $name; | |
11 | bless $content, $class | |
12 | } | |
13 | ||
14 | sub name { shift->{name} } | |
15 | sub last_updated { shift->{last_updated} } | |
16 | sub quantity { shift->{quantity} } | |
17 | sub value { shift->{value} } | |
18 | ||
19 | 1; | |
20 | __END__ | |
21 | ||
22 | =encoding utf-8 | |
23 | ||
24 | =head1 NAME | |
25 | ||
26 | WWW::BackpackTF::MarketItem - Class representing market item information | |
27 | ||
28 | =head1 SYNOPSIS | |
29 | ||
30 | use WWW::BackpackTF; | |
31 | use Data::Dumper qw/Dumper/; | |
32 | use POSIX qw/strftime/; | |
33 | ||
34 | my $bp = WWW::BackpackTF->new(key => '...'); | |
35 | my @items = $bp->get_market_prices; | |
36 | my $item = $items[0]; | |
37 | say 'Name: ', $item->name; | |
38 | say strftime 'Last updated on: %c', localtime $item->last_updated; | |
39 | say 'Quantity available on market: ', $item->quantity; | |
40 | say 'Value of item: $', sprintf '%.2f', $item->value / 100; | |
41 | ||
42 | =head1 DESCRIPTION | |
43 | ||
44 | WWW::BackpackTF::MarketItem is a class representing Steam Community | |
45 | Market price information about an item. | |
46 | ||
47 | =head2 METHODS | |
48 | ||
49 | =over | |
50 | ||
51 | =item B<name> | |
52 | ||
53 | The name of the item. | |
54 | ||
55 | =item B<last_updated> | |
56 | ||
57 | The timestamp of this information, as seconds since unix epoch. | |
58 | ||
59 | =item B<quantity> | |
60 | ||
61 | How many items of this kind are there on the SCM. | |
62 | ||
63 | =item B<value> | |
64 | ||
65 | The price this item is selling for, in cents (USD 0.01). | |
66 | ||
67 | =back | |
68 | ||
69 | =head1 SEE ALSO | |
70 | ||
71 | L<http://backpack.tf/api/docs/IGetMarketPrices> | |
72 | ||
73 | =head1 AUTHOR | |
74 | ||
75 | Marius Gavrilescu, E<lt>marius@ieval.roE<gt> | |
76 | ||
77 | =head1 COPYRIGHT AND LICENSE | |
78 | ||
79 | Copyright (C) 2014-2017 by Marius Gavrilescu | |
80 | ||
81 | This library is free software; you can redistribute it and/or modify | |
82 | it under the same terms as Perl itself, either Perl version 5.18.2 or, | |
83 | at your option, any later version of Perl 5 you may have available. | |
84 | ||
85 | ||
86 | =cut |