Class: Tartarus::RemoteStorage::Glacier
- Inherits:
-
Object
- Object
- Tartarus::RemoteStorage::Glacier
- Defined in:
- lib/tartarus/remote_storage/glacier.rb,
lib/tartarus/remote_storage/glacier/file.rb,
lib/tartarus/remote_storage/glacier/client.rb,
lib/tartarus/remote_storage/glacier/csv_export.rb,
lib/tartarus/remote_storage/glacier/configuration.rb,
lib/tartarus/remote_storage/glacier/register_upload.rb
Defined Under Namespace
Classes: Client, Configuration, CsvExport, File, RegisterUpload
Instance Method Summary collapse
-
#initialize(configuration, clock: Time) ⇒ Glacier
constructor
A new instance of Glacier.
- #store(collection, archivable_model, tenant_id: nil, tenant_id_field: nil) ⇒ Object
Constructor Details
#initialize(configuration, clock: Time) ⇒ Glacier
Returns a new instance of Glacier.
14 15 16 17 |
# File 'lib/tartarus/remote_storage/glacier.rb', line 14 def initialize(configuration, clock: Time) @configuration = configuration @clock = clock end |
Instance Method Details
#store(collection, archivable_model, tenant_id: nil, tenant_id_field: nil) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/tartarus/remote_storage/glacier.rb', line 19 def store(collection, archivable_model, tenant_id: nil, tenant_id_field: nil) path_to_file = path_to_file_for(archivable_model, tenant_id_field, tenant_id) export_to_csv(collection, path_to_file) glacier_file = Tartarus::RemoteStorage::Glacier::File.new(::File.new(path_to_file)) glacier_response = upload(glacier_file) register_upload(glacier_response, archivable_model, tenant_id_field, tenant_id) ensure glacier_file.delete_from_local_storage if glacier_file end |