NAME

WebService::Strava - Access Strava via version 3 of the API

VERSION

version 0.03

SYNOPSIS

use WebService::Strava;

my $strava = WebService::Strava->new();

DESCRIPTION

Provides an abstraction layer to version 3 of the Strava API. http://strava.github.io/api/v3/.

Attempts to provide a few logical shortcut methods and provide simple OAuth2 abstraction to take the hassle out of accessing it in a scripted manner.

You can use the cli client to provide an easy setup after configuring api access in you strava profile https://www.strava.com/settings/api

strava --setup

Which can also be called within your script via

$strava->auth->setup();

METHODS

athlete

$strava->athlete([$id]);

Takes an optional id and will retrieve a WebService::Strava::Athlete with details Athlete retrieved. Currently authenticated user will be returned unless an ID is provided.

clubs

$strava->clubs([1]);

Returns an arrayRef of WebService::Strava::Club for the currently authenticated user. Takes an optional 1 or 0 (default 0) that will retrieve all club details.

After instantiation it is possible to retrieve members associated with the club.

my $club = @{$strava->clubs()}[0];
$club->list_members([page => 2], [activities => 100]);

Returns an arrayRef athletes for the Club. Takes 2 optional parameters of 'page' and 'members' (per page).

The results are paginated and a maximum of 200 results can be returned per page.

segment

$strava->segment($id);

Takes an mandatory id and will retrieve a WebService::Strava::Segment with details about the Segment ID retrieved.

After instantiation it is possible to retrieve efforts listed for that segment. It takes 3 optional named parameters of 'athlete_id', 'page' and 'efforts'.

$segment->list_efforts([athlete_id => 123456], [page => 2], [efforts => 100], [raw => 1])'

Returns the Segment efforts for a particular segment. Takes 4 optional parameters of 'athlete_id', 'page', 'efforts' and 'raw'. Raw will return the an array segment_effort data instead of WebService::Strava::Athlete::Segment_Effort objects.

* 'athelete_id' will return the segment efforts (if any) for the athelete
  in question.

The results are paginated and a maximum of 200 results can be returned per page.

list_starred_segments

$segment->list_starred_segments([page => 2], [activities => 100])

Returns an arrayRef of starred WebService::Strava::Segment objects for the current authenticated user. Takes 2 optional parameters of 'page' and 'activities' (per page).

The results are paginated and a maximum of 200 results can be returned per page.

effort

$strava->effort($id);

Takes an mandatory id and will retrieve a WebService::Strava::Athlete::Segment_Effort with details about the Segment Effort ID retrieved.

activity

$strava->activity($id);

Takes an mandatory id and will retrieve a WebService::Strava::Athlete::Activity with details about the Activity ID retrieved.

list_activities

$athlete->list_activities([page => 2], [activities => 100], [before => 1407665853], [after => 1407665853]);

Returns an arrayRef of WebService::Strava::Athlete::Activity objects for the current authenticated user. Takes 4 optional parameters of 'page', 'activities' (per page), 'before' (activities before unix epoch), and 'after' (activities after unix epoch).

The results are paginated and a maximum of 200 results can be returned per page.

list_friends_activities

$athlete->list_activities([page => 2], [activities => 100])

Returns an arrayRef activities for friends of the current authenticated user. Takes 2 optional parameters of 'page' and 'activities' (per page).

The results are paginated and a maximum of 200 results can be returned per page.

ACKNOWLEDGEMENTS

Fred Moyer <fred@redhotpenguin.com> - Giving me Co-Maint on WebService::Strava

Paul Fenwick <pjf@cpan.org> - For being generally awesome, providing inspiration, assistance and a lot of boiler plate for this library.

BUGS/Feature Requests

Please submit any bugs, feature requests to https://github.com/techamn83/WebService-Strava3/issues .

Contributions are more than welcome! I am aware that Dist::Zilla comes with quite a dependency chain, so feel free to submit pull request with code + explanation of what you are trying to achieve and I will test and likely implement them.

AUTHOR

Leon Wright < techman@cpan.org >

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Leon Wright.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.