Class: JwtAuthEngine::SignupService

Inherits:
BaseService show all
Defined in:
app/services/jwt_auth_engine/signup_service.rb

Overview

Creates a new auth model record from signup parameters.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseService

#failure, #success

Constructor Details

#initialize(signup_params:) ⇒ SignupService

Returns a new instance of SignupService.



8
9
10
11
# File 'app/services/jwt_auth_engine/signup_service.rb', line 8

def initialize(signup_params:)
  @signup_params = 
  super()
end

Instance Attribute Details

#signup_paramsObject (readonly)

Returns the value of attribute signup_params.



6
7
8
# File 'app/services/jwt_auth_engine/signup_service.rb', line 6

def 
  @signup_params
end

Instance Method Details

#callObject



13
14
15
16
17
18
19
20
21
# File 'app/services/jwt_auth_engine/signup_service.rb', line 13

def call
  auth_model_instance = JwtAuthEngine.auth_model_class.new()

  if auth_model_instance.save
    success(JwtAuthEngine.auth_model_name => auth_model_instance)
  else
    failure(errors: auth_model_instance.errors.full_messages)
  end
end