Class: Pike13::CLI::Commands::Desk::WaitlistEntry

Inherits:
Base
  • Object
show all
Defined in:
lib/pike13/cli/commands/desk/waitlist_entry.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/waitlist_entry.rb', line 9

def self.base_usage
  "desk waitlist_entry"
end

Instance Method Details

#createObject



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

def create
  handle_error do
    attributes = {
      person_id: options[:person_id],
      event_id: options[:event_id]
    }
    result = Pike13::Desk::WaitlistEntry.create(attributes)
    output(result)
    success_message "Waitlist entry created successfully"
  end
end

#delete(id) ⇒ Object



63
64
65
66
67
68
# File 'lib/pike13/cli/commands/desk/waitlist_entry.rb', line 63

def delete(id)
  handle_error do
    Pike13::Desk::WaitlistEntry.destroy(id)
    success_message "Waitlist entry #{id} deleted successfully"
  end
end

#get(id) ⇒ Object



26
27
28
29
30
31
# File 'lib/pike13/cli/commands/desk/waitlist_entry.rb', line 26

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

#listObject



15
16
17
18
19
20
21
22
# File 'lib/pike13/cli/commands/desk/waitlist_entry.rb', line 15

def list
  handle_error do
    result = with_progress("Fetching waitlist entries") do
      Pike13::Desk::WaitlistEntry.all
    end
    output(result)
  end
end

#update(id) ⇒ Object



52
53
54
55
56
57
58
59
60
# File 'lib/pike13/cli/commands/desk/waitlist_entry.rb', line 52

def update(id)
  handle_error do
    attributes = {}
    attributes[:state] = options[:state] if options[:state]
    result = Pike13::Desk::WaitlistEntry.update(id, attributes)
    output(result)
    success_message "Waitlist entry updated successfully"
  end
end