Class: Dsu::Services::EntryGroup::ImporterService

Inherits:
Object
  • Object
show all
Includes:
Dsu::Support::Fileable
Defined in:
lib/dsu/services/entry_group/importer_service.rb

Overview

Expects a hash having the following format: { “Project 1 Name” => {

  "2023-12-29" => ["Entry 1 description", "Entry 2 description", ...],
  "2023-12-30" => ["Entry 1 description", ...],
  "2023-12-31" => ["Entry 1 description", ...]
},

“Project 2 Name” => {

  "2023-12-29" => ["Entry 1 description", "Entry 2 description", ...],
  "2023-12-30" => ["Entry 1 description", ...],
  "2023-12-31" => ["Entry 1 description", ...]
}

}

Constant Summary

Constants included from Dsu::Support::Fileable

Dsu::Support::Fileable::MIGRATION_VERSION_FILE_NAME

Instance Method Summary collapse

Methods included from Dsu::Support::Fileable

#backup_folder_for, #config_file_name, #config_folder, #config_path, #current_project_file, #current_project_file_name, #dsu_folder, #entries_file_name, #entries_folder, #entries_path, #gem_dir, #migration_version_folder, #migration_version_path, #project_file_for, #project_folder_for, #projects_folder, #root_folder, #seed_data_dsu_configuration_for, #seed_data_dsu_folder_for, #temp_folder, #theme_file_name, #themes_folder, #themes_path

Constructor Details

#initialize(import_projects:, options: {}) ⇒ ImporterService

Returns a new instance of ImporterService.

Raises:

  • (ArgumentError)


26
27
28
29
30
31
32
33
34
# File 'lib/dsu/services/entry_group/importer_service.rb', line 26

def initialize(import_projects:, options: {})
  raise ArgumentError, 'Argument import_projects is blank' if import_projects.blank?
  raise ArgumentError, 'Argument import_projects is not a Hash' unless import_projects.is_a?(Hash)

  raise_if_more_than_one_project(import_projects)

  @import_projects = import_projects
  @options = options
end

Instance Method Details

#callObject



36
37
38
# File 'lib/dsu/services/entry_group/importer_service.rb', line 36

def call
  import!
end