Class: Employees::UpdateService
- Inherits:
-
Object
- Object
- Employees::UpdateService
- Defined in:
- app/services/employees/update_service.rb
Instance Attribute Summary collapse
-
#current_company ⇒ Object
readonly
Returns the value of attribute current_company.
-
#current_user ⇒ Object
readonly
Returns the value of attribute current_user.
-
#employee_params ⇒ Object
readonly
Returns the value of attribute employee_params.
-
#erp_user_params ⇒ Object
readonly
Returns the value of attribute erp_user_params.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(employee_params:, erp_user_params:, current_user:, current_company:) ⇒ UpdateService
constructor
A new instance of UpdateService.
Constructor Details
#initialize(employee_params:, erp_user_params:, current_user:, current_company:) ⇒ UpdateService
Returns a new instance of UpdateService.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/services/employees/update_service.rb', line 8 def initialize( employee_params:, erp_user_params:, current_user:, current_company: ) @employee_params = employee_params @erp_user_params = erp_user_params @current_user = current_user @current_company = current_company end |
Instance Attribute Details
#current_company ⇒ Object (readonly)
Returns the value of attribute current_company.
3 4 5 |
# File 'app/services/employees/update_service.rb', line 3 def current_company @current_company end |
#current_user ⇒ Object (readonly)
Returns the value of attribute current_user.
3 4 5 |
# File 'app/services/employees/update_service.rb', line 3 def current_user @current_user end |
#employee_params ⇒ Object (readonly)
Returns the value of attribute employee_params.
3 4 5 |
# File 'app/services/employees/update_service.rb', line 3 def employee_params @employee_params end |
#erp_user_params ⇒ Object (readonly)
Returns the value of attribute erp_user_params.
3 4 5 |
# File 'app/services/employees/update_service.rb', line 3 def erp_user_params @erp_user_params end |
Instance Method Details
#call ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'app/services/employees/update_service.rb', line 20 def call ActiveRecord::Base.transaction do update_record find_and_update_or_create_erp_user validate_after_associations @employee end end |