Skip to content

Commit

Permalink
Fix Rubocop issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sdjmchattie committed Dec 16, 2024
1 parent 76f5251 commit 653d03b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
8 changes: 4 additions & 4 deletions app/controllers/api/v2/qc_files_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ class QcFileProcessor < JSONAPI::Processor
private

def prepare_temporary_file
filename, contents = get_required_attributes
filename, contents = required_attributes
tempfile = create_temporary_file(filename, contents)

context.merge!(filename:, tempfile:)
end

# Validate that attributes contains both the filename and the contents of the QcFile.
def get_required_attributes
def required_attributes
attributes = params[:data][:attributes]

filename = attributes[:filename]
raise JSONAPI::Exceptions::ParameterMissing.new('filename') if filename.nil?
raise JSONAPI::Exceptions::ParameterMissing, 'filename' if filename.nil?

contents = attributes[:contents]
raise JSONAPI::Exceptions::ParameterMissing.new('contents') if contents.nil?
raise JSONAPI::Exceptions::ParameterMissing, 'contents' if contents.nil?

[filename, contents]
end
Expand Down
9 changes: 4 additions & 5 deletions app/controllers/api/v2/tag_layouts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,10 @@ def find_template
end

def raise_if_key_present(data, key)
unless data[key.to_sym].blank?
raise JSONAPI::Exceptions::BadRequest.new(
"Cannot provide '#{key}' while also providing 'tag_layout_template_uuid'."
)
end
return if data[key.to_sym].blank?

raise JSONAPI::Exceptions::BadRequest,
"Cannot provide '#{key}' while also providing 'tag_layout_template_uuid'."
end

def merge_template_attributes(template)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/v2/transfers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class TransferProcessor < JSONAPI::Processor
def extract_template_data
attributes = params[:data][:attributes]
template_uuid = attributes[:transfer_template_uuid]
raise JSONAPI::Exceptions::ParameterMissing.new('transfer_template_uuid') if template_uuid.nil?
raise JSONAPI::Exceptions::ParameterMissing, 'transfer_template_uuid' if template_uuid.nil?

template = TransferTemplate.with_uuid(template_uuid).first
raise JSONAPI::Exceptions::InvalidFieldValue.new('transfer_template_uuid', template_uuid) if template.nil?
Expand Down

0 comments on commit 653d03b

Please sign in to comment.