Class: Tartarus::ArchiveModelWithTenant
- Inherits:
-
Object
- Object
- Tartarus::ArchiveModelWithTenant
- Defined in:
- lib/tartarus/archive_model_with_tenant.rb
Instance Method Summary collapse
- #archive(archivable_item_name, tenant_id) ⇒ Object
-
#initialize(registry: Tartarus.registry, repository: Tartarus::ArchivableCollectionRepository.new) ⇒ ArchiveModelWithTenant
constructor
A new instance of ArchiveModelWithTenant.
Constructor Details
#initialize(registry: Tartarus.registry, repository: Tartarus::ArchivableCollectionRepository.new) ⇒ ArchiveModelWithTenant
Returns a new instance of ArchiveModelWithTenant.
5 6 7 8 |
# File 'lib/tartarus/archive_model_with_tenant.rb', line 5 def initialize(registry: Tartarus.registry, repository: Tartarus::ArchivableCollectionRepository.new) @registry = registry @repository = repository end |
Instance Method Details
#archive(archivable_item_name, tenant_id) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/tartarus/archive_model_with_tenant.rb', line 10 def archive(archivable_item_name, tenant_id) archivable_item = registry.find_by_name(archivable_item_name) collection = collection_to_archive(archivable_item, tenant_id) archivable_item.remote_storage.store(collection, archivable_item.name, tenant_id: tenant_id, tenant_id_field: archivable_item.tenant_id_field) archivable_item.archive_strategy.call(collection) end |