garage_client 2.4.5 → 3.0.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: b719783d93f2fe8a23421f6a05946aa376623d953c99ba1a3cf5435a5d248ac0
4
- data.tar.gz: 40287bfa976d8608d43a67cd3b50135e1618a28232346508f6ad319d50cf1262
3
+ metadata.gz: 232578511292fd92e6d04a6fb38f4e792c2c9d2ad09233f6ec3dfbe34daee964
4
+ data.tar.gz: 9abb6580e134bd6721b8c818a5c1d72063a94b487f7c3682f598f63c59717c31
5
5
  SHA512:
6
- metadata.gz: bebf81e6430a3765d0f4f970aeca63c6ee059050c2d5f1a9a58b611d17b80f0a6bc91f756f85dee2a2c3d5e7a091ef75a3b5fd87b282288e238494dac213b6cc
7
- data.tar.gz: 20a0ae03b1803f66a2b3f1ad47329990326f96004c667091600d474c63c7a2e0d65ea037aa026af6880677137e11432b6b284cbd8ba078e8593443aa5f6d7c8e
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
@@ -1,3 +1,9 @@
1
+ ## 3.0.0
2
+ - Upgrade faraday gem to v2 and drop support for Ruby 2.6 and 2.7
3
+
4
+ ## 2.4.6
5
+ - Fix deprecation warning from Faraday
6
+
1
7
  ## 2.4.5
2
8
  - Drop support for Ruby 2.5
3
9
  - Remove implicit dependency on Active Support
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # GarageClient [![Build Status](https://travis-ci.org/cookpad/garage_client.svg?branch=master)](https://travis-ci.org/cookpad/garage_client)
1
+ # GarageClient [![Build Status](https://github.com/cookpad/garage_client/actions/workflows/ci.yml/badge.svg?branch=master)](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
@@ -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.8.0'
20
- s.add_dependency 'faraday_middleware'
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 is drop request object and url
13
- # https://github.com/lostisland/faraday/blob/edacd5eb57ea13accab3097649690ae5f48f421a/lib/faraday/response.rb#L74
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?
@@ -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 FaradayMiddleware::Mashify
64
- builder.use Faraday::Response::ParseJson, :content_type => /\bjson$/
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::Request::Multipart
69
+ builder.use Faraday::Multipart::Middleware
70
70
  builder.use GarageClient::Request::JsonEncoded
71
71
  builder.use GarageClient::Request::PropagateRequestId
72
72
 
@@ -1,8 +1,6 @@
1
- require "faraday_middleware"
2
-
3
1
  module GarageClient
4
2
  class Response
5
- class Cacheable < Faraday::Response::Middleware
3
+ class Cacheable < Faraday::Middleware
6
4
  register_middleware cache: self
7
5
 
8
6
  def initialize(app, args)
@@ -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::Response::Middleware
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
- # Faraday's Net::Http adapter returns '' if response is nil.
15
- # Changes from faraday v0.9.0. faraday/f41ffaabb72d3700338296c79a2084880e6a9843
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 }
@@ -1,3 +1,3 @@
1
1
  module GarageClient
2
- VERSION = '2.4.5'
2
+ VERSION = '3.0.0'
3
3
  end
data/lib/garage_client.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'faraday'
2
- require 'faraday_middleware'
2
+ require 'faraday/mashify'
3
+ require 'faraday/multipart'
3
4
 
4
5
  require 'garage_client/version'
5
6
  require 'garage_client/cachers/base'
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: 2.4.5
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: 2021-03-17 00:00:00.000000000 Z
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.8.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.8.0
26
+ version: 2.0.1
27
27
  - !ruby/object:Gem::Dependency
28
- name: faraday_middleware
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.1.4
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
@@ -1,16 +0,0 @@
1
- language: ruby
2
-
3
- rvm:
4
- - ruby-head
5
- - 3.0.0
6
- - 2.7.2
7
- - 2.6.6
8
- - 2.5.8
9
- matrix:
10
- allow_failures:
11
- - rvm: "ruby-head"
12
- fast_finish: true
13
-
14
- cache: bundler
15
-
16
- sudo: false
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'faraday', '~> 0.8.0'
4
- gemspec path: '../'