Class: Pike13::CLI::Commands::Desk::MakeUp

Inherits:
Base
  • Object
show all
Defined in:
lib/pike13/cli/commands/desk/make_up.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

format_options, handle_argument_error, printable_commands

Methods included from ThorNestedSubcommand

included

Class Method Details

.base_usageObject

Override base_usage to match the actual subcommand registration



9
10
11
# File 'lib/pike13/cli/commands/desk/make_up.rb', line 9

def self.base_usage
  "desk make_ups"
end

Instance Method Details

#generate(visit_id) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/pike13/cli/commands/desk/make_up.rb', line 36

def generate(visit_id)
  handle_error do
    result = Pike13::Desk::MakeUp.generate(
      visit_id: visit_id,
      make_up_reason_id: options[:make_up_reason_id],
      free_form_reason: options[:free_form_reason]
    )
    output(result)
    success_message "Make-up generated successfully"
  end
end

#get(id) ⇒ Object



14
15
16
17
18
19
# File 'lib/pike13/cli/commands/desk/make_up.rb', line 14

def get(id)
  handle_error do
    result = Pike13::Desk::MakeUp.find(id)
    output(result)
  end
end

#reasonsObject



23
24
25
26
27
28
29
30
# File 'lib/pike13/cli/commands/desk/make_up.rb', line 23

def reasons
  handle_error do
    result = with_progress("Fetching make-up reasons") do
      Pike13::Desk::MakeUp.reasons
    end
    output(result)
  end
end