Skip to content

ericblue/Perl-Zeo-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NAME
    WebService::Zeo - OO Perl API used to fetch sleep data from myzeo.com

SYNOPSIS
    Sample Usage:

        use WebService::Zeo;
    
        my $zeo = WebService::Zeo->new(
            # Requires API registration
            'apikey' => 'XXYYZZ...',
            # Credentials used to login to myzeo
            'username' => 'user@domain.com',
            'password' => 'foo' 
        );
    
        # Alternatively a config file can be used - generated by initialize_zeo_config.pl
    
        my $zeo = WebService::Zeo->new(config => '/home/user/zeo.conf');
    
        print "Overall Average ZQ Score = " . $zeo->get_overall_average_zq_score() . "\n";
    
        print "Overall Average Day Feel Score = " . $zeo->get_overall_average_day_feel_score() . "\n";
    
        print "Overall Average Morning Feel Score = " . $zeo->get_overall_average_morning_feel_score() . "\n";
    
        print "Overall Average Sleep Stealer Score = " . $zeo->get_overall_average_sleep_stealer_score() . "\n";
    
        my @dates = $zeo->get_all_dates_with_sleep_data();
        print "Total recordered dates of sleep data = " , $#dates , "\n";
    
        my @dates_in_range = $zeo->get_dates_with_sleep_data_in_range("2010-12-01","2010-12-04");
        print "Total recordered dates of sleep data = " . $#dates_in_range . "\n";
    
        print Dumper $zeo->get_sleep_stats_for_date("2010-12-27");
    
        print Dumper $zeo->get_sleep_record_for_date("2010-12-27");
    
        print Dumper $zeo->get_previous_sleep_stats("2010-12-31");
    
        print Dumper $zeo->get_previous_sleep_record("2010-12-31");
    
        print Dumper $zeo->get_next_sleep_stats("2010-12-25");
    
        print Dumper $zeo->get_next_sleep_record("2010-12-25");
    
        print Dumper $zeo->get_earliest_sleep_stats();
    
        print Dumper $zeo->get_earliest_sleep_record();
    
        print Dumper $zeo->getLatestSleepStats();
    
        print Dumper $zeo->getLatestSleepRecord();

DESCRIPTION
    Zeo (http://myzeo.com) is a product and program that measures your
    personal sleep patterns and records key information to help you learn to
    get a better nights sleep. "WebService::Zeo" provides an OO API for
    fetching this sleep data from myzeo.com.

    The following information is required in order to use the API: -
    Username for your myzeo.com account (e.g. username@domain.com) -
    Password for your myzeo.com account - API Key (Can be obtained at
    http://mysleep.myzeo.com/api/api.shtml)

    This module currently supports the JSON REST-based API and uses HTTPS.
    Testing has been performed against server version 1.0.4158 (as of
    1/1/11).

METHODS
    See MyZeo developer API documentation for a detailed description of
    methods, parameters, requests, and responses. This module implements all
    supported methods in the service catalog:

    Overall Average Functions:

        * getOverallAverageZQScore - Returns the average ZQ score for the user.
        * getOverallAverageDayFeelScore - Returns the average score for how the user felt during the day.
        * getOverallAverageMorningFeelScore - Returns the average score for how the user felt in the morning.
        * getOverallAverageSleepStealerScore - Returns the average sleep stealer score for the user.

    Date Functions:

        * getAllDatesWithSleepData - Returns an array of ZeoDate objects representing dates for which sleep data is available.
        * getDatesWithSleepDataInRange - Returns an array of ZeoDate objects for which sleep data is available inclusive in dates.
        * getSleepStatsForDate - Returns the SleepStats for the specified date.
        * getSleepRecordForDate - Returns the SleepRecord for the specified date.

    Paging Functions:

        * getPreviousSleepStats - Returns the SleepStats (grouped by day) for the latest date prior to the specified date.
        * getPreviousSleepRecord - Returns the SleepRecord for the latest date prior to the specified date.
        * getNextSleepStats - Returns the SleepStats (grouped by day) for the earliest date after the specified date.
        * getNextSleepRecord - Returns the SleepStats for the earliest date after the specified date.
        * getEarliestSleepStats - Returns the SleepStats (grouped by day) with the earliest date on record for the current user.
        * getEarliestSleepRecord - Returns the SleepRecord with the earliest date on record for the current user.
        * getLatestSleepStats - Returns the SleepStats (grouped by day) with the latest date on record for the current user.
        * getLatestSleepRecord - Returns the SleepRecord with the latest date on record for the current user.

    Miscellaneous Functions:

        * logout - Logs the user out of the API and closes the session.

EXAMPLE CODE
    See dump_zeo_csv.pl

AUTHOR
    Eric Blue <ericblue76@gmail.com> - http://eric-blue.com

COPYRIGHT
    Copyright (c) 2011 Eric Blue. This program is free software; you can
    redistribute it and/or modify it under the same terms as Perl itself.

About

OO Perl API used to fetch sleep data from myzeo.com

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published