Class: Pageflow::EntryExportImport::RevisionSerialization::Import
- Inherits:
-
Object
- Object
- Pageflow::EntryExportImport::RevisionSerialization::Import
- Defined in:
- lib/pageflow/entry_export_import/revision_serialization/import.rb
Overview
Turn revision into JSON compatible data structure.
Constant Summary collapse
- DEFAULT_REMOVAL_COLUMNS =
%w[id updated_at].freeze
- COMMON_FILE_COLUMNS =
%w[entry_id rights created_at uploader_id confirmed_by_id parent_file_id parent_file_model_type].freeze
Instance Method Summary collapse
-
#initialize(entry:, creator:, file_mappings: FileMappings.new) ⇒ Import
constructor
A new instance of Import.
- #perform(data) ⇒ Object
Constructor Details
#initialize(entry:, creator:, file_mappings: FileMappings.new) ⇒ Import
Returns a new instance of Import.
10 11 12 13 14 |
# File 'lib/pageflow/entry_export_import/revision_serialization/import.rb', line 10 def initialize(entry:, creator:, file_mappings: FileMappings.new) @entry = entry @creator = creator @file_mappings = file_mappings end |
Instance Method Details
#perform(data) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/pageflow/entry_export_import/revision_serialization/import.rb', line 16 def perform(data) Revision.transaction do revision = create_revision(data) (revision, data['widgets']) create_revision_components(revision, data['components']) create_files(revision, data['file_usages']) revision end end |