Class: UserManager
- Inherits:
-
Object
- Object
- UserManager
- Defined in:
- app/services/user_manager.rb
Instance Attribute Summary collapse
-
#user ⇒ Object
Returns the value of attribute user.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(user = nil) ⇒ UserManager
constructor
A new instance of UserManager.
- #update(parameters, profile) ⇒ Object
Constructor Details
#initialize(user = nil) ⇒ UserManager
Returns a new instance of UserManager.
5 6 7 |
# File 'app/services/user_manager.rb', line 5 def initialize(user = nil) @user = user end |
Instance Attribute Details
#user ⇒ Object
Returns the value of attribute user.
2 3 4 |
# File 'app/services/user_manager.rb', line 2 def user @user end |
Class Method Details
.create(parameters, profile) ⇒ Object
11 12 13 14 15 16 17 |
# File 'app/services/user_manager.rb', line 11 def self.create(parameters, profile) user = User.new(parameters) user.data['profile'] = UserProfileHandler.clean_parameters(profile) { user: user, profile: user.data['profile'] } end |
Instance Method Details
#update(parameters, profile) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'app/services/user_manager.rb', line 21 def update(parameters, profile) raise 'User is not set' if @user.nil? parameters['data'] = @user.data.merge(profile: UserProfileHandler.clean_parameters(profile)) @user.update(parameters) { user: @user, profile: @user.data['profile'] } end |