garage_client 2.4.5 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +27 -0
- data/CHANGELOG.md +6 -0
- data/README.md +1 -1
- data/garage_client.gemspec +4 -3
- data/lib/garage_client/cachers/base.rb +3 -9
- data/lib/garage_client/client.rb +4 -4
- 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 +24 -11
- data/.travis.yml +0 -16
- data/gemfiles/Gemfile.faraday-0.8.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
|
@@ -0,0 +1,27 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
pull_request:
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
test:
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
strategy:
|
11
|
+
fail-fast: true
|
12
|
+
matrix:
|
13
|
+
ruby:
|
14
|
+
- '3.0'
|
15
|
+
- '3.1'
|
16
|
+
- '3.2'
|
17
|
+
- '3.3'
|
18
|
+
- 'head'
|
19
|
+
continue-on-error: ${{ endsWith(matrix.ruby, 'head') }}
|
20
|
+
name: Run test with Ruby ${{ matrix.ruby }}
|
21
|
+
steps:
|
22
|
+
- uses: actions/checkout@v4
|
23
|
+
- uses: ruby/setup-ruby@v1
|
24
|
+
with:
|
25
|
+
ruby-version: ${{ matrix.ruby }}
|
26
|
+
bundler-cache: true
|
27
|
+
- run: bundle exec rspec
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# GarageClient [](https://github.com/cookpad/garage_client/actions/workflows/ci.yml)
|
2
2
|
GarageClient is a simple Ruby library to provide a primitive client interface to the Garage application API.
|
3
3
|
|
4
4
|
## Install
|
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
@@ -53,20 +53,20 @@ module GarageClient
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def apply_auth_middleware(faraday_builder)
|
56
|
-
faraday_builder.authorization :Bearer, access_token if access_token
|
56
|
+
faraday_builder.request :authorization, :Bearer, access_token if access_token
|
57
57
|
end
|
58
58
|
|
59
59
|
def connection
|
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
|
-
autorequire:
|
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
|
- - ">="
|
@@ -185,16 +199,15 @@ executables: []
|
|
185
199
|
extensions: []
|
186
200
|
extra_rdoc_files: []
|
187
201
|
files:
|
202
|
+
- ".github/workflows/ci.yml"
|
188
203
|
- ".gitignore"
|
189
204
|
- ".rspec"
|
190
|
-
- ".travis.yml"
|
191
205
|
- CHANGELOG.md
|
192
206
|
- Gemfile
|
193
207
|
- LICENSE.txt
|
194
208
|
- README.md
|
195
209
|
- Rakefile
|
196
210
|
- garage_client.gemspec
|
197
|
-
- gemfiles/Gemfile.faraday-0.8.x
|
198
211
|
- lib/garage_client.rb
|
199
212
|
- lib/garage_client/cachers/base.rb
|
200
213
|
- lib/garage_client/client.rb
|
@@ -231,7 +244,7 @@ files:
|
|
231
244
|
homepage: https://github.com/cookpad/garage_client
|
232
245
|
licenses: []
|
233
246
|
metadata: {}
|
234
|
-
post_install_message:
|
247
|
+
post_install_message:
|
235
248
|
rdoc_options: []
|
236
249
|
require_paths:
|
237
250
|
- lib
|
@@ -246,8 +259,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
246
259
|
- !ruby/object:Gem::Version
|
247
260
|
version: '0'
|
248
261
|
requirements: []
|
249
|
-
rubygems_version: 3.
|
250
|
-
signing_key:
|
262
|
+
rubygems_version: 3.5.3
|
263
|
+
signing_key:
|
251
264
|
specification_version: 4
|
252
265
|
summary: Ruby client library for the Garage API
|
253
266
|
test_files:
|
data/.travis.yml
DELETED