Class: Milestoner::CLI::Actions::Cache::Create
- Inherits:
-
Sod::Action
- Object
- Sod::Action
- Milestoner::CLI::Actions::Cache::Create
- Defined in:
- lib/milestoner/cli/actions/cache/create.rb
Overview
Handles creating or updating a user within the cache.
Instance Method Summary collapse
Instance Method Details
#call(values) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/milestoner/cli/actions/cache/create.rb', line 20 def call values case values.split "," in String => external_id, String => handle, String => name client.write(:users) { upsert({external_id:, handle:, name:}) } .bind { |user| log_info "Created: #{user.name.inspect}" } in String, String then log_error "Name must be supplied." in [String] then log_error "Handle and Name must be supplied." in Core::EMPTY_ARRAY then log_error "No values given." else log_error "Too many values given." end end |