Class: Pageflow::Panorama::Package

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
HostedFile
Defined in:
app/models/pageflow/panorama/package.rb

Instance Method Summary collapse

Instance Method Details

#archiveObject



52
53
54
# File 'app/models/pageflow/panorama/package.rb', line 52

def archive
  @archive ||= Zip::File.open(attachment_on_filesystem.path)
end

#index_document_pathObject



46
47
48
49
50
# File 'app/models/pageflow/panorama/package.rb', line 46

def index_document_path
  if attachment_on_s3.present? && index_document
    File.join(Panorama.config.packages_base_path, unpack_base_path, index_document)
  end
end

#keep_on_filesystem_after_upload_to_s3?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'app/models/pageflow/panorama/package.rb', line 34

def keep_on_filesystem_after_upload_to_s3?
  true
end

#thumbnail_url(*args) ⇒ Object



38
39
40
# File 'app/models/pageflow/panorama/package.rb', line 38

def thumbnail_url(*args)
  thumbnail.url(*args)
end

#unpack_base_pathObject



42
43
44
# File 'app/models/pageflow/panorama/package.rb', line 42

def unpack_base_path
  attachment_on_s3.present? ? File.dirname(attachment_on_s3.path(:unpacked)) : nil
end

#unpackerObject



56
57
58
59
60
# File 'app/models/pageflow/panorama/package.rb', line 56

def unpacker
  UnpackToS3.new(archive: archive,
                 destination_bucket: attachment_on_s3.s3_bucket,
                 destination_base_path: unpack_base_path)
end