The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

WWW::BackpackTF::Item - Class representing item information

SYNOPSIS

  use WWW::BackpackTF qw/VINTAGE GENUINE UNUSUAL/;
  use Data::Dumper qw/Dumper/;

  my @items = $bp->get_prices;
  my $item = $items[0];
  say 'Name: ', $item->name;
  say 'Linked defindexes: ', join ' ', $item->defindex;
  say 'Price of Unique, Tradable, Craftable version: ', $item->price;
  say 'Price of Vintage, Tradable, Craftable version: ',                Dumper $item->price(VINTAGE);
  say 'Price of Vintage, Non-Tradable, Craftable version: ',            Dumper $item->price(VINTAGE, 0);
  say 'Price of Genuine, Non-Tradable, Non-Craftable version: ',        Dumper $item->price(GENUINE, 0, 0);
  say 'Price of Unusual, Tradable, Craftable version with effect 10: ', Dumper $item->price(UNUSUAL, 1, 1, 10);

DESCRIPTION

WWW::BackpackTF::Item is a class representing price information about an item.

METHODS

name

The name of the item.

defindex

In list context, a list of defindexes linked to the item. In scalar context, the first such defindex.

price([$quality, [$tradable, [$craftable, [$priceindex]]]])

The price of an item. Takes four optional arguments: the quality (defaults to 6, which is Unique), the tradability of the item (defaults to true), the craftability of an item (defaults to true), and the priceindex (crate series/unusual effect, defaults to none).

Returns an hashref with the following keys/values:

currency

The currency the item's price is in.

value

The price.

value_high

If present, the upper range of the price range.

value_raw

The price in the lowest currency, without rounding. Only present if get_prices was called with a true value for $raw.

last_update

Timestamp of last price update.

difference

The difference bitween the former price and the current price. 0 if the current price is new.

SEE ALSO

http://backpack.tf/api/prices

AUTHOR

Marius Gavrilescu, <marius@ieval.ro>

COPYRIGHT AND LICENSE

Copyright (C) 2014 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.