Module: Pageflow::EntryExportImport::EntrySerialization Private
- Extended by:
- EntrySerialization
- Included in:
- EntrySerialization
- Defined in:
- lib/pageflow/entry_export_import/entry_serialization.rb
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- DEFAULT_REMOVAL_COLUMNS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
%w[id updated_at].freeze
Instance Method Summary collapse
-
#dump(entry, publication = nil) ⇒ Object
private
Turn entry into JSON compatible data structure.
-
#import(data, options) ⇒ Object
private
Create entry from serialized JSON export.
Instance Method Details
#dump(entry, publication = nil) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Turn entry into JSON compatible data structure.
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/pageflow/entry_export_import/entry_serialization.rb', line 10 def dump(entry, publication = nil) { 'page_type_versions' => PageTypeVersions.dump, # features_configuration is specifically excluded via `Entry#blacklist_for_serialization` # to prevent it from showing up in Active Admin JSON exports. # It is included separately as part of the entry export. 'entry' => entry .as_json(except: [:folder_id, :password_digest, :users_count]) .merge('features_configuration' => entry.features_configuration, 'draft' => RevisionSerialization.dump(entry.draft), 'last_publication' => dump_publication(publication)) } end |
#import(data, options) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Create entry from serialized JSON export
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/pageflow/entry_export_import/entry_serialization.rb', line 25 def import(data, ) PageTypeVersions.verify_compatibility!(data['page_type_versions']) entry_data = data['entry'] entry = create_entry(entry_data.except('draft', 'last_publication'), ) file_mappings = .fetch(:file_mappings, FileMappings.new) import_draft(entry_data, , entry, file_mappings) import_last_publication(entry_data, , entry, file_mappings) entry end |