X-Git-Url: http://git.ieval.ro/?p=www-backpacktf.git;a=blobdiff_plain;f=lib%2FWWW%2FBackpackTF%2FMarketItem.pm;fp=lib%2FWWW%2FBackpackTF%2FMarketItem.pm;h=843ac60b091152620e7677ee19d07ab7add20c07;hp=0000000000000000000000000000000000000000;hb=fa7f4d7f5222dc5e0137267caf76a04d5fb2300a;hpb=0aaa9b980d349153117dbfa46a4dfae24ace1e25 diff --git a/lib/WWW/BackpackTF/MarketItem.pm b/lib/WWW/BackpackTF/MarketItem.pm new file mode 100644 index 0000000..843ac60 --- /dev/null +++ b/lib/WWW/BackpackTF/MarketItem.pm @@ -0,0 +1,88 @@ +package WWW::BackpackTF::MarketItem; + +use 5.014000; +use strict; +use warnings; +our $VERSION = '0.002'; + +sub new{ + my ($class, $name, $content) = @_; + $content->{name} = $name; + bless $content, $class +} + +sub name { shift->{name} } +sub last_updated { shift->{last_updated} } +sub quantity { shift->{quantity} } +sub value { shift->{value} } + +1; +__END__ + +=encoding utf-8 + +=head1 NAME + +WWW::BackpackTF::MarketItem - Class representing market item information + +=head1 SYNOPSIS + + use WWW::BackpackTF; + use Data::Dumper qw/Dumper/; + use POSIX qw/strftime/; + + my $bp = WWW::BackpackTF->new(key => '...'); + my @items = $bp->get_market_prices; + my $item = $items[0]; + say 'Name: ', $item->name; + say strftime 'Last updated on: %c', localtime $item->last_updated; + say 'Quantity available on market: ', $item->quantity; + say 'Value of item: $', sprintf '%.2f', $item->value / 100; + +=head1 DESCRIPTION + +WWW::BackpackTF::MarketItem is a class representing Steam Community +Market price information about an item. + +=head2 METHODS + +=over + +=item B + +The name of the item. + +=item B + +The timestamp of this information, as seconds since unix epoch. + +=item B + +How many items of this kind are there on the SCM. + +=item B + +The price this item is selling for, in cents (USD 0.01). + +=back + +=back + +=head1 SEE ALSO + +L + +=head1 AUTHOR + +Marius Gavrilescu, Emarius@ieval.roE + +=head1 COPYRIGHT AND LICENSE + +Copyright (C) 2014-2016 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. + + +=cut