GithubHelp home page GithubHelp logo

strava-ruby-cli's Introduction

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.

strava-ruby-cli's People

Contributors

dblock avatar mattdsteele avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

mattdsteele

strava-ruby-cli's Issues

Missing specs

Lots of CLI specs are pending. CLI is a bit difficult to test, but not impossible.

First-time usage, CLI hanging during authentication (Linux)

๐Ÿ‘‹ Hi!

I'm excited to give this a shot, but I'm having trouble getting authentication to work.

I've created an API id and secret in Strava; installed Ruby 2.5.5 and the CLI through rubygems, but any attempt at authentication hangs after entering my credentials:

Here's where it hangs:

matt@penguin:~$ strava run athlete
[2020-05-31 13:00:42] INFO  WEBrick 1.4.2
[2020-05-31 13:00:42] INFO  ruby 2.5.5 (2019-03-15) [aarch64-linux-gnu]
Enter Strava client ID: *****
Enter Strava client secret: ****************************************
[2020-05-31 13:00:52] INFO  WEBrick::HTTPServer#start: pid=12884 port=4242

Hitting ctrl+c results in an ^Cerror: Authorization Error message.

I've tried this on a few Linux workstations (WSL2 Linux container running Debian 10, a "native" Ubuntu 20.04, and a Chromebook crostini container on Debian 10); all with the same result.

Have you seen this error before, maybe I'm missing something in the setup process?

Ensure error if the browser can't launch

Looks like if the browser can't launch there's no error.

For the auth workflow with the cli we want to terminate the local server and fail with a clear error if that's the case.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.