Class: Morpho::Operations::User::GenerateToken

Inherits:
Base::Find
  • Object
show all
Defined in:
app/concepts/morpho/operations/user/generate_token.rb

Direct Known Subclasses

ExternalSignIn, RefreshToken, SignIn

Instance Method Summary collapse

Methods inherited from Base::Find

#model_class!, #params!, #present!, #presenter_class!

Instance Method Details

#build_model!(_options) ⇒ Object

Raises:

  • (NotImplementedError)


23
24
25
# File 'app/concepts/morpho/operations/user/generate_token.rb', line 23

def build_model!(_options, **)
  raise NotImplementedError
end

#check!(_options) ⇒ Object

Raises:

  • (NotImplementedError)


27
28
29
# File 'app/concepts/morpho/operations/user/generate_token.rb', line 27

def check!(_options, **)
  raise NotImplementedError
end

#data!(options, params:) ⇒ Object



9
10
11
# File 'app/concepts/morpho/operations/user/generate_token.rb', line 9

def data!(options, params:, **)
  options['data'] = params['data'].is_a?(Hash) ? params.fetch('data') : {}
end

#validate!(options, data:) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'app/concepts/morpho/operations/user/generate_token.rb', line 13

def validate!(options, data:, **)
  options['contract'] = options['contract.class'].new(OpenStruct.new)

  unless options['contract'].validate(data)
    raise Morpho::Exceptions::StandardError.new(
      errors: options['contract'].errors
    )
  end
end