Skip to content

Commit

Permalink
Merge pull request #3 from performant-software/feature/udcsl34_media_…
Browse files Browse the repository at this point in the history
…types

UDCSL #34 - Adding nil check for IIIF Cloud response
  • Loading branch information
dleadbetter authored Aug 23, 2022
2 parents aa253ca + 76307e7 commit 6062925
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/services/triple_eye_effable/cloud.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def load_resource(resourceable)
response = self.class.get("#{base_url}/#{resource_description.resource_id}")
resource_id, data = parse_response(response)

data&.keys.each do |key|
data&.keys&.each do |key|
next unless resource_description.respond_to?("#{key.to_s}=")
resource_description.send("#{key.to_s}=", data[key])
end
Expand All @@ -69,6 +69,8 @@ def headers
end

def parse_response(response)
return nil unless response && response['resource'].present?

data = response['resource'].symbolize_keys.slice(*RESPONSE_KEYS)
[data[:uuid], data.except(:uuid)]
end
Expand Down

0 comments on commit 6062925

Please sign in to comment.