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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 62ed8c024bb4b074e4c7ccb7f8eaea949e9123f9bb171cb565c76850e78a038c
4
- data.tar.gz: f70a4844f57c2e52a317a5b3dd8c12ec66a9ef1155f36867f107d5c4c14204e0
3
+ metadata.gz: 777e28f34938d8792c31fe66c9f2add94feecd78e522df82be8773ea0a7a5e07
4
+ data.tar.gz: 2cc3237633550576760d5e3c668f509ce9200322e2a8606535d27e281c7b67f6
5
5
  SHA512:
6
- metadata.gz: 8db9f71db0f789c87525e0d6a9522c34264de4893fc52f9733b65c2bafcae2e61907c75fad833b79ed16c12f1bdf9fba858d5887e93f6b33b0cc31a8b97f206d
7
- data.tar.gz: 26e7491541ce020b0f55c7a5493484bc38c6c8d2ae20d4fa8317ccb598d51b9a82fac5ca642dca77137afa6d9ff09e528819d847d7a3ec4594f07346e5b39e4f
6
+ metadata.gz: 3995d0bb3b9650376e8be26e5746be89f9f37e93361914b0784260449b13c52326c0636d8d1cc193302ffed639e40a1b5151184b9d5c830d6024b293bea253bc
7
+ data.tar.gz: 938a4c833f7dd11a444c7c16f1949ed32a8c2639770a68186b211218a037bf1856a79e04719baaf5e8ff1d63e9a603d0b2e6e9bf5b17684bea9c309e84c90213
@@ -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/) that requires special access obtained by emailing [developers@strava.com](mailto:developers@strava.com).
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::Error::ResourceNotFound`, `Faraday::Error::ConnectionFailed` or [Strava::Errors::Fault](lib/strava/errors/fault.rb) exceptions.
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).
@@ -1,3 +1,3 @@
1
1
  module Strava
2
- VERSION = '0.3.2'.freeze
2
+ VERSION = '0.4.0'.freeze
3
3
  end
@@ -8,26 +8,28 @@ module Strava
8
8
  end
9
9
 
10
10
  def connection
11
- options = {
12
- headers: headers.merge('Accept' => 'application/json; charset=utf-8')
13
- }
11
+ @connection ||= begin
12
+ options = {
13
+ headers: headers.merge('Accept' => 'application/json; charset=utf-8')
14
+ }
14
15
 
15
- options[:headers]['User-Agent'] = user_agent if user_agent
16
- options[:proxy] = proxy if proxy
17
- options[:ssl] = { ca_path: ca_path, ca_file: ca_file } if ca_path || ca_file
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
- request_options = {}
20
- request_options[:timeout] = timeout if timeout
21
- request_options[:open_timeout] = open_timeout if open_timeout
22
- options[:request] = request_options if request_options.any?
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
- ::Faraday::Connection.new(endpoint, options) do |connection|
25
- connection.use ::Faraday::Request::Multipart
26
- connection.use ::Faraday::Request::UrlEncoded
27
- connection.use ::Strava::Web::Response::RaiseError
28
- connection.use ::FaradayMiddleware::ParseJson, content_type: /\bjson$/
29
- connection.response :logger, logger if logger
30
- connection.adapter ::Faraday.default_adapter
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::Error::ResourceNotFound, response_values(env)
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::Error::ConnectionFailed, %(407 "Proxy Authentication Required ")
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.3.2
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-03-28 00:00:00.000000000 Z
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: '0.9'
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: '0.9'
40
+ version: 1.0.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: faraday_middleware
43
43
  requirement: !ruby/object:Gem::Requirement