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

- old
+ new

@@ -13,10 +13,11 @@ - [Installation](#installation) - [Usage](#usage) - [Activities](#activities) - [Create an Activity](#create-an-activity) - [Get Activity](#get-activity) + - [List Activity Photos](#list-activity-photos) - [List Activity Comments](#list-activity-comments) - [List Activity Kudoers](#list-activity-kudoers) - [List Activity Laps](#list-activity-laps) - [List Athlete Activities](#list-athlete-activities) - [Get Activity Zones](#get-activity-zones) @@ -58,10 +59,12 @@ - [Uploads](#uploads) - [Upload Activity](#upload-activity) - [Get Upload](#get-upload) - [Pagination](#pagination) - [OAuth](#oauth) + - [OAuth Workflow](#oauth-workflow) + - [Deauthorize](#deauthorize) - [Webhooks](#webhooks) - [Configuration](#configuration) - [Web Client Options](#web-client-options) - [API Client Options](#api-client-options) - [OAuth Client Options](#oauth-client-options) @@ -141,10 +144,33 @@ google_image_url = "https://maps.googleapis.com/maps/api/staticmap?maptype=roadmap&path=enc:#{map.summary_polyline}&key=#{google_maps_api_key}&size=800x800&markers=color:yellow|label:S|#{start_latlng[0]},#{start_latlng[1]}&markers=color:green|label:F|#{end_latlng[0]},#{end_latlng[1]}" ``` See [Strava::Models::Map](lib/strava/models/map.rb) for all available properties. +#### List Activity Photos + +Returns the photos on the given activity. This API is undocumented. + +```ruby +photos = client.activity_photos(1982980795) # => Array[Strava::Models::Photo] + +photo = photos.first # => Strava::Models::Photo + +photo.id # => nil +photo.unique_id # => '65889142-538D-4EE5-96F5-3DC3B773B1E3' +photo.urls # => { '0' => 'https://dgtzuqphqg23d.cloudfront.net/eb4DMJ2hJW3k_g9URZEMfaJ8rZfHagrNlZRuEZz0osU-29x64.jpg' } +photo.athlete_id # => 26_462_176 +photo.activity_id # => 1_946_417_534 +photo.activity_name # => 'TCS NYC Marathon 2018' +photo.created_at # => Time +photo.uploaded_at # => Time +photo.sizes # => { '0' => [29, 64] } +photo.default_photo # => false +``` + +See [Strava::Models::Photo](lib/strava/models/photo.rb) for all available properties. + #### List Activity Comments Returns the comments on the given activity. ```ruby @@ -758,12 +784,14 @@ end ``` ### OAuth -Obtain a redirect URL. +#### OAuth Workflow +Obtain a redirect URL using an instance of `Strava::OAuth::Client`. + ```ruby client = Strava::OAuth::Client.new( client_id: "12345", client_secret: "12345678987654321" ) @@ -798,20 +826,30 @@ response = client.oauth_token( refresh_token: '...', grant_type: 'refresh_token' ) -response.access_token # new access token -response.refresh_token # new refresh token -response.expires_at # new timestamp when the access token expires +response.access_token # => String, new access token +response.refresh_token # => String, new refresh token +response.expires_at # => Time, new timestamp when the access token expires ``` +#### Deauthorize + +Revoke access to an athlete's data using an instance of `Strava::API::Client`. + +```ruby +authorization = client.deauthorize + +authorization.access_token # => String, access token being revoked +``` + ### 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.rb](bin/strava-webhooks.rb). 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. +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. Before creating a webhook subscription you must implement and run an HTTP server that will handle a `GET` challenge at the subscription URL. ```ruby challenge = Strava::Webhooks::Models::Challenge.new(request.query) @@ -995,10 +1033,10 @@ ## Tools ### Strava OAuth Token -Use [strava-oauth-token](bin/strava-outh-token.rb) 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-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. ```bash $ STRAVA_CLIENT_ID=... STRAVA_CLIENT_SECRET=... strava-oauth-token ```