class Milestoner::CLI::Actions::Cache::Create
Handles creating or updating a user within the cache.
Public Instance Methods
call(values)
click to toggle source
# 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
Private Instance Methods
log_error(message)
click to toggle source
# File lib/milestoner/cli/actions/cache/create.rb, line 36 def log_error(message) = logger.error { message } end
log_info(message)
click to toggle source
# File lib/milestoner/cli/actions/cache/create.rb, line 34 def log_info(message) = logger.info { message } def log_error(message) = logger.error { message } end end