Class: Contentful::Importer::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/contentful/importer/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(settings) ⇒ Configuration

Returns a new instance of Configuration.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/contentful/importer/configuration.rb', line 18

def initialize(settings)
  @config = settings
  validate_required_parameters
  @data_dir = settings['data_dir']
  @collections_dir = "#{data_dir}/collections"
  @entries_dir = "#{data_dir}/entries"
  @assets_dir = "#{data_dir}/assets"
  @log_files_dir = "#{data_dir}/logs"
  @threads_dir = "#{data_dir}/threads"
  @imported_entries = []
  @published_entries = []
  @published_assets = []
  @space_id = settings['space_id']
end

Instance Attribute Details

#assets_dirObject (readonly)

Returns the value of attribute assets_dir.



5
6
7
# File 'lib/contentful/importer/configuration.rb', line 5

def assets_dir
  @assets_dir
end

#collections_dirObject (readonly)

Returns the value of attribute collections_dir.



5
6
7
# File 'lib/contentful/importer/configuration.rb', line 5

def collections_dir
  @collections_dir
end

#configObject (readonly)

Returns the value of attribute config.



5
6
7
# File 'lib/contentful/importer/configuration.rb', line 5

def config
  @config
end

#data_dirObject (readonly)

Returns the value of attribute data_dir.



5
6
7
# File 'lib/contentful/importer/configuration.rb', line 5

def data_dir
  @data_dir
end

#entries_dirObject (readonly)

Returns the value of attribute entries_dir.



5
6
7
# File 'lib/contentful/importer/configuration.rb', line 5

def entries_dir
  @entries_dir
end

#imported_entriesObject (readonly)

Returns the value of attribute imported_entries.



5
6
7
# File 'lib/contentful/importer/configuration.rb', line 5

def imported_entries
  @imported_entries
end

#log_files_dirObject (readonly)

Returns the value of attribute log_files_dir.



5
6
7
# File 'lib/contentful/importer/configuration.rb', line 5

def log_files_dir
  @log_files_dir
end

#published_assetsObject (readonly)

Returns the value of attribute published_assets.



5
6
7
# File 'lib/contentful/importer/configuration.rb', line 5

def published_assets
  @published_assets
end

#published_entriesObject (readonly)

Returns the value of attribute published_entries.



5
6
7
# File 'lib/contentful/importer/configuration.rb', line 5

def published_entries
  @published_entries
end

#space_idObject (readonly)

Returns the value of attribute space_id.



5
6
7
# File 'lib/contentful/importer/configuration.rb', line 5

def space_id
  @space_id
end

#threads_dirObject (readonly)

Returns the value of attribute threads_dir.



5
6
7
# File 'lib/contentful/importer/configuration.rb', line 5

def threads_dir
  @threads_dir
end

Instance Method Details

#validate_required_parametersObject



33
34
35
# File 'lib/contentful/importer/configuration.rb', line 33

def validate_required_parameters
  fail ArgumentError, 'Set PATH to data_dir. Folder where all data will be stored. View README' if config['data_dir'].nil?
end