Class: Achievements::UpdateService
- Inherits:
-
Object
- Object
- Achievements::UpdateService
- Defined in:
- app/services/achievements/update_service.rb
Instance Attribute Summary collapse
-
#achievement ⇒ Object
readonly
Returns the value of attribute achievement.
-
#current_user ⇒ Object
readonly
Returns the value of attribute current_user.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(current_user, achievement, params) ⇒ UpdateService
constructor
A new instance of UpdateService.
Constructor Details
#initialize(current_user, achievement, params) ⇒ UpdateService
Returns a new instance of UpdateService.
7 8 9 10 11 |
# File 'app/services/achievements/update_service.rb', line 7 def initialize(current_user, achievement, params) @current_user = current_user @achievement = achievement @params = params end |
Instance Attribute Details
#achievement ⇒ Object (readonly)
Returns the value of attribute achievement.
5 6 7 |
# File 'app/services/achievements/update_service.rb', line 5 def achievement @achievement end |
#current_user ⇒ Object (readonly)
Returns the value of attribute current_user.
5 6 7 |
# File 'app/services/achievements/update_service.rb', line 5 def current_user @current_user end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
5 6 7 |
# File 'app/services/achievements/update_service.rb', line 5 def params @params end |
Instance Method Details
#execute ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'app/services/achievements/update_service.rb', line 13 def execute return unless allowed? if achievement.update(params) ServiceResponse.success(payload: achievement) else error_updating end end |