From 3f4ad6a85dfb70da3bfed34b6a3ec4a8c4fa2b64 Mon Sep 17 00:00:00 2001 From: fukayatsu Date: Thu, 6 Apr 2023 14:47:42 +0900 Subject: [PATCH 1/2] Add Ruby 3.2 to CI --- .github/workflows/build.yml | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c12daf2..11966d6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,19 +10,20 @@ jobs: strategy: matrix: ruby: - - '2.7' - - '3.0' - - '3.1' - - 'head' + - "2.7" + - "3.0" + - "3.1" + - "3.2" + - "head" steps: - - uses: actions/checkout@v3 - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - bundler-cache: true - - name: Install dependencies - run: bundle install --jobs 4 --retry 3 - - name: Build and test with Rake - run: bundle exec rake + - uses: actions/checkout@v3 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - name: Install dependencies + run: bundle install --jobs 4 --retry 3 + - name: Build and test with Rake + run: bundle exec rake From 09b672261af917904cf60a7fa380976d61401f21 Mon Sep 17 00:00:00 2001 From: fukayatsu Date: Thu, 6 Apr 2023 15:30:10 +0900 Subject: [PATCH 2/2] Support Faraday 2.0.1+ only --- esa.gemspec | 5 +++-- lib/esa.rb | 3 ++- lib/esa/api_methods.rb | 2 +- lib/esa/version.rb | 2 +- spec/esa/client_spec.rb | 4 +++- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/esa.gemspec b/esa.gemspec index 3e4e61a..7f22b9d 100644 --- a/esa.gemspec +++ b/esa.gemspec @@ -17,8 +17,9 @@ Gem::Specification.new do |spec| spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.require_paths = ['lib'] - spec.add_runtime_dependency 'faraday', '>= 0.9', '< 2.0' - spec.add_runtime_dependency 'faraday_middleware', '>= 0.12', '< 2.0' + spec.add_runtime_dependency 'faraday', '>= 2.0.1', '< 3.0' + spec.add_runtime_dependency 'faraday-multipart' + spec.add_runtime_dependency 'faraday-xml' spec.add_runtime_dependency 'mime-types', '>= 2.6', '< 4.0' spec.add_runtime_dependency 'multi_xml', '>= 0.5.5', '< 1.0' diff --git a/lib/esa.rb b/lib/esa.rb index b33640d..57b5ecd 100644 --- a/lib/esa.rb +++ b/lib/esa.rb @@ -1,5 +1,6 @@ require "faraday" -require "faraday_middleware" +require "faraday/multipart" +require "faraday/xml" require "esa/version" require "esa/client" diff --git a/lib/esa/api_methods.rb b/lib/esa/api_methods.rb index 6408787..730afe1 100644 --- a/lib/esa/api_methods.rb +++ b/lib/esa/api_methods.rb @@ -185,7 +185,7 @@ def upload_attachment(path_or_file_or_url, params = {}, headers = nil) return response unless response.status == 200 attachment = response.body['attachment'] - form_data = response.body['form'].merge(file: Faraday::UploadIO.new(file, params[:type])) + form_data = response.body['form'].merge(file: Faraday::FilePart.new(file, params[:type])) s3_response = send_s3_request(:post, attachment['endpoint'], form_data) return s3_response unless s3_response.status == 204 diff --git a/lib/esa/version.rb b/lib/esa/version.rb index 59c6a9d..632aa24 100644 --- a/lib/esa/version.rb +++ b/lib/esa/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Esa - VERSION = '1.18.0' + VERSION = '2.0.0.rc1' end diff --git a/spec/esa/client_spec.rb b/spec/esa/client_spec.rb index 70e6daf..d93743e 100644 --- a/spec/esa/client_spec.rb +++ b/spec/esa/client_spec.rb @@ -125,7 +125,9 @@ foo: 'bar' } }.to_json, - headers: {} + headers: { + 'Content-Type' => 'application/json; charset=utf-8' + } ) stub_request(:post, "https://test.s3-ap-northeast-1.amazonaws.com/")