garage_client 2.4.6 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +5 -10
- data/CHANGELOG.md +3 -0
- data/garage_client.gemspec +4 -3
- data/lib/garage_client/cachers/base.rb +3 -9
- data/lib/garage_client/client.rb +3 -3
- data/lib/garage_client/response/cacheable.rb +1 -3
- data/lib/garage_client/response/raise_http_exception.rb +1 -4
- data/lib/garage_client/response.rb +3 -5
- data/lib/garage_client/version.rb +1 -1
- data/lib/garage_client.rb +2 -1
- metadata +20 -8
- data/gemfiles/Gemfile.faraday-0.x +0 -4
- data/gemfiles/Gemfile.faraday-1.x +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 232578511292fd92e6d04a6fb38f4e792c2c9d2ad09233f6ec3dfbe34daee964
|
4
|
+
data.tar.gz: 9abb6580e134bd6721b8c818a5c1d72063a94b487f7c3682f598f63c59717c31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dea5f8c420f3321465855b00fb24542c76916dc4d786e370d72c904447fc410ad9cd8202fb3db3ec7e6c77e30bf276cf0088d9e0509801eb9bce9c61ddd20f51
|
7
|
+
data.tar.gz: 818264a87289e2d526c9c924a744e61b21c6737c9bdd5a13aa11a28d1883e14495d3fd60ef94d700e18b0d762d8cba2ee59cac6e3b98164ac146671b6c2ded1f
|
data/.github/workflows/ci.yml
CHANGED
@@ -11,20 +11,15 @@ jobs:
|
|
11
11
|
fail-fast: true
|
12
12
|
matrix:
|
13
13
|
ruby:
|
14
|
-
- '2.5'
|
15
|
-
- '2.6'
|
16
|
-
- '2.7'
|
17
14
|
- '3.0'
|
15
|
+
- '3.1'
|
16
|
+
- '3.2'
|
17
|
+
- '3.3'
|
18
18
|
- 'head'
|
19
|
-
gemfile:
|
20
|
-
- 'gemfiles/Gemfile.faraday-0.x'
|
21
|
-
- 'gemfiles/Gemfile.faraday-1.x'
|
22
|
-
env:
|
23
|
-
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
24
19
|
continue-on-error: ${{ endsWith(matrix.ruby, 'head') }}
|
25
|
-
name: Run test with Ruby ${{ matrix.ruby }}
|
20
|
+
name: Run test with Ruby ${{ matrix.ruby }}
|
26
21
|
steps:
|
27
|
-
- uses: actions/checkout@
|
22
|
+
- uses: actions/checkout@v4
|
28
23
|
- uses: ruby/setup-ruby@v1
|
29
24
|
with:
|
30
25
|
ruby-version: ${{ matrix.ruby }}
|
data/CHANGELOG.md
CHANGED
data/garage_client.gemspec
CHANGED
@@ -10,14 +10,15 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.description = s.summary
|
11
11
|
|
12
12
|
s.files = `git ls-files`.split($\)
|
13
|
-
s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
s.executables = s.files.grep(%r{^bin/}).map { |f| File.basename(f) }
|
14
14
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
15
15
|
s.require_paths = ['lib']
|
16
16
|
s.authors = ['Cookpad Inc.']
|
17
17
|
s.email = ['kaihatsu@cookpad.com']
|
18
18
|
|
19
|
-
s.add_dependency 'faraday', '>= 0.
|
20
|
-
s.add_dependency '
|
19
|
+
s.add_dependency 'faraday', '>= 2.0.1'
|
20
|
+
s.add_dependency 'faraday-mashify'
|
21
|
+
s.add_dependency 'faraday-multipart'
|
21
22
|
s.add_dependency 'hashie', '>= 1.2.0'
|
22
23
|
s.add_dependency 'link_header'
|
23
24
|
|
@@ -9,15 +9,9 @@ module GarageClient
|
|
9
9
|
def call
|
10
10
|
response = store.read(key, options) if read_from_cache?
|
11
11
|
if response
|
12
|
-
# Faraday::Response#marshal_dump
|
13
|
-
# https://github.com/lostisland/faraday/blob/
|
14
|
-
|
15
|
-
# XXX: We can't use #merge! here because Faraday::Env does not implement
|
16
|
-
# the method as same as Hash#merge! with Faraday v0.12.1.
|
17
|
-
@env.each do |k, v|
|
18
|
-
original = response.env[k]
|
19
|
-
response.env[k] = v if !original && v
|
20
|
-
end
|
12
|
+
# Faraday::Response#marshal_dump drops the request object
|
13
|
+
# https://github.com/lostisland/faraday/blob/cc5d60776645d3d341ff0f425c45b3b3d48d98e0/lib/faraday/response.rb#L70
|
14
|
+
response.env.merge!(@env)
|
21
15
|
else
|
22
16
|
response = yield
|
23
17
|
store.write(key, response, options) if written_to_cache?
|
data/lib/garage_client/client.rb
CHANGED
@@ -60,13 +60,13 @@ module GarageClient
|
|
60
60
|
Faraday.new(headers: headers, url: endpoint) do |builder|
|
61
61
|
# Response Middlewares
|
62
62
|
builder.use Faraday::Response::Logger if verbose
|
63
|
-
builder.use
|
64
|
-
builder.use Faraday::Response::
|
63
|
+
builder.use Faraday::Mashify::Middleware
|
64
|
+
builder.use Faraday::Response::Json, content_type: /\bjson$/
|
65
65
|
builder.use GarageClient::Response::Cacheable, cacher: cacher if cacher
|
66
66
|
builder.use GarageClient::Response::RaiseHttpException
|
67
67
|
|
68
68
|
# Request Middlewares
|
69
|
-
builder.use Faraday::
|
69
|
+
builder.use Faraday::Multipart::Middleware
|
70
70
|
builder.use GarageClient::Request::JsonEncoded
|
71
71
|
builder.use GarageClient::Request::PropagateRequestId
|
72
72
|
|
@@ -1,9 +1,6 @@
|
|
1
|
-
require 'garage_client/error'
|
2
|
-
require 'faraday_middleware'
|
3
|
-
|
4
1
|
module GarageClient
|
5
2
|
class Response
|
6
|
-
class RaiseHttpException < Faraday::
|
3
|
+
class RaiseHttpException < Faraday::Middleware
|
7
4
|
ClientErrorStatuses = 400...500
|
8
5
|
ServerErrorStatuses = 500...600
|
9
6
|
|
@@ -11,11 +11,9 @@ module GarageClient
|
|
11
11
|
@client = client
|
12
12
|
@response = response
|
13
13
|
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
# GarageClient::Response#body should be always a String when Faraday
|
18
|
-
# became v1.0.0. Because 0.9.0 seems to be not stable.
|
14
|
+
# faraday-net_http adapter converts the response body from nil to '' to ensure the body is a string.
|
15
|
+
# https://github.com/lostisland/faraday/commit/f41ffaabb72d3700338296c79a2084880e6a9843
|
16
|
+
# https://github.com/lostisland/faraday-net_http/blob/11953160f75dd488133a74857c2b07d41be8995d/lib/faraday/adapter/net_http.rb#L186
|
19
17
|
response.env[:body] = nil if response.env[:body] == ''
|
20
18
|
|
21
19
|
unless ACCEPT_BODY_TYPES.any? {|type| type === response.body }
|
data/lib/garage_client.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: garage_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cookpad Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -16,16 +16,30 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 2.0.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 2.0.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: faraday-mashify
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: faraday-multipart
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
45
|
- - ">="
|
@@ -194,8 +208,6 @@ files:
|
|
194
208
|
- README.md
|
195
209
|
- Rakefile
|
196
210
|
- garage_client.gemspec
|
197
|
-
- gemfiles/Gemfile.faraday-0.x
|
198
|
-
- gemfiles/Gemfile.faraday-1.x
|
199
211
|
- lib/garage_client.rb
|
200
212
|
- lib/garage_client/cachers/base.rb
|
201
213
|
- lib/garage_client/client.rb
|
@@ -247,7 +259,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
247
259
|
- !ruby/object:Gem::Version
|
248
260
|
version: '0'
|
249
261
|
requirements: []
|
250
|
-
rubygems_version: 3.3
|
262
|
+
rubygems_version: 3.5.3
|
251
263
|
signing_key:
|
252
264
|
specification_version: 4
|
253
265
|
summary: Ruby client library for the Garage API
|