Skip to content

Commit

Permalink
Changes from gocardless/gocardless-pro-ruby-template@b32ad39b1cf366c7…
Browse files Browse the repository at this point in the history
…2a4fc4b8c42c37cd65760f06
  • Loading branch information
gocardless-robot committed May 13, 2024
1 parent 646931a commit 77abc64
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/gocardless_pro/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def default_options
'User-Agent' => "#{user_agent}",
'Content-Type' => 'application/json',
'GoCardless-Client-Library' => 'gocardless-pro-ruby',
'GoCardless-Client-Version' => '2.54.0',
'GoCardless-Client-Version' => '2.55.0',
},
}
end
Expand Down
5 changes: 4 additions & 1 deletion lib/gocardless_pro/middlewares/raise_gocardless_errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ module Middlewares
class RaiseGoCardlessErrors < Faraday::Middleware
API_ERROR_STATUSES = 501..599
CLIENT_ERROR_STATUSES = 400..500
API_STATUS_NO_CONTENT = 204

def on_complete(env)
raise ApiError, generate_error_data(env) if !json?(env) || API_ERROR_STATUSES.include?(env.status)
if !(env.status == API_STATUS_NO_CONTENT || json?(env)) || API_ERROR_STATUSES.include?(env.status)
raise ApiError, generate_error_data(env)
end

return unless CLIENT_ERROR_STATUSES.include?(env.status)

Expand Down
2 changes: 1 addition & 1 deletion lib/gocardless_pro/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ module GoCardlessPro

module GoCardlessPro
# Current version of the GC gem
VERSION = '2.54.0'
VERSION = '2.55.0'
end

0 comments on commit 77abc64

Please sign in to comment.