Class: User::Operation::RefreshToken

Inherits:
Trailblazer::Operation
  • Object
show all
Defined in:
app/concepts/morpho/user/operation/refresh_token.rb

Instance Method Summary collapse

Instance Method Details

#authentication_token(options) ⇒ Object



31
32
33
# File 'app/concepts/morpho/user/operation/refresh_token.rb', line 31

def authentication_token (options, **)
  options['token'] = Morpho::JWT::Payload.new(options['model'])
end

#find(options) ⇒ Object



15
16
17
# File 'app/concepts/morpho/user/operation/refresh_token.rb', line 15

def find (options, **)
  options['model'] = Morpho::User.find_by(refresh_token: options['data']['refresh_token'])
end

#generate_refresh_token(options) ⇒ Object



19
20
21
# File 'app/concepts/morpho/user/operation/refresh_token.rb', line 19

def generate_refresh_token (options, **)
  options['model'].generate_refresh_token!
end

#not_found(options) ⇒ Object



27
28
29
# File 'app/concepts/morpho/user/operation/refresh_token.rb', line 27

def not_found (options, **)
  options['error'] = :not_found
end

#not_valid(options) ⇒ Object



23
24
25
# File 'app/concepts/morpho/user/operation/refresh_token.rb', line 23

def not_valid (options, **)
  options['error'] = :not_valid
end

#validate(options) ⇒ Object



10
11
12
13
# File 'app/concepts/morpho/user/operation/refresh_token.rb', line 10

def validate (options, **)
  options['contract'] = Morpho::User::Contract::RefreshToken.new(OpenStruct.new)
  options['contract'].validate(options['data'])
end