Skip to content

dblock/strava-ruby-cli

Repository files navigation

Strava Command-Line Client

Gem Version Build Status

A command-line client for Strava Strava API v3.

Table of Contents

Installation

gem install 'strava-ruby-cli'

Usage

Authentication

Strava commands require a Strava Client ID and Client Secret from Your API Application. The command-line tool with prompt you for these or you can supply them with --client_id and --client_secret options. You can also adjust access scope with --scope.

The client will fetch an access token. This will open a new browser window, navigate to Strava, request the appropriate permissions, then handle OAuth in a local redirect. The token type, refresh token, access token and token expiration will be displayed in the browser and subsequently used.

You can note the access token and supply it via --access_token to avoid being prompted in the future.

Run Commands

Use strava run to execute commands against the Strava API. Everything in strava-ruby-client is supported.

$ strava run athlete.username

dblockdotorg

Because this is Ruby, you can could fetch all currently logged-in athlete attributes in JSON.

$ strava run athlete.to_json

{"id":26462176,"username":"dblockdotorg", ...}

To retrieve activities you need the activity:read scope.

$ strava --scope=activity:read run athlete_activities.first.name

TCS NYC Marathon 2018

Strava Console

Use strava console to explore the Strava API interactively.

$ strava console

Strava> athlete.name

"Daniel Doubrovkine"

Contributing

See CONTRIBUTING.

Copyright and License

Copyright (c) 2019, Daniel Doubrovkine and Contributors.

This project is licensed under the MIT License.