NAME Weightbot::API - get Weightbot iPhone app data from weightbot.com VERSION Version 0.03 SYNOPSIS There is a great iPhone weight tracking app http://tapbots.com/software/weightbot/. It backups its data to the site https://weightbot.com/ where everyone using that app can login and download the file with the records. This module gets that data and shows it as a pretty data structure. use Weightbot::API; use Data::Dumper; my $wi = Weightbot::API->new({ email => 'user@example.com', password => '******', }); say $wi->raw_data; say Dumper $wi->data; The object does not send requests to site until data needs to be retrieved. The first invocation of either data() or raw_data() methods will get data from the site and it will be stored in the object, so you can use raw_data() and data() many times without unnecessary requests to the site. Site https://weightbot.com/ does not have real API, this module behaves as a browser. NOTES While debugging your programme that uses this module it is not a great idea to send requests to weightbot.com on every test run. This module can cache data to file. The module will read data from the cache file if the file exists or will download data and save it to the file if there is no cache file. To use this feature you should create Weightbot::API object with: my $wi = Weightbot::API->new({ email => 'user@example.com', password => '******', use_cache_file => 1, cache_file => '/storage/weightbot.raw', # optional }); The default value for 'cache_file' is '/tmp/weightbot.data'. So when you debug your programme you can specify 'use_cache_file'. Then on first run the data will be downloaded from weightbot.com and saved to file and all other runs will use data from the file without asking weightbot.com. SUBROUTINES/METHODS new Creates new object. It has to get parameters 'email' and 'password'. Optionally you can specify 'site' with some custom site url (default is 'https://weightbot.com'). The other optional thing is to specify 'raw_data'. my $wi = Weightbot::API->new({ email => 'user@example.com', password => '******', }); raw_data Returns the weight records in the format as they are stored on the site. Here is an example: date, kilograms, pounds 2008-12-04, 80.9, 178.4 2008-12-05, 82.6, 182.1 2008-12-06, 81.9, 180.6 2008-12-08, 82.6, 182.1 Any subsequent call to this method will not result in actual data retrieval as the data is cached within the object. data Returns the weight data in a structure. In that data some dates can be skipped. In this structure all the dates are present, but if there is no weight for that date the empty sting is used. An example for the data show in raw_data() method: $VAR1 = [ { 'n' => 1, 'date' => '2008-12-04', 'kg' => '80.9', 'lb' => '178.4' }, { 'n' => 2, 'date' => '2008-12-05', 'kg' => '82.6', 'lb' => '182.1' }, { 'n' => 3, 'date' => '2008-12-06', 'kg' => '81.9', 'lb' => '180.6' }, { 'n' => 4, 'date' => '2008-12-07', 'kg' => '', 'lb' => '' }, { 'n' => 5, 'date' => '2008-12-08', 'kg' => '82.6', 'lb' => '182.1' } ]; Any subsequent call to this method will not result in actual data retrieval as the data is cached within the object. AUTHOR Ivan Bessarabov, `' CONTRIBUTORS Evgeniy Kosov `' BUGS Please report any bugs or feature requests to `bug-weightbot-api at rt.cpan.org', or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Weightbot-API. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. You can also submit a bug or a feature request on GitHub. SOURCE CODE The source code for this module is hosted on GitHub http://github.com/bessarabov/Weightbot-API SUPPORT You can find documentation for this module with the perldoc command. perldoc Weightbot::API You can also look for information at: * RT: CPAN's request tracker http://rt.cpan.org/NoAuth/Bugs.html?Dist=Weightbot-API * AnnoCPAN: Annotated CPAN documentation http://annocpan.org/dist/Weightbot-API * CPAN Ratings http://cpanratings.perl.org/d/Weightbot-API * Search CPAN http://search.cpan.org/dist/Weightbot-API/ ACKNOWLEDGEMENTS LICENSE AND COPYRIGHT Copyright 2011 Ivan Bessarabov. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information.