Class: MigrationPlans::ImportConfigService
- Inherits:
-
Object
- Object
- MigrationPlans::ImportConfigService
- Defined in:
- app/services/migration_plans/import_config_service.rb
Instance Attribute Summary collapse
-
#config_json ⇒ Object
readonly
Returns the value of attribute config_json.
-
#current_user ⇒ Object
readonly
Returns the value of attribute current_user.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(config_json, current_user) ⇒ ImportConfigService
constructor
A new instance of ImportConfigService.
- #success? ⇒ Boolean
Constructor Details
#initialize(config_json, current_user) ⇒ ImportConfigService
Returns a new instance of ImportConfigService.
7 8 9 10 11 12 |
# File 'app/services/migration_plans/import_config_service.rb', line 7 def initialize(config_json, current_user) @config_json = config_json @current_user = current_user @errors = [] @step_mapping = {} # Maps sequence to step objects for dependency resolution end |
Instance Attribute Details
#config_json ⇒ Object (readonly)
Returns the value of attribute config_json.
5 6 7 |
# File 'app/services/migration_plans/import_config_service.rb', line 5 def config_json @config_json end |
#current_user ⇒ Object (readonly)
Returns the value of attribute current_user.
5 6 7 |
# File 'app/services/migration_plans/import_config_service.rb', line 5 def current_user @current_user end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
5 6 7 |
# File 'app/services/migration_plans/import_config_service.rb', line 5 def errors @errors end |
Instance Method Details
#call ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/services/migration_plans/import_config_service.rb', line 14 def call config = parse_config return nil unless config validate_config(config) return nil if @errors.any? create_plan_with_steps(config) rescue StandardError => e @errors << "Import failed: #{e.message}" nil end |
#success? ⇒ Boolean
27 28 29 |
# File 'app/services/migration_plans/import_config_service.rb', line 27 def success? @errors.empty? end |