Class: Fiona7::TemporaryUploader

Inherits:
Object
  • Object
show all
Defined in:
lib/fiona7/temporary_uploader.rb

Overview

This class uploads a file into a temporary location to be reused later. It returns the blob id of the uploaded file.

Instance Method Summary collapse

Constructor Details

#initialize(file, filename, obj_id = nil) ⇒ TemporaryUploader

Returns a new instance of TemporaryUploader.



9
10
11
12
13
# File 'lib/fiona7/temporary_uploader.rb', line 9

def initialize(file, filename, obj_id=nil)
  @file     = file
  @filename = filename
  @obj_id   = obj_id
end

Instance Method Details

#callObject



15
16
17
18
# File 'lib/fiona7/temporary_uploader.rb', line 15

def call
  obj = Builder::IndirectBlobBuilder.new(upload_path, @filename, @file).call
  BlobIdGenerator.new(obj.obj_id, obj.last_changed).call
end