Class: WithAccounts::MeaningfulController
Instance Method Summary
collapse
#render_around_action_errors, #render_errors, #render_low_camel_cased, #set_json_content_type, #snake_case_params
#error_key, #format_errors
Instance Method Details
#create_access_token ⇒ Object
27
28
29
30
31
32
33
34
|
# File 'app/controllers/with_accounts/meaningful_controller.rb', line 27
def create_access_token
data = { access_token: '' }
performance = Jwts::AccessTokensCreating::Scenario.new(params: params).act_out!
(render_errors(performance.errors) && return) unless performance.success?
data.merge!(access_token: performance.stage.new_token)
render_low_camel_cased(data, :created)
end
|
#create_login_invitation ⇒ Object
7
8
9
10
11
12
|
# File 'app/controllers/with_accounts/meaningful_controller.rb', line 7
def create_login_invitation
performance = LoginInvitationsCreating::Scenario.new(params: params).act_out!
(render_errors(performance.errors) && return) unless performance.success?
render status: :no_content
end
|
#create_tokens ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'app/controllers/with_accounts/meaningful_controller.rb', line 14
def create_tokens
data = { access_token: '', refresh_token: '' }
performance = Jwts::RefreshTokensCreating::Scenario.new(params: params).act_out!
(render_errors(performance.errors) && return) unless performance.success?
data.merge!(refresh_token: performance.stage.new_token)
performance = Jwts::AccessTokensCreating::Scenario.new(params: { refresh_token: data[:refresh_token] }).act_out!
(render_errors(performance.errors) && return) unless performance.success?
data.merge!(access_token: performance.stage.new_token)
render_low_camel_cased(data, :created)
end
|
#not_found ⇒ Object
3
4
5
|
# File 'app/controllers/with_accounts/meaningful_controller.rb', line 3
def not_found
render body: '{"errors": "not found"}', status: 404
end
|
#set_user_password ⇒ Object
36
37
38
39
40
41
|
# File 'app/controllers/with_accounts/meaningful_controller.rb', line 36
def set_user_password
performance = PasswordsCreating::Scenario.new(params: params).act_out!
(render_errors(performance.errors) && return) unless performance.success?
render_low_camel_cased({}, :created)
end
|