mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-15 03:13:20 +08:00
18 lines
440 B
Ruby
18 lines
440 B
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
module ProtocolImporters
|
||
|
module AttachmentsBuilder
|
||
|
def self.generate(step_json)
|
||
|
return [] unless step_json[:attachments]&.any?
|
||
|
|
||
|
step_json[:attachments].map do |f|
|
||
|
Asset.new(file: URI.parse(f[:url]),
|
||
|
created_by: @user,
|
||
|
last_modified_by: @user,
|
||
|
team: @team,
|
||
|
file_file_name: f[:name])
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|