Class: Postnhost::Onboarding::StepProcessor
- Inherits:
-
BaseService
- Object
- BaseService
- Postnhost::Onboarding::StepProcessor
- Defined in:
- app/services/postnhost/onboarding/step_processor.rb
Constant Summary collapse
- STEP_SERVICES =
{ "1" => Steps::CreateAdminAccount, "2" => Steps::ChooseLanguages, "3" => Steps::SetSiteMetadata, "4" => Steps::FinishSetup, "post_install_done" => Steps::CompletePostInstallChecklist }.freeze
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#session ⇒ Object
readonly
Returns the value of attribute session.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(params:, session:) ⇒ StepProcessor
constructor
A new instance of StepProcessor.
Methods inherited from BaseService
Constructor Details
#initialize(params:, session:) ⇒ StepProcessor
Returns a new instance of StepProcessor.
14 15 16 17 |
# File 'app/services/postnhost/onboarding/step_processor.rb', line 14 def initialize(params:, session:) @params = params @session = session end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
12 13 14 |
# File 'app/services/postnhost/onboarding/step_processor.rb', line 12 def params @params end |
#session ⇒ Object (readonly)
Returns the value of attribute session.
12 13 14 |
# File 'app/services/postnhost/onboarding/step_processor.rb', line 12 def session @session end |
Instance Method Details
#call ⇒ Object
19 20 21 22 23 24 |
# File 'app/services/postnhost/onboarding/step_processor.rb', line 19 def call service_class = STEP_SERVICES[params[:step].to_s] return success({ alert: "Invalid step." }, status: :redirect_onboarding) unless service_class service_class.call(params:, session:) end |