Class: UserService::Update

Inherits:
Object
  • Object
show all
Includes:
DefaultErrorContainer
Defined in:
app/services/user_service/update.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DefaultErrorContainer

#error, #error_message_simple, #merge_errors

Constructor Details

#initialize(user, valid_params) ⇒ Update

Returns a new instance of Update.



5
6
7
8
# File 'app/services/user_service/update.rb', line 5

def initialize(user, valid_params)
  @user = user
  @valid_params = valid_params
end

Instance Attribute Details

#userObject

Returns the value of attribute user.



3
4
5
# File 'app/services/user_service/update.rb', line 3

def user
  @user
end

#valid_paramsObject

Returns the value of attribute valid_params.



3
4
5
# File 'app/services/user_service/update.rb', line 3

def valid_params
  @valid_params
end

Instance Method Details

#update_accountObject



17
18
19
20
21
22
# File 'app/services/user_service/update.rb', line 17

def 
  update_account!
rescue StandardError => e
  APMErrorHandler.report(e)
  false
end

#update_account!Object



24
25
26
27
28
# File 'app/services/user_service/update.rb', line 24

def update_account!
  update_data

  true
end

#valid?Boolean

Returns:

  • (Boolean)


10
11
12
13
14
15
# File 'app/services/user_service/update.rb', line 10

def valid?
  return false if user.blank?
  return false if errors.present?

  true
end