Class: Skala::AlephAdapter::UpdateUser
- Inherits:
-
Skala::Adapter::UpdateUser
- Object
- Skala::Adapter::Operation
- Skala::Adapter::UpdateUser
- Skala::AlephAdapter::UpdateUser
- Includes:
- parentparent::ResolveUser
- Defined in:
- lib/skala/aleph_adapter/update_user.rb
Instance Attribute Summary
Attributes inherited from Skala::Adapter::Operation
Instance Method Summary collapse
Methods inherited from Skala::Adapter::Operation
Constructor Details
This class inherits a constructor from Skala::Adapter::Operation
Instance Method Details
#call(username, options = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/skala/aleph_adapter/update_user.rb', line 8 def call(username, = {}) username = username.upcase # ensure that username/id is always upcased = .select { |_key, _| respond_to?("update_#{_key}", true) }.to_h # # Updating multiple properties in one go is a non trivial task, especially # if one of n updates fails, which implies rollbacks or partial update # if .keys.length > 1 raise ArgumentError.new("Only one property can be changed within one call!") elsif .keys.length < 1 raise ArgumentError.new("Unknown property to update!") end property_name, new_value = [.keys.first, .values.first] send("update_#{property_name}", username, new_value, ) end |