Skip to content

Commit

Permalink
Merge pull request #80 from asonas/remove_compatibility
Browse files Browse the repository at this point in the history
Removed compatibility with old faraday
  • Loading branch information
sue445 committed Jan 9, 2022
2 parents 216009b + f8da81a commit 623b6ac
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 623b6ac

Please sign in to comment.