From 2f6af1bc927f87315c758f9225642150970c901d Mon Sep 17 00:00:00 2001 From: Naomi Dushay Date: Wed, 3 Aug 2022 17:43:12 -0700 Subject: [PATCH] rubocop Style/CaseLikeIf enabled as bug was fixed (#4169) --- .rubocop.yml | 2 +- app/models/symphony_reader.rb | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index e37c12369..b039816fd 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -176,7 +176,7 @@ Style/BisectedAttrAccessor: Enabled: true Style/CaseLikeIf: - Enabled: false # Here be dragons https://github.com/rubocop-hq/rubocop/issues/8508 + Enabled: true Style/ExplicitBlockArgument: Enabled: true diff --git a/app/models/symphony_reader.rb b/app/models/symphony_reader.rb index 9bfb83fa5..e12bf1881 100644 --- a/app/models/symphony_reader.rb +++ b/app/models/symphony_reader.rb @@ -70,16 +70,16 @@ def fetch_marc_response def symphony_response(url) resp = client.get(url) - if resp.status == 200 + case resp.status + when 200 validate_response(resp) - return resp - elsif resp.status == 404 - raise NotFound, "Record not found in Symphony. Catkey: #{catkey}. API call: #{url}" + resp + when 404 + raise NotFound, "Record not found in Symphony. Catkey: #{catkey}. API call: #{url}" if resp.status == 404 else errmsg = "Got HTTP Status-Code #{resp.status} calling #{url}: #{resp.body}" + raise ResponseError, errmsg end - - raise ResponseError, errmsg rescue Faraday::TimeoutError => e errmsg = "Timeout for Symphony response for API call #{url}: #{e}" Honeybadger.notify(errmsg)