Class: Clusters::UpdateService
- Inherits:
-
Object
- Object
- Clusters::UpdateService
- Defined in:
- app/services/clusters/update_service.rb
Instance Attribute Summary collapse
-
#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(cluster) ⇒ Object
-
#initialize(user = nil, params = {}) ⇒ UpdateService
constructor
A new instance of UpdateService.
Constructor Details
#initialize(user = nil, params = {}) ⇒ UpdateService
Returns a new instance of UpdateService.
7 8 9 10 |
# File 'app/services/clusters/update_service.rb', line 7 def initialize(user = nil, params = {}) @current_user = user @params = params.dup end |
Instance Attribute Details
#current_user ⇒ Object (readonly)
Returns the value of attribute current_user.
5 6 7 |
# File 'app/services/clusters/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/clusters/update_service.rb', line 5 def params @params end |
Instance Method Details
#execute(cluster) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/services/clusters/update_service.rb', line 12 def execute(cluster) if validate_params(cluster) token = params.dig(:platform_kubernetes_attributes, :token) if token.blank? params[:platform_kubernetes_attributes]&.delete(:token) end cluster.update(params) else false end end |