Skip to content

Commit

Permalink
Fixing a merge error that caused an upload issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
dleadbetter committed Feb 27, 2023
1 parent 98ca27f commit 56e21da
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions app/services/triple_eye_effable/cloud.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ def create_resource(resourceable)
raise I18n.t('errors.read_only') if @read_only

response = upload_resource(resourceable)
add_error(resourceable, response) and return unless response.success?

resource_id, data = parse_response(response)

resourceable.resource_description = ResourceDescription.new(resource_id: resource_id)
Expand All @@ -54,6 +56,7 @@ def load_resource(resourceable)

resource_description = resourceable.resource_description
response = self.class.get("#{base_url}/#{resource_description.resource_id}", headers: headers)
add_error(resourceable, response) and return unless response.success?

resource_id, data = parse_response(response)
populate_description resource_description, data unless data.nil?
Expand All @@ -66,24 +69,16 @@ def update_resource(resourceable)
id = resource_description.resource_id

response = self.class.put("#{base_url}/#{id}", body: request_body(resourceable), headers: headers)
add_error(resourceable, response) and return unless response.success?

resource_id, data = parse_response(response)
populate_description(resource_description, data)
end

def upload_resource(resourceable)
raise I18n.t('errors.read_only') if @read_only

response = self.class.get("#{base_url}/#{resource_description.resource_id}", headers: headers)
add_error(resourceable, response) and return unless response.success?

resource_id, data = parse_response(response)
populate_description resource_description, data
end

def update_resource(resourceable)
id = resourceable.resource_description.resource_id
response = self.class.put("#{base_url}/#{id}", body: request_body(resourceable), headers: headers)
add_error(resourceable, response) unless response.success?
self.class.post(base_url, body: request_body(resourceable), headers: headers)
end

private
Expand Down

0 comments on commit 56e21da

Please sign in to comment.