zaikio-client-helpers 0.2.3 → 0.2.4

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: 429b80bf8b9d429a9cebbf05e6621a37d891d5cedb9c12f92cdf87f8902006da
4
- data.tar.gz: 448b5a7fe652b0c2cc540da2f8f33b1f689c3f29f16401e0828787cd72385108
3
+ metadata.gz: d00d304ca27fb927748ae92d163e44c1254a6a9b6c7cd2616fdc32e8cd08dc38
4
+ data.tar.gz: cbbe9e8df3357f9e1bfdb7defc4e14d20808add68608138d60684e2af78b2e08
5
5
  SHA512:
6
- metadata.gz: bb55ed4c40c35ae902df31aa4cc0a5e2600f9c48dfac43e50acde69f5af1ae1c76e46d3b94c5deb1205638ac30ca040b500c6dc9e16789dfd69e1d55ec6ac4f7
7
- data.tar.gz: 0caa6bd56a7716321d8fb99b7b53132c23b0d83d7843e832b3c5cd557d86e9db249e3d6f6c41ec91b786a822e6a154a34c52d0d957deba26b2052e4065e7da06
6
+ metadata.gz: 24eebf4cafa1afd04326db5f23b2d8518e2c1633607e5d8c54bcdf768b576ac5e7b3a266ac495c85ab73e6f167dfca7b545d41d802f3fd6777e8df417af35590
7
+ data.tar.gz: 51c4e0d201584c3d0701bffb3942a219d2d40312f946f4b75b11e43ccf00acc06369553b8ee6bdef182766f07137b38e52ef6520e4319c8e33ee55f44d008753
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.2.4] - 2022-03-29
4
+
5
+ - Add support for Faraday 2.x
6
+
3
7
  ## [0.2.3] - 2021-11-12
4
8
 
5
9
  - Handle "uncountable" responses (i.e. those without a Total-Count or Total-Pages header)
@@ -2,7 +2,13 @@ require "faraday"
2
2
  require "multi_json"
3
3
 
4
4
  module Zaikio::Client::Helpers
5
- class JSONParser < Faraday::Response::Middleware
5
+ superclass = if Gem.loaded_specs["faraday"].version >= Gem::Version.new("2.0")
6
+ Faraday::Middleware
7
+ else
8
+ Faraday::Response::Middleware
9
+ end
10
+
11
+ JSONParser = Class.new(superclass) do
6
12
  def on_complete(env)
7
13
  case env.status
8
14
  when 404 then raise Spyke::ResourceNotFound.new(nil, url: env.url)
@@ -11,6 +11,12 @@ module Zaikio::Client::Helpers
11
11
 
12
12
  METADATA_KEY = :pagination
13
13
 
14
+ superclass = if Gem.loaded_specs["faraday"].version >= Gem::Version.new("2.0")
15
+ Faraday::Middleware
16
+ else
17
+ Faraday::Response::Middleware
18
+ end
19
+
14
20
  # Faraday Middleware for extracting any pagination headers into the a top-level
15
21
  # :metadata hash, or the env hash for non-JSON responses.
16
22
  #
@@ -22,7 +28,7 @@ module Zaikio::Client::Helpers
22
28
  # response = conn.get("/")
23
29
  # response.env[METADATA_KEY]
24
30
  # #=> {total_count: 4, total_pages: 1, current_page: 1}
25
- class FaradayMiddleware < Faraday::Response::Middleware
31
+ FaradayMiddleware = Class.new(superclass) do
26
32
  def on_complete(env)
27
33
  @env = env
28
34
 
@@ -3,7 +3,7 @@
3
3
  module Zaikio
4
4
  module Client
5
5
  module Helpers
6
- VERSION = "0.2.3"
6
+ VERSION = "0.2.4"
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zaikio-client-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zaikio GMBH
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-12 00:00:00.000000000 Z
11
+ date: 2022-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -16,14 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '1'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '3'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
27
  - - ">="
25
28
  - !ruby/object:Gem::Version
26
- version: '0'
29
+ version: '1'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '3'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: multi_json
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -42,16 +48,16 @@ dependencies:
42
48
  name: spyke
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
- - - ">="
51
+ - - "~>"
46
52
  - !ruby/object:Gem::Version
47
- version: '0'
53
+ version: '6'
48
54
  type: :runtime
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
51
57
  requirements:
52
- - - ">="
58
+ - - "~>"
53
59
  - !ruby/object:Gem::Version
54
- version: '0'
60
+ version: '6'
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: vcr
57
63
  requirement: !ruby/object:Gem::Requirement