Class: Example::Signup::CreateUserService

Inherits:
Object
  • Object
show all
Includes:
Workflows::StepService
Defined in:
lib/example/signup/step_services/create_user.rb

Instance Method Summary collapse

Methods included from Workflows::StepService

#args, #get_output, #get_state, #set_args, #set_output, #set_state

Instance Method Details

#runObject



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/example/signup/step_services/create_user.rb', line 10

def run
  user = Models::User.new(args.name, args.dob)
  if user.create
    # success
    set_state(user: user)
    set_output "#{user.name} is successfully created."
  else
    # failure
    raise "Unable to create user"
  end
end