Class: Pike13::CLI::Commands::Front::Booking
- Inherits:
-
Base
- Object
- Thor
- Base
- Pike13::CLI::Commands::Front::Booking
show all
- Defined in:
- lib/pike13/cli/commands/front/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
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/pike13/cli/commands/front/booking.rb', line 18
def create
handle_error do
require "securerandom"
attributes = {
event_occurrence_id: options[:event_occurrence_id],
person_id: options[:person_id],
idempotency_token: SecureRandom.uuid
}
result = Pike13::Front::Booking.create(attributes)
output(result)
success_message "Booking created successfully"
end
end
|
#delete(id) ⇒ Object
46
47
48
49
50
51
|
# File 'lib/pike13/cli/commands/front/booking.rb', line 46
def delete(id)
handle_error do
Pike13::Front::Booking.destroy(id)
success_message "Booking #{id} deleted successfully"
end
end
|
#get(id) ⇒ Object
10
11
12
|
# File 'lib/pike13/cli/commands/front/booking.rb', line 10
def get(id)
handle_error { output(Pike13::Front::Booking.find(id)) }
end
|
#update(id) ⇒ Object
35
36
37
38
39
40
41
42
43
|
# File 'lib/pike13/cli/commands/front/booking.rb', line 35
def update(id)
handle_error do
attributes = {}
attributes[:state] = options[:state] if options[:state]
result = Pike13::Front::Booking.update(id, attributes)
output(result)
success_message "Booking updated successfully"
end
end
|