Class: Pike13::CLI::Commands::Desk::Booking
- Inherits:
-
Base
- Object
- Thor
- Base
- Pike13::CLI::Commands::Desk::Booking
show all
- Defined in:
- lib/pike13/cli/commands/desk/booking.rb
Instance Method Summary
collapse
Methods inherited from Base
base_usage, format_options, handle_argument_error, printable_commands
included
Instance Method Details
#create ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/pike13/cli/commands/desk/booking.rb', line 21
def create
handle_error do
require "securerandom"
result = Pike13::Desk::Booking.create(
event_occurrence_id: options[:event_occurrence_id],
person_id: options[:person_id],
idempotency_token: SecureRandom.uuid
)
output(result)
end
end
|
#delete(id) ⇒ Object
46
47
48
49
50
51
|
# File 'lib/pike13/cli/commands/desk/booking.rb', line 46
def delete(id)
handle_error do
Pike13::Desk::Booking.destroy(id)
success_message "Booking #{id} deleted successfully"
end
end
|
#get(id) ⇒ Object
10
11
12
13
14
15
|
# File 'lib/pike13/cli/commands/desk/booking.rb', line 10
def get(id)
handle_error do
result = Pike13::Desk::Booking.find(id)
output(result)
end
end
|
#update(id) ⇒ Object
36
37
38
39
40
41
42
43
|
# File 'lib/pike13/cli/commands/desk/booking.rb', line 36
def update(id)
handle_error do
attributes = {}
attributes[:state] = options[:state] if options[:state]
result = Pike13::Desk::Booking.update(id, attributes)
output(result)
end
end
|