From 83a650d51fba42688da2ccba28c80c3170337e59 Mon Sep 17 00:00:00 2001 From: Josh Schwartzman Date: Tue, 28 Nov 2023 06:14:31 -0700 Subject: [PATCH] Fix code style issues --- lib/uploadcare/client/uploader_client.rb | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/uploadcare/client/uploader_client.rb b/lib/uploadcare/client/uploader_client.rb index dbff201..d198f3d 100644 --- a/lib/uploadcare/client/uploader_client.rb +++ b/lib/uploadcare/client/uploader_client.rb @@ -78,15 +78,18 @@ def poll_upload_response(token) max_sleep_seconds: Uploadcare.config.max_request_sleep, rescue: RetryError) do response = get_upload_from_url_status(token) + handle_polling_response(response) + end + end - if response.success[:status] == 'error' - raise RequestError, response.success[:error] - elsif %w[progress waiting unknown].include?(response.success[:status]) - raise RetryError, response.success[:error] - end - - response + def handle_polling_response(response) + if response.success[:status] == 'error' + raise RequestError, response.success[:error] + elsif %w[progress waiting unknown].include?(response.success[:status]) + raise RetryError, response.success[:error] end + + response end # Prepares body for upload_many method