Skip to content

Commit

Permalink
Removed compatibility with old faraday
Browse files Browse the repository at this point in the history
  • Loading branch information
sue445 committed Jan 9, 2022
1 parent 216009b commit f8da81a
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions lib/chatwork/base_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,9 @@ def handle_response(response)

Faraday::Connection::METHODS.each do |method|
define_method(method) do |url, args = {}, &block|
faraday_errors =
if Gem::Version.create(Faraday::VERSION) >= Gem::Version.create("1.0.0")
[Faraday::ClientError, Faraday::ServerError]
else
[Faraday::Error::ClientError]
end

begin
response = @conn.__send__(method, @api_version + url, args.compact)
rescue *faraday_errors => e
rescue Faraday::ClientError, Faraday::ServerError => e
raise ChatWork::APIConnectionError.faraday_error(e)
end
payload = handle_response(response)
Expand Down

0 comments on commit f8da81a

Please sign in to comment.