strava-ruby-client 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +7 -2
- data/lib/strava/version.rb +1 -1
- data/lib/strava/web/connection.rb +19 -17
- data/lib/strava/web/raise_error.rb +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 777e28f34938d8792c31fe66c9f2add94feecd78e522df82be8773ea0a7a5e07
|
4
|
+
data.tar.gz: 2cc3237633550576760d5e3c668f509ce9200322e2a8606535d27e281c7b67f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3995d0bb3b9650376e8be26e5746be89f9f37e93361914b0784260449b13c52326c0636d8d1cc193302ffed639e40a1b5151184b9d5c830d6024b293bea253bc
|
7
|
+
data.tar.gz: 938a4c833f7dd11a444c7c16f1949ed32a8c2639770a68186b211218a037bf1856a79e04719baaf5e8ff1d63e9a603d0b2e6e9bf5b17684bea9c309e84c90213
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
### 0.4.0 (2020/05/09)
|
2
|
+
|
3
|
+
* [#29](https://github.com/dblock/strava-ruby-client/pull/29): Cache `Faraday::Connection` for persistent adapters - [@dblock](https://github.com/dblock).
|
4
|
+
* [#30](https://github.com/dblock/strava-ruby-client/pull/30): Require Faraday >= 1.0 - [@dblock](https://github.com/dblock).
|
5
|
+
|
1
6
|
### 0.3.2 (2020/03/28)
|
2
7
|
|
3
8
|
* [#26](https://github.com/dblock/strava-ruby-client/pull/26): Corrected `Strava::Webhooks.config.endpoint` - [@dblock](https://github.com/dblock).
|
data/README.md
CHANGED
@@ -75,6 +75,7 @@ Unlike other clients, including [strava-api-v3](https://github.com/jaredholdcrof
|
|
75
75
|
- [Strava OAuth Token](#strava-oauth-token)
|
76
76
|
- [Users](#users)
|
77
77
|
- [Resources](#resources)
|
78
|
+
- [Upgrading](#upgrading)
|
78
79
|
- [Contributing](#contributing)
|
79
80
|
- [Copyright and License](#copyright-and-license)
|
80
81
|
|
@@ -854,7 +855,7 @@ See [strava-oauth-token](/bin/strava-oauth-token) or [strava-ruby-cli](https://g
|
|
854
855
|
|
855
856
|
### Webhooks
|
856
857
|
|
857
|
-
Strava provides a [Webhook Event API](https://developers.strava.com/docs/webhooks/)
|
858
|
+
Strava provides a [Webhook Event API](https://developers.strava.com/docs/webhooks/).
|
858
859
|
|
859
860
|
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.
|
860
861
|
|
@@ -1029,7 +1030,7 @@ endpoint | Defaults to `https://www.strava.com/api/v3`.
|
|
1029
1030
|
|
1030
1031
|
## Errors
|
1031
1032
|
|
1032
|
-
All errors that return HTTP codes 400-600 result in either `Faraday::
|
1033
|
+
All errors that return HTTP codes 400-600 result in either `Faraday::ResourceNotFound`, `Faraday::ConnectionFailed` or [Strava::Errors::Fault](lib/strava/errors/fault.rb) exceptions.
|
1033
1034
|
|
1034
1035
|
```ruby
|
1035
1036
|
begin
|
@@ -1066,6 +1067,10 @@ $ STRAVA_CLIENT_ID=... STRAVA_CLIENT_SECRET=... strava-oauth-token
|
|
1066
1067
|
* [Auto-Publishing Strava Runs to Github Pages](https://code.dblock.org/2018/02/17/auto-publishing-strava-runs-to-github-pages.html)
|
1067
1068
|
* [Strava Command-Line Client](https://github.com/dblock/strava-ruby-cli)
|
1068
1069
|
|
1070
|
+
## Upgrading
|
1071
|
+
|
1072
|
+
See [UPGRADING](UPGRADING.md).
|
1073
|
+
|
1069
1074
|
## Contributing
|
1070
1075
|
|
1071
1076
|
See [CONTRIBUTING](CONTRIBUTING.md).
|
data/lib/strava/version.rb
CHANGED
@@ -8,26 +8,28 @@ module Strava
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def connection
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
@connection ||= begin
|
12
|
+
options = {
|
13
|
+
headers: headers.merge('Accept' => 'application/json; charset=utf-8')
|
14
|
+
}
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
16
|
+
options[:headers]['User-Agent'] = user_agent if user_agent
|
17
|
+
options[:proxy] = proxy if proxy
|
18
|
+
options[:ssl] = { ca_path: ca_path, ca_file: ca_file } if ca_path || ca_file
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
request_options = {}
|
21
|
+
request_options[:timeout] = timeout if timeout
|
22
|
+
request_options[:open_timeout] = open_timeout if open_timeout
|
23
|
+
options[:request] = request_options if request_options.any?
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
25
|
+
::Faraday::Connection.new(endpoint, options) do |connection|
|
26
|
+
connection.use ::Faraday::Request::Multipart
|
27
|
+
connection.use ::Faraday::Request::UrlEncoded
|
28
|
+
connection.use ::Strava::Web::Response::RaiseError
|
29
|
+
connection.use ::FaradayMiddleware::ParseJson, content_type: /\bjson$/
|
30
|
+
connection.response :logger, logger if logger
|
31
|
+
connection.adapter ::Faraday.default_adapter
|
32
|
+
end
|
31
33
|
end
|
32
34
|
end
|
33
35
|
end
|
@@ -7,10 +7,10 @@ module Strava
|
|
7
7
|
def on_complete(env)
|
8
8
|
case env[:status]
|
9
9
|
when 404
|
10
|
-
raise Faraday::
|
10
|
+
raise Faraday::ResourceNotFound, response_values(env)
|
11
11
|
when 407
|
12
12
|
# mimic the behavior that we get with proxy requests with HTTPS
|
13
|
-
raise Faraday::
|
13
|
+
raise Faraday::ConnectionFailed, %(407 "Proxy Authentication Required ")
|
14
14
|
when ClientErrorStatuses
|
15
15
|
raise Strava::Errors::Fault, response_values(env)
|
16
16
|
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.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Doubrovkine
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 1.0.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 1.0.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: faraday_middleware
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|