Sha256: ffdb615fb1a4f8d392525ff50ea0426c31a6e1789f052ad7e0d0924fa48a27ea
Contents?: true
Size: 966 Bytes
Versions: 3
Compression:
Stored size: 966 Bytes
Contents
require 'scrivito/cms_rest_api.rb' require 'fiona7/temporary_uploader' module Scrivito class CmsRestApi # uploads are handled differently than in scrivito_sdk def self.upload_future_binary(future_binary, obj_id) if future_binary.id_to_copy normalized_id = normalize_path_component(future_binary.id_to_copy) put("blobs/#{normalized_id}/copy", future_binary.to_h.merge(destination_obj_id: obj_id)) else file = future_binary.file_to_upload filename = future_binary.filename if !filename.present? && file ext = ::File.extname(file.path).to_s[1..-1] filename = ::File.basename(file.path, '.' + ext.to_s) end encoded_id = Fiona7::TemporaryUploader.new(file, filename, obj_id).call {'id' => encoded_id, 'destination_obj' => obj_id} end end def self.activate_upload(*args) raise "This method is not implemented" end end end
Version data entries
3 entries across 3 versions & 1 rubygems