Class: Decidim::Importers::ImportManifest

Inherits:
Object
  • Object
show all
Defined in:
decidim-core/lib/decidim/importers/import_manifest.rb

Overview

For importing data from files to components. Every resource type should specify it's own creator, which will be responsible for producing (creating) and finishing (saving) the imported resource.

Constant Summary collapse

DEFAULT_FORMATS =
%w(CSV JSON Excel).freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, manifest) ⇒ ImportManifest

Initializes the manifest.

name - The name of the export artifact. It should be unique in the

space or component.

manifest - The parent manifest where this import manifest belongs to.


18
19
20
21
# File 'decidim-core/lib/decidim/importers/import_manifest.rb', line 18

def initialize(name, manifest)
  @name = name.to_sym
  @manifest = manifest
end

Instance Attribute Details

#manifestObject (readonly)

Returns the value of attribute manifest


9
10
11
# File 'decidim-core/lib/decidim/importers/import_manifest.rb', line 9

def manifest
  @manifest
end

#nameObject (readonly)

Returns the value of attribute name


9
10
11
# File 'decidim-core/lib/decidim/importers/import_manifest.rb', line 9

def name
  @name
end

Instance Method Details

#creator(creator = nil) ⇒ Object

Public: Sets the creator when an argument is provided, returns the stored creator otherwise.


25
26
27
# File 'decidim-core/lib/decidim/importers/import_manifest.rb', line 25

def creator(creator = nil)
  @creator ||= creator || Decidim::Admin::Import::Creator
end

#formatsObject


31
32
33
# File 'decidim-core/lib/decidim/importers/import_manifest.rb', line 31

def formats
  DEFAULT_FORMATS
end