strava-ruby-client 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 67660b1916a241d6029346ff2da15b8317dbb752974d1772faaba9a48a7441a8
4
- data.tar.gz: 4dc208a403ee703bdeeca2c21d9af8fd37a9b3d7c9b851c4e328cbc382529962
3
+ metadata.gz: 62ed8c024bb4b074e4c7ccb7f8eaea949e9123f9bb171cb565c76850e78a038c
4
+ data.tar.gz: f70a4844f57c2e52a317a5b3dd8c12ec66a9ef1155f36867f107d5c4c14204e0
5
5
  SHA512:
6
- metadata.gz: 17e10865286fad7301c21d51feed1482b01cf8e1fe5345f1b0cbf4b8dd66cfe5ea9351658afd09d2d2bc7f46669914240d764201b1c20f82a32dc5cd310f895f
7
- data.tar.gz: a165b273493382cee3b1160f5b3339fda53506110bad84737af77ba4f6505b996d5e1ae0f8562b1c6a17f2b8ac8babc0ae9e44be92b066d2c0cca92f6ad0f2d9
6
+ metadata.gz: 8db9f71db0f789c87525e0d6a9522c34264de4893fc52f9733b65c2bafcae2e61907c75fad833b79ed16c12f1bdf9fba858d5887e93f6b33b0cc31a8b97f206d
7
+ data.tar.gz: 26e7491541ce020b0f55c7a5493484bc38c6c8d2ae20d4fa8317ccb598d51b9a82fac5ca642dca77137afa6d9ff09e528819d847d7a3ec4594f07346e5b39e4f
@@ -1,3 +1,11 @@
1
+ ### 0.3.2 (2020/03/28)
2
+
3
+ * [#26](https://github.com/dblock/strava-ruby-client/pull/26): Corrected `Strava::Webhooks.config.endpoint` - [@dblock](https://github.com/dblock).
4
+ * Automatically convert `before` and `after` arguments of `Strava::Api::Client#athlete_activities` from `Time` to `Integer` - [@dblock](https://github.com/dblock).
5
+ * [#18](https://github.com/dblock/strava-ruby-client/pull/18): Testing against Ruby 2.5.3 and 2.6.0 - [@lucianosousa](https://github.com/lucianosousa).
6
+ * [#18](https://github.com/dblock/strava-ruby-client/pull/18): Upgraded Rubocop to 0.61.1 - [@lucianosousa](https://github.com/lucianosousa).
7
+ * [#21](https://github.com/dblock/strava-ruby-client/pull/21): Include headers in error response - [@jameschevalier](https://github.com/jameschevalier).
8
+
1
9
  ### 0.3.1 (2018/12/05)
2
10
 
3
11
  * Added `Strava::Api::Client#activity_photos` - [@dblock](https://github.com/dblock).
data/README.md CHANGED
@@ -63,6 +63,7 @@ Unlike other clients, including [strava-api-v3](https://github.com/jaredholdcrof
63
63
  - [OAuth](#oauth)
64
64
  - [OAuth Workflow](#oauth-workflow)
65
65
  - [Deauthorize](#deauthorize)
66
+ - [Command Line OAuth Workflow](#command-line-oauth-workflow)
66
67
  - [Webhooks](#webhooks)
67
68
  - [Configuration](#configuration)
68
69
  - [Web Client Options](#web-client-options)
@@ -72,6 +73,8 @@ Unlike other clients, including [strava-api-v3](https://github.com/jaredholdcrof
72
73
  - [Errors](#errors)
73
74
  - [Tools](#tools)
74
75
  - [Strava OAuth Token](#strava-oauth-token)
76
+ - [Users](#users)
77
+ - [Resources](#resources)
75
78
  - [Contributing](#contributing)
76
79
  - [Copyright and License](#copyright-and-license)
77
80
 
@@ -843,6 +846,12 @@ authorization = client.deauthorize
843
846
  authorization.access_token # => String, access token being revoked
844
847
  ```
845
848
 
849
+ #### Command Line OAuth Workflow
850
+
851
+ 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.
852
+
853
+ See [strava-oauth-token](/bin/strava-oauth-token) or [strava-ruby-cli](https://github.com/dblock/strava-ruby-cli) for an example.
854
+
846
855
  ### Webhooks
847
856
 
848
857
  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).
@@ -1016,7 +1025,7 @@ setting | description
1016
1025
  --------------------|------------
1017
1026
  client_id | Application client ID.
1018
1027
  client_secret | Application client secret.
1019
- endpoint | Defaults to `https://api.strava.com/api/v3`.
1028
+ endpoint | Defaults to `https://www.strava.com/api/v3`.
1020
1029
 
1021
1030
  ## Errors
1022
1031
 
@@ -1028,19 +1037,35 @@ begin
1028
1037
  rescue Strava::Errors::Fault => e
1029
1038
  e.message # => Bad Request
1030
1039
  e.errors # => [{ 'code' => 'invalid', 'field' => 'code', 'resource' => 'RequestToken' }]
1040
+ e.headers # => { "status" => "403 Bad Request", "x-ratelimit-limit" => "600,30000", "x-ratelimit-usage" => "314,27536" }
1031
1041
  end
1032
1042
  ```
1033
1043
 
1034
1044
  ## Tools
1035
1045
 
1046
+ 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.
1047
+
1036
1048
  ### Strava OAuth Token
1037
1049
 
1038
- 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.
1050
+ 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.
1039
1051
 
1040
1052
  ```bash
1041
1053
  $ STRAVA_CLIENT_ID=... STRAVA_CLIENT_SECRET=... strava-oauth-token
1042
1054
  ```
1043
1055
 
1056
+ ## Users
1057
+
1058
+ * [Slava: Strava integration with Slack](https://slava.playplay.io), [source](https://github.com/dblock/slack-strava).
1059
+ * [Jekyll Blog at run.dblock.org](https://run.dblock.org), [source](https://github.com/dblock/run.dblock.org)
1060
+
1061
+ ## Resources
1062
+
1063
+ * [Strava API Documentation](https://developers.strava.com)
1064
+ * [Writing a New Strava API Ruby Client](https://code.dblock.org/2018/11/27/writing-a-new-strava-api-ruby-client.html)
1065
+ * [Dealing with Strava API OAuth Token Migration](https://code.dblock.org/2018/11/17/dealing-with-strava-api-token-migration.html)
1066
+ * [Auto-Publishing Strava Runs to Github Pages](https://code.dblock.org/2018/02/17/auto-publishing-strava-runs-to-github-pages.html)
1067
+ * [Strava Command-Line Client](https://github.com/dblock/strava-ruby-cli)
1068
+
1044
1069
  ## Contributing
1045
1070
 
1046
1071
  See [CONTRIBUTING](CONTRIBUTING.md).
@@ -91,6 +91,9 @@ module Strava
91
91
  # Number of items per page. Defaults to 30.
92
92
  #
93
93
  def athlete_activities(options = {}, &block)
94
+ options = options.dup if options.key?(:after) || options.key?(:before)
95
+ options[:after] = options[:after].to_i if options[:after]
96
+ options[:before] = options[:before].to_i if options[:before]
94
97
  paginate 'athlete/activities', options, Strava::Models::Activity, &block
95
98
  end
96
99
 
@@ -5,6 +5,10 @@ module Strava
5
5
  response[:body]['message'] || super
6
6
  end
7
7
 
8
+ def headers
9
+ response[:headers]
10
+ end
11
+
8
12
  def errors
9
13
  response[:body]['errors']
10
14
  end
@@ -1,3 +1,3 @@
1
1
  module Strava
2
- VERSION = '0.3.1'.freeze
2
+ VERSION = '0.3.2'.freeze
3
3
  end
@@ -12,7 +12,7 @@ module Strava
12
12
  attr_accessor(*Config::ATTRIBUTES)
13
13
 
14
14
  def reset
15
- self.endpoint = 'https://api.strava.com/api/v3'
15
+ self.endpoint = 'https://www.strava.com/api/v3'
16
16
  self.client_id = nil
17
17
  self.client_secret = nil
18
18
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strava-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Doubrovkine
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-05 00:00:00.000000000 Z
11
+ date: 2020-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -169,8 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
169
  - !ruby/object:Gem::Version
170
170
  version: 1.3.6
171
171
  requirements: []
172
- rubyforge_project:
173
- rubygems_version: 2.7.6
172
+ rubygems_version: 3.0.3
174
173
  signing_key:
175
174
  specification_version: 4
176
175
  summary: Strava API Ruby client.