Skip to content

Commit

Permalink
Merge pull request #58 from esaio/faraday-2.0
Browse files Browse the repository at this point in the history
Support Faraday 2.0.1+
  • Loading branch information
fukayatsu authored Apr 6, 2023
2 parents 50dd898 + 09b6722 commit 2933715
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 20 deletions.
29 changes: 15 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 3 additions & 2 deletions esa.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
3 changes: 2 additions & 1 deletion lib/esa.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require "faraday"
require "faraday_middleware"
require "faraday/multipart"
require "faraday/xml"

require "esa/version"
require "esa/client"
2 changes: 1 addition & 1 deletion lib/esa/api_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/esa/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Esa
VERSION = '1.18.0'
VERSION = '2.0.0.rc1'
end
4 changes: 3 additions & 1 deletion spec/esa/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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/")
Expand Down

0 comments on commit 2933715

Please sign in to comment.