Skip to content

Commit

Permalink
Support Faraday 2.0.1+ only
Browse files Browse the repository at this point in the history
  • Loading branch information
fukayatsu committed Apr 6, 2023
1 parent 3f4ad6a commit 09b6722
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
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 09b6722

Please sign in to comment.