From 36708b47cf847497ee7c9c178f04725447ff1385 Mon Sep 17 00:00:00 2001 From: Oleksii Kriuchykhin Date: Wed, 21 Jul 2021 13:10:30 +0200 Subject: [PATCH] Fix code styling [SCI-5531] --- app/services/biomolecule_toolkit_client.rb | 13 +++++++------ config/locales/biomolecule_toolkit_client/en.yml | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/services/biomolecule_toolkit_client.rb b/app/services/biomolecule_toolkit_client.rb index c01f1cdc4..2909c2cc2 100644 --- a/app/services/biomolecule_toolkit_client.rb +++ b/app/services/biomolecule_toolkit_client.rb @@ -48,19 +48,20 @@ class BiomoleculeToolkitClient private def process_request(request) - responce = @http.request(request) + response = @http.request(request) - if responce.is_a? Net::HTTPOK - JSON.parse(responce.body) - elsif responce.is_a? Net::HTTPNoContent + case response.class + when Net::HTTPOK + JSON.parse(response.body) + when Net::HTTPNoContent true else - error_message = JSON.parse(responce.body).dig('error', 'message') + error_message = JSON.parse(response.body).dig('error', 'message') error_message ||= I18n.t('biomolecule_toolkit_client.generic_error') raise BiomoleculeToolkitClientException, error_message end rescue JSON::ParserError - raise BiomoleculeToolkitClientException, I18n.t('biomolecule_toolkit_client.responce_parsing_error') + raise BiomoleculeToolkitClientException, I18n.t('biomolecule_toolkit_client.response_parsing_error') rescue StandardError raise BiomoleculeToolkitClientException, I18n.t('biomolecule_toolkit_client.generic_error') end diff --git a/config/locales/biomolecule_toolkit_client/en.yml b/config/locales/biomolecule_toolkit_client/en.yml index 6739dff13..8ac3858c1 100644 --- a/config/locales/biomolecule_toolkit_client/en.yml +++ b/config/locales/biomolecule_toolkit_client/en.yml @@ -1,4 +1,4 @@ en: biomolecule_toolkit_client: generic_error: 'Failed to execute API command' - responce_parsing_error: 'Failed to parse API response' + response_parsing_error: 'Failed to parse API response'