README.md in strava-ruby-client-0.3.1 vs README.md in strava-ruby-client-0.3.2

- old
+ new

@@ -61,19 +61,22 @@ - [Get Upload](#get-upload) - [Pagination](#pagination) - [OAuth](#oauth) - [OAuth Workflow](#oauth-workflow) - [Deauthorize](#deauthorize) + - [Command Line OAuth Workflow](#command-line-oauth-workflow) - [Webhooks](#webhooks) - [Configuration](#configuration) - [Web Client Options](#web-client-options) - [API Client Options](#api-client-options) - [OAuth Client Options](#oauth-client-options) - [Webhooks Client Options](#webhooks-client-options) - [Errors](#errors) - [Tools](#tools) - [Strava OAuth Token](#strava-oauth-token) +- [Users](#users) +- [Resources](#resources) - [Contributing](#contributing) - [Copyright and License](#copyright-and-license) ## Installation @@ -841,10 +844,16 @@ authorization = client.deauthorize authorization.access_token # => String, access token being revoked ``` +#### Command Line OAuth Workflow + +The OAuth process is web-based and you cannot obtain a token from a Strava client ID and secret without user intervention. You can, however, start a local web server to handle the OAuth redirect and open a browser from the command-line. + +See [strava-oauth-token](/bin/strava-oauth-token) or [strava-ruby-cli](https://github.com/dblock/strava-ruby-cli) for an example. + ### Webhooks Strava provides a [Webhook Event API](https://developers.strava.com/docs/webhooks/) that requires special access obtained by emailing [developers@strava.com](mailto:developers@strava.com). A complete example that handles subscription creation, deletion and handling can be found in [strava-webhooks](bin/strava-webhooks). Run `strava-webhooks` to see current registrations, `strava-webhooks handle` to run an HTTP server that handles both challenges and event data, `strava-webhooks create [url]` to create a new subscription and `strava-webhooks delete [id]` to delete it. @@ -1014,11 +1023,11 @@ setting | description --------------------|------------ client_id | Application client ID. client_secret | Application client secret. -endpoint | Defaults to `https://api.strava.com/api/v3`. +endpoint | Defaults to `https://www.strava.com/api/v3`. ## Errors All errors that return HTTP codes 400-600 result in either `Faraday::Error::ResourceNotFound`, `Faraday::Error::ConnectionFailed` or [Strava::Errors::Fault](lib/strava/errors/fault.rb) exceptions. @@ -1026,21 +1035,37 @@ begin client.oauth_token(code: 'invalid') rescue Strava::Errors::Fault => e e.message # => Bad Request e.errors # => [{ 'code' => 'invalid', 'field' => 'code', 'resource' => 'RequestToken' }] + e.headers # => { "status" => "403 Bad Request", "x-ratelimit-limit" => "600,30000", "x-ratelimit-usage" => "314,27536" } end ``` ## Tools +For a complete set of command-line tools, check out [strava-ruby-cli](https://github.com/dblock/strava-ruby-cli) built on top of this gem. + ### Strava OAuth Token -Use [strava-oauth-token](bin/strava-outh-token) to obtain a token from the command-line. 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. +Use [strava-oauth-token](bin/strava-oauth-token) to obtain a token from the command-line. 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. ```bash $ STRAVA_CLIENT_ID=... STRAVA_CLIENT_SECRET=... strava-oauth-token ``` + +## Users + +* [Slava: Strava integration with Slack](https://slava.playplay.io), [source](https://github.com/dblock/slack-strava). +* [Jekyll Blog at run.dblock.org](https://run.dblock.org), [source](https://github.com/dblock/run.dblock.org) + +## Resources + +* [Strava API Documentation](https://developers.strava.com) +* [Writing a New Strava API Ruby Client](https://code.dblock.org/2018/11/27/writing-a-new-strava-api-ruby-client.html) +* [Dealing with Strava API OAuth Token Migration](https://code.dblock.org/2018/11/17/dealing-with-strava-api-token-migration.html) +* [Auto-Publishing Strava Runs to Github Pages](https://code.dblock.org/2018/02/17/auto-publishing-strava-runs-to-github-pages.html) +* [Strava Command-Line Client](https://github.com/dblock/strava-ruby-cli) ## Contributing See [CONTRIBUTING](CONTRIBUTING.md).