pike13-cli 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +196 -0
  3. data/CONTRIBUTING.md +96 -0
  4. data/LICENSE.txt +21 -0
  5. data/README.md +896 -0
  6. data/bin/pike13 +6 -0
  7. data/completions/_pike13 +229 -0
  8. data/completions/pike13.bash +112 -0
  9. data/lib/pike13/cli/commands/account/business.rb +22 -0
  10. data/lib/pike13/cli/commands/account/confirmation.rb +21 -0
  11. data/lib/pike13/cli/commands/account/password.rb +21 -0
  12. data/lib/pike13/cli/commands/account/person.rb +22 -0
  13. data/lib/pike13/cli/commands/account.rb +33 -0
  14. data/lib/pike13/cli/commands/base.rb +350 -0
  15. data/lib/pike13/cli/commands/concerns/formattable_command.rb +48 -0
  16. data/lib/pike13/cli/commands/concerns/reporting_query.rb +59 -0
  17. data/lib/pike13/cli/commands/desk/appointment.rb +58 -0
  18. data/lib/pike13/cli/commands/desk/booking.rb +56 -0
  19. data/lib/pike13/cli/commands/desk/business.rb +20 -0
  20. data/lib/pike13/cli/commands/desk/custom_field.rb +27 -0
  21. data/lib/pike13/cli/commands/desk/event.rb +32 -0
  22. data/lib/pike13/cli/commands/desk/event_occurrence.rb +64 -0
  23. data/lib/pike13/cli/commands/desk/event_occurrence_note.rb +82 -0
  24. data/lib/pike13/cli/commands/desk/event_occurrence_visit.rb +26 -0
  25. data/lib/pike13/cli/commands/desk/event_occurrence_waitlist_entry.rb +26 -0
  26. data/lib/pike13/cli/commands/desk/form_of_payment.rb +75 -0
  27. data/lib/pike13/cli/commands/desk/invoice.rb +29 -0
  28. data/lib/pike13/cli/commands/desk/location.rb +29 -0
  29. data/lib/pike13/cli/commands/desk/make_up.rb +51 -0
  30. data/lib/pike13/cli/commands/desk/note.rb +71 -0
  31. data/lib/pike13/cli/commands/desk/pack.rb +20 -0
  32. data/lib/pike13/cli/commands/desk/pack_product.rb +101 -0
  33. data/lib/pike13/cli/commands/desk/payment.rb +44 -0
  34. data/lib/pike13/cli/commands/desk/person.rb +98 -0
  35. data/lib/pike13/cli/commands/desk/person_plan.rb +27 -0
  36. data/lib/pike13/cli/commands/desk/person_visit.rb +27 -0
  37. data/lib/pike13/cli/commands/desk/person_waitlist_entry.rb +27 -0
  38. data/lib/pike13/cli/commands/desk/person_waiver.rb +27 -0
  39. data/lib/pike13/cli/commands/desk/plan.rb +29 -0
  40. data/lib/pike13/cli/commands/desk/plan_product.rb +35 -0
  41. data/lib/pike13/cli/commands/desk/punch.rb +20 -0
  42. data/lib/pike13/cli/commands/desk/refund.rb +31 -0
  43. data/lib/pike13/cli/commands/desk/revenue_category.rb +36 -0
  44. data/lib/pike13/cli/commands/desk/sales_tax.rb +36 -0
  45. data/lib/pike13/cli/commands/desk/service.rb +29 -0
  46. data/lib/pike13/cli/commands/desk/staff_member.rb +35 -0
  47. data/lib/pike13/cli/commands/desk/visit.rb +36 -0
  48. data/lib/pike13/cli/commands/desk/waitlist_entry.rb +69 -0
  49. data/lib/pike13/cli/commands/desk.rb +172 -0
  50. data/lib/pike13/cli/commands/front/appointment.rb +31 -0
  51. data/lib/pike13/cli/commands/front/booking.rb +56 -0
  52. data/lib/pike13/cli/commands/front/branding.rb +17 -0
  53. data/lib/pike13/cli/commands/front/business.rb +17 -0
  54. data/lib/pike13/cli/commands/front/event.rb +22 -0
  55. data/lib/pike13/cli/commands/front/event_occurrence.rb +35 -0
  56. data/lib/pike13/cli/commands/front/event_occurrence_note.rb +35 -0
  57. data/lib/pike13/cli/commands/front/event_occurrence_waitlist_eligibility.rb +27 -0
  58. data/lib/pike13/cli/commands/front/form_of_payment.rb +83 -0
  59. data/lib/pike13/cli/commands/front/location.rb +22 -0
  60. data/lib/pike13/cli/commands/front/person.rb +17 -0
  61. data/lib/pike13/cli/commands/front/person_plan.rb +26 -0
  62. data/lib/pike13/cli/commands/front/person_visit.rb +26 -0
  63. data/lib/pike13/cli/commands/front/person_waitlist_entry.rb +26 -0
  64. data/lib/pike13/cli/commands/front/person_waiver.rb +26 -0
  65. data/lib/pike13/cli/commands/front/plan_product.rb +31 -0
  66. data/lib/pike13/cli/commands/front/plan_terms.rb +42 -0
  67. data/lib/pike13/cli/commands/front/service.rb +22 -0
  68. data/lib/pike13/cli/commands/front.rb +113 -0
  69. data/lib/pike13/cli/commands/report/clients.rb +27 -0
  70. data/lib/pike13/cli/commands/report/enrollments.rb +27 -0
  71. data/lib/pike13/cli/commands/report/event_occurrence_staff_members.rb +31 -0
  72. data/lib/pike13/cli/commands/report/event_occurrences.rb +31 -0
  73. data/lib/pike13/cli/commands/report/invoice_item_transactions.rb +31 -0
  74. data/lib/pike13/cli/commands/report/invoice_items.rb +31 -0
  75. data/lib/pike13/cli/commands/report/invoices.rb +27 -0
  76. data/lib/pike13/cli/commands/report/monthly_business_metrics.rb +31 -0
  77. data/lib/pike13/cli/commands/report/pays.rb +27 -0
  78. data/lib/pike13/cli/commands/report/person_plans.rb +31 -0
  79. data/lib/pike13/cli/commands/report/staff_members.rb +31 -0
  80. data/lib/pike13/cli/commands/report/transactions.rb +27 -0
  81. data/lib/pike13/cli/commands/report.rb +77 -0
  82. data/lib/pike13/cli/config.rb +26 -0
  83. data/lib/pike13/cli/formatter.rb +142 -0
  84. data/lib/pike13/cli/progress.rb +85 -0
  85. data/lib/pike13/cli/thor_nested_subcommand.rb +37 -0
  86. data/lib/pike13/cli/version.rb +7 -0
  87. data/lib/pike13/cli.rb +70 -0
  88. metadata +187 -0
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module CLI
5
+ module Commands
6
+ class Desk < Base
7
+ class EventOccurrence < Base
8
+ # Override base_usage to match the actual subcommand registration
9
+ def self.base_usage
10
+ "desk event_occurrences"
11
+ end
12
+ desc "list", "List event occurrences"
13
+ map "ls" => :list
14
+ format_options
15
+ option :from, type: :string, desc: "Start date (YYYY-MM-DD)"
16
+ option :to, type: :string, desc: "End date (YYYY-MM-DD)"
17
+ def list
18
+ # Validate date formats
19
+ validate_date_format(options[:from], "from") if options[:from]
20
+ validate_date_format(options[:to], "to") if options[:to]
21
+
22
+ handle_error do
23
+ params = {}
24
+ params[:from] = options[:from] if options[:from]
25
+ params[:to] = options[:to] if options[:to]
26
+
27
+ result = with_progress("Fetching event occurrences") do
28
+ Pike13::Desk::EventOccurrence.all(**params)
29
+ end
30
+ output(result)
31
+ end
32
+ end
33
+
34
+ desc "get ID", "Get an event occurrence by ID"
35
+ format_options
36
+ def get(id)
37
+ handle_error do
38
+ result = Pike13::Desk::EventOccurrence.find(id)
39
+ output(result)
40
+ end
41
+ end
42
+
43
+ desc "summary", "Get event occurrence summary"
44
+ format_options
45
+ def summary
46
+ handle_error do
47
+ result = Pike13::Desk::EventOccurrence.summary
48
+ output(result)
49
+ end
50
+ end
51
+
52
+ desc "eligibilities ID", "Get enrollment eligibilities for an event occurrence"
53
+ format_options
54
+ def eligibilities(id)
55
+ handle_error do
56
+ result = Pike13::Desk::EventOccurrence.enrollment_eligibilities(id: id)
57
+ output(result)
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,82 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module CLI
5
+ module Commands
6
+ class Desk < Base
7
+ class EventOccurrenceNote < Base
8
+ # Override base_usage to match the actual subcommand registration
9
+ def self.base_usage
10
+ "desk event_occurrence_notes"
11
+ end
12
+ desc "list EVENT_OCCURRENCE_ID", "List notes for an event occurrence"
13
+ format_options
14
+ def list(event_occurrence_id)
15
+ handle_error do
16
+ result = with_progress("Fetching event occurrence notes") do
17
+ Pike13::Desk::EventOccurrenceNote.all(event_occurrence_id: event_occurrence_id)
18
+ end
19
+ output(result)
20
+ end
21
+ end
22
+
23
+ desc "get EVENT_OCCURRENCE_ID ID", "Get a specific note for an event occurrence"
24
+ format_options
25
+ def get(event_occurrence_id, id)
26
+ handle_error do
27
+ result = Pike13::Desk::EventOccurrenceNote.find(event_occurrence_id: event_occurrence_id, id: id)
28
+ output(result)
29
+ end
30
+ end
31
+
32
+ desc "create EVENT_OCCURRENCE_ID", "Create a note for an event occurrence"
33
+ format_options
34
+ option :note, type: :string, required: true, desc: "Note content"
35
+ option :subject, type: :string, required: true, desc: "Note subject"
36
+ def create(event_occurrence_id)
37
+ handle_error do
38
+ attributes = {
39
+ note: options[:note],
40
+ subject: options[:subject]
41
+ }
42
+ result = with_progress("Creating event occurrence note") do
43
+ Pike13::Desk::EventOccurrenceNote.create(event_occurrence_id: event_occurrence_id,
44
+ attributes: attributes)
45
+ end
46
+ output(result)
47
+ end
48
+ end
49
+
50
+ desc "update EVENT_OCCURRENCE_ID ID", "Update a note for an event occurrence"
51
+ format_options
52
+ option :note, type: :string, desc: "Updated note content"
53
+ option :subject, type: :string, desc: "Updated note subject"
54
+ def update(event_occurrence_id, id)
55
+ handle_error do
56
+ attributes = {}
57
+ attributes[:note] = options[:note] if options[:note]
58
+ attributes[:subject] = options[:subject] if options[:subject]
59
+
60
+ result = with_progress("Updating event occurrence note") do
61
+ Pike13::Desk::EventOccurrenceNote.update(event_occurrence_id: event_occurrence_id, id: id,
62
+ attributes: attributes)
63
+ end
64
+ output(result)
65
+ end
66
+ end
67
+
68
+ desc "delete EVENT_OCCURRENCE_ID ID", "Delete a note for an event occurrence"
69
+ format_options
70
+ def delete(event_occurrence_id, id)
71
+ handle_error do
72
+ result = with_progress("Deleting event occurrence note") do
73
+ Pike13::Desk::EventOccurrenceNote.destroy(event_occurrence_id: event_occurrence_id, id: id)
74
+ end
75
+ output(result)
76
+ end
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module CLI
5
+ module Commands
6
+ class Desk < Base
7
+ class EventOccurrenceVisit < Base
8
+ # Override base_usage to match the actual subcommand registration
9
+ def self.base_usage
10
+ "desk event_occurrence_visits"
11
+ end
12
+ desc "list EVENT_OCCURRENCE_ID", "List visits for an event occurrence"
13
+ format_options
14
+ def list(event_occurrence_id)
15
+ handle_error do
16
+ result = with_progress("Fetching event occurrence visits") do
17
+ Pike13::Desk::EventOccurrenceVisit.all(event_occurrence_id: event_occurrence_id)
18
+ end
19
+ output(result)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module CLI
5
+ module Commands
6
+ class Desk < Base
7
+ class EventOccurrenceWaitlistEntry < Base
8
+ # Override base_usage to match the actual subcommand registration
9
+ def self.base_usage
10
+ "desk event_occurrence_waitlist_entries"
11
+ end
12
+ desc "list EVENT_OCCURRENCE_ID", "List waitlist entries for an event occurrence"
13
+ format_options
14
+ def list(event_occurrence_id)
15
+ handle_error do
16
+ result = with_progress("Fetching event occurrence waitlist entries") do
17
+ Pike13::Desk::EventOccurrenceWaitlistEntry.all(event_occurrence_id: event_occurrence_id)
18
+ end
19
+ output(result)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module CLI
5
+ module Commands
6
+ class Desk < Base
7
+ class FormOfPayment < Base
8
+ # Override base_usage to match the actual subcommand registration
9
+ def self.base_usage
10
+ "desk forms_of_payment"
11
+ end
12
+ desc "list PERSON_ID", "List forms of payment for a person"
13
+ map "ls" => :list
14
+ format_options
15
+ def list(person_id)
16
+ handle_error do
17
+ result = with_progress("Fetching forms of payment") do
18
+ Pike13::Desk::FormOfPayment.all(person_id: person_id)
19
+ end
20
+ output(result)
21
+ end
22
+ end
23
+
24
+ desc "get PERSON_ID FOP_ID", "Get a form of payment by ID"
25
+ format_options
26
+ def get(person_id, fop_id)
27
+ handle_error do
28
+ result = Pike13::Desk::FormOfPayment.find(person_id: person_id, id: fop_id)
29
+ output(result)
30
+ end
31
+ end
32
+
33
+ desc "create PERSON_ID", "Create a form of payment for a person"
34
+ format_options
35
+ option :type, type: :string, required: true, desc: "Payment type (creditcard, ach, etc.)"
36
+ option :token, type: :string, required: true, desc: "Payment token from payment processor"
37
+ option :is_default, type: :boolean, default: false, desc: "Set as default payment method"
38
+ def create(person_id)
39
+ handle_error do
40
+ attributes = {
41
+ type: options[:type],
42
+ token: options[:token],
43
+ is_default: options[:is_default]
44
+ }
45
+ result = Pike13::Desk::FormOfPayment.create(person_id: person_id, attributes: attributes)
46
+ output(result)
47
+ success_message "Form of payment created successfully"
48
+ end
49
+ end
50
+
51
+ desc "update PERSON_ID FOP_ID", "Update a form of payment"
52
+ format_options
53
+ option :is_default, type: :boolean, desc: "Set as default payment method"
54
+ def update(person_id, fop_id)
55
+ handle_error do
56
+ attributes = {}
57
+ attributes[:is_default] = options[:is_default] if options.key?(:is_default)
58
+ result = Pike13::Desk::FormOfPayment.update(person_id: person_id, id: fop_id, attributes: attributes)
59
+ output(result)
60
+ success_message "Form of payment updated successfully"
61
+ end
62
+ end
63
+
64
+ desc "delete PERSON_ID FOP_ID", "Delete a form of payment"
65
+ def delete(person_id, fop_id)
66
+ handle_error do
67
+ Pike13::Desk::FormOfPayment.destroy(person_id: person_id, id: fop_id)
68
+ success_message "Form of payment #{fop_id} deleted successfully"
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module CLI
5
+ module Commands
6
+ class Desk < Base
7
+ class Invoice < Base
8
+ desc "list", "List all invoices"
9
+ map "ls" => :list
10
+ format_options
11
+ def list
12
+ handle_error do
13
+ result = with_progress("Fetching invoices") do
14
+ Pike13::Desk::Invoice.all
15
+ end
16
+ output(result)
17
+ end
18
+ end
19
+
20
+ desc "get ID", "Get a invoice by ID"
21
+ format_options
22
+ def get(id)
23
+ handle_error { output(Pike13::Desk::Invoice.find(id)) }
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module CLI
5
+ module Commands
6
+ class Desk < Base
7
+ class Location < Base
8
+ desc "list", "List all locations"
9
+ map "ls" => :list
10
+ format_options
11
+ def list
12
+ handle_error do
13
+ result = with_progress("Fetching locations") do
14
+ Pike13::Desk::Location.all
15
+ end
16
+ output(result)
17
+ end
18
+ end
19
+
20
+ desc "get ID", "Get a location by ID"
21
+ format_options
22
+ def get(id)
23
+ handle_error { output(Pike13::Desk::Location.find(id)) }
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module CLI
5
+ module Commands
6
+ class Desk < Base
7
+ class MakeUp < Base
8
+ # Override base_usage to match the actual subcommand registration
9
+ def self.base_usage
10
+ "desk make_ups"
11
+ end
12
+ desc "get ID", "Get a make-up by ID"
13
+ format_options
14
+ def get(id)
15
+ handle_error do
16
+ result = Pike13::Desk::MakeUp.find(id)
17
+ output(result)
18
+ end
19
+ end
20
+
21
+ desc "reasons", "List make-up reasons"
22
+ format_options
23
+ def reasons
24
+ handle_error do
25
+ result = with_progress("Fetching make-up reasons") do
26
+ Pike13::Desk::MakeUp.reasons
27
+ end
28
+ output(result)
29
+ end
30
+ end
31
+
32
+ desc "generate VISIT_ID", "Generate a make-up credit"
33
+ format_options
34
+ option :make_up_reason_id, type: :numeric, required: true, desc: "Make-up reason ID"
35
+ option :free_form_reason, type: :string, desc: "Free form reason text"
36
+ def generate(visit_id)
37
+ handle_error do
38
+ result = Pike13::Desk::MakeUp.generate(
39
+ visit_id: visit_id,
40
+ make_up_reason_id: options[:make_up_reason_id],
41
+ free_form_reason: options[:free_form_reason]
42
+ )
43
+ output(result)
44
+ success_message "Make-up generated successfully"
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,71 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module CLI
5
+ module Commands
6
+ class Desk < Base
7
+ class Note < Base
8
+ desc "list PERSON_ID", "List notes for a person"
9
+ map "ls" => :list
10
+ format_options
11
+ def list(person_id)
12
+ handle_error do
13
+ result = with_progress("Fetching notes") do
14
+ Pike13::Desk::Note.all(person_id: person_id)
15
+ end
16
+ output(result)
17
+ end
18
+ end
19
+
20
+ desc "get PERSON_ID NOTE_ID", "Get a note by ID"
21
+ format_options
22
+ def get(person_id, note_id)
23
+ handle_error do
24
+ result = Pike13::Desk::Note.find(person_id: person_id, id: note_id)
25
+ output(result)
26
+ end
27
+ end
28
+
29
+ desc "create PERSON_ID", "Create a note for a person"
30
+ format_options
31
+ option :subject, type: :string, required: true, desc: "Note subject"
32
+ option :note, type: :string, required: true, desc: "Note content"
33
+ def create(person_id)
34
+ handle_error do
35
+ attributes = {
36
+ subject: options[:subject],
37
+ note: options[:note]
38
+ }
39
+ result = Pike13::Desk::Note.create(person_id: person_id, attributes: attributes)
40
+ output(result)
41
+ success_message "Note created successfully"
42
+ end
43
+ end
44
+
45
+ desc "update PERSON_ID NOTE_ID", "Update a note"
46
+ format_options
47
+ option :subject, type: :string, desc: "Note subject"
48
+ option :note, type: :string, desc: "Note content"
49
+ def update(person_id, note_id)
50
+ handle_error do
51
+ attributes = {}
52
+ attributes[:subject] = options[:subject] if options[:subject]
53
+ attributes[:note] = options[:note] if options[:note]
54
+ result = Pike13::Desk::Note.update(person_id: person_id, id: note_id, attributes: attributes)
55
+ output(result)
56
+ success_message "Note updated successfully"
57
+ end
58
+ end
59
+
60
+ desc "delete PERSON_ID NOTE_ID", "Delete a note"
61
+ def delete(person_id, note_id)
62
+ handle_error do
63
+ Pike13::Desk::Note.destroy(person_id: person_id, id: note_id)
64
+ success_message "Note #{note_id} deleted successfully"
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module CLI
5
+ module Commands
6
+ class Desk < Base
7
+ class Pack < Base
8
+ desc "get ID", "Get a pack by ID"
9
+ format_options
10
+ def get(id)
11
+ handle_error do
12
+ result = Pike13::Desk::Pack.find(id)
13
+ output(result)
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,101 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module CLI
5
+ module Commands
6
+ class Desk < Base
7
+ class PackProduct < Base
8
+ # Override base_usage to match the actual subcommand registration
9
+ def self.base_usage
10
+ "desk pack_products"
11
+ end
12
+ desc "list", "List all pack products"
13
+ format_options
14
+ def list
15
+ handle_error do
16
+ result = with_progress("Fetching pack products") do
17
+ Pike13::Desk::PackProduct.all
18
+ end
19
+ output(result)
20
+ end
21
+ end
22
+
23
+ desc "get ID", "Get a pack product by ID"
24
+ format_options
25
+ def get(id)
26
+ handle_error do
27
+ result = Pike13::Desk::PackProduct.find(id)
28
+ output(result)
29
+ end
30
+ end
31
+
32
+ desc "create", "Create a pack product"
33
+ format_options
34
+ option :name, type: :string, required: true, desc: "Pack product name"
35
+ option :description, type: :string, desc: "Pack product description"
36
+ option :price, type: :numeric, required: true, desc: "Pack product price"
37
+ option :visit_count, type: :numeric, required: true, desc: "Number of visits"
38
+ def create
39
+ handle_error do
40
+ attributes = {
41
+ name: options[:name],
42
+ description: options[:description],
43
+ price: options[:price],
44
+ visit_count: options[:visit_count]
45
+ }
46
+ result = with_progress("Creating pack product") do
47
+ Pike13::Desk::PackProduct.create(attributes: attributes)
48
+ end
49
+ output(result)
50
+ end
51
+ end
52
+
53
+ desc "update ID", "Update a pack product"
54
+ format_options
55
+ option :name, type: :string, desc: "Updated pack product name"
56
+ option :description, type: :string, desc: "Updated pack product description"
57
+ option :price, type: :numeric, desc: "Updated pack product price"
58
+ option :visit_count, type: :numeric, desc: "Updated number of visits"
59
+ def update(id)
60
+ handle_error do
61
+ attributes = {}
62
+ attributes[:name] = options[:name] if options[:name]
63
+ attributes[:description] = options[:description] if options[:description]
64
+ attributes[:price] = options[:price] if options[:price]
65
+ attributes[:visit_count] = options[:visit_count] if options[:visit_count]
66
+
67
+ result = with_progress("Updating pack product") do
68
+ Pike13::Desk::PackProduct.update(id, attributes: attributes)
69
+ end
70
+ output(result)
71
+ end
72
+ end
73
+
74
+ desc "delete ID", "Delete a pack product"
75
+ format_options
76
+ def delete(id)
77
+ handle_error do
78
+ result = with_progress("Deleting pack product") do
79
+ Pike13::Desk::PackProduct.destroy(id)
80
+ end
81
+ output(result)
82
+ end
83
+ end
84
+
85
+ desc "create-pack PACK_PRODUCT_ID", "Create a pack within a pack product"
86
+ format_options
87
+ option :person_id, type: :numeric, required: true, desc: "Person ID to assign pack to"
88
+ def create_pack(pack_product_id)
89
+ handle_error do
90
+ attributes = { person_id: options[:person_id].to_i }
91
+ result = with_progress("Creating pack") do
92
+ Pike13::Desk::PackProduct.create_pack(pack_product_id, attributes)
93
+ end
94
+ output(result)
95
+ end
96
+ end
97
+ end
98
+ end
99
+ end
100
+ end
101
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module CLI
5
+ module Commands
6
+ class Desk < Base
7
+ class Payment < Base
8
+ desc "get ID", "Get a payment by ID"
9
+ format_options
10
+ def get(id)
11
+ handle_error do
12
+ result = Pike13::Desk::Payment.find(id)
13
+ output(result)
14
+ end
15
+ end
16
+
17
+ desc "configuration", "Get payment configuration"
18
+ format_options
19
+ def configuration
20
+ handle_error do
21
+ result = Pike13::Desk::Payment.configuration
22
+ output(result)
23
+ end
24
+ end
25
+
26
+ desc "void PAYMENT_ID", "Void a payment"
27
+ format_options
28
+ option :invoice_item_ids, type: :array, desc: "Invoice item IDs to cancel"
29
+ def void(payment_id)
30
+ handle_error do
31
+ invoice_item_ids_to_cancel = options[:invoice_item_ids] || []
32
+ result = Pike13::Desk::Payment.void(
33
+ payment_id: payment_id,
34
+ invoice_item_ids_to_cancel: invoice_item_ids_to_cancel
35
+ )
36
+ output(result)
37
+ success_message "Payment #{payment_id} voided successfully"
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end