Module: MobileWorkflow::S3Storable

Extended by:
ActiveSupport::Concern
Defined in:
app/controllers/concerns/mobile_workflow/s3_storable.rb

Instance Method Summary collapse

Instance Method Details

#binary_urls(object) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/concerns/mobile_workflow/s3_storable.rb', line 10

def binary_urls(object)
  return unless params[:binaries]

  params[:binaries].map do |binary|
    identifier = binary[:identifier]
    key = binary[:key]
    extension = binary[:mimetype].split('/')[1] # i.e. image/jpg --> jpg, video/mp4 --> mp4
     = binary[:metadata]

    {
      identifier: identifier,
      url: presigned_url(
        "#{object.class.name.underscore}/#{object.id}/#{key}/#{s3_object_uuid}.#{extension}", metadata: 
      ),
      method: 'PUT'
    }
  end
end