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,98 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module CLI
5
+ module Commands
6
+ class Desk < Base
7
+ class Person < Base
8
+ desc "list", "List all people"
9
+ map "ls" => :list
10
+ format_options
11
+ def list
12
+ handle_error do
13
+ result = with_progress("Fetching people") do
14
+ Pike13::Desk::Person.all
15
+ end
16
+ output(result)
17
+ end
18
+ end
19
+
20
+ desc "get ID", "Get a person by ID"
21
+ format_options
22
+ def get(id)
23
+ handle_error do
24
+ result = Pike13::Desk::Person.find(id)
25
+ output(result)
26
+ end
27
+ end
28
+
29
+ desc "search QUERY", "Search for people"
30
+ format_options
31
+ option :fields, type: :string, desc: "Fields to search in"
32
+ def search(query)
33
+ handle_error do
34
+ result = Pike13::Desk::Person.search(query, fields: options[:fields])
35
+ output(result)
36
+ end
37
+ end
38
+
39
+ desc "me", "Get current authenticated user"
40
+ format_options
41
+ def me
42
+ handle_error do
43
+ result = Pike13::Desk::Person.me
44
+ output(result)
45
+ end
46
+ end
47
+
48
+ desc "create", "Create a new person"
49
+ format_options
50
+ option :first_name, type: :string, required: true
51
+ option :last_name, type: :string, required: true
52
+ option :email, type: :string, required: true
53
+ option :phone, type: :string
54
+ def create
55
+ handle_error do
56
+ attributes = {
57
+ first_name: options[:first_name],
58
+ last_name: options[:last_name],
59
+ email: options[:email]
60
+ }
61
+ attributes[:phone] = options[:phone] if options[:phone]
62
+
63
+ result = Pike13::Desk::Person.create(attributes)
64
+ output(result)
65
+ end
66
+ end
67
+
68
+ desc "update ID", "Update a person"
69
+ format_options
70
+ option :first_name, type: :string
71
+ option :last_name, type: :string
72
+ option :email, type: :string
73
+ option :phone, type: :string
74
+ def update(id)
75
+ handle_error do
76
+ attributes = {}
77
+ attributes[:first_name] = options[:first_name] if options[:first_name]
78
+ attributes[:last_name] = options[:last_name] if options[:last_name]
79
+ attributes[:email] = options[:email] if options[:email]
80
+ attributes[:phone] = options[:phone] if options[:phone]
81
+
82
+ result = Pike13::Desk::Person.update(id, attributes)
83
+ output(result)
84
+ end
85
+ end
86
+
87
+ desc "delete ID", "Delete a person"
88
+ def delete(id)
89
+ handle_error do
90
+ Pike13::Desk::Person.destroy(id)
91
+ success_message "Person #{id} deleted successfully"
92
+ end
93
+ end
94
+ end
95
+ end
96
+ end
97
+ end
98
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module CLI
5
+ module Commands
6
+ class Desk < Base
7
+ class PersonPlan < Base
8
+ # Override base_usage to match the actual subcommand registration
9
+ def self.base_usage
10
+ "desk person_plans"
11
+ end
12
+ desc "list PERSON_ID", "List plans for a person"
13
+ map "ls" => :list
14
+ format_options
15
+ def list(person_id)
16
+ handle_error do
17
+ result = with_progress("Fetching person plans") do
18
+ Pike13::Desk::PersonPlan.all(person_id: person_id)
19
+ end
20
+ output(result)
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module CLI
5
+ module Commands
6
+ class Desk < Base
7
+ class PersonVisit < Base
8
+ # Override base_usage to match the actual subcommand registration
9
+ def self.base_usage
10
+ "desk person_visits"
11
+ end
12
+ desc "list PERSON_ID", "List visits for a person"
13
+ map "ls" => :list
14
+ format_options
15
+ def list(person_id)
16
+ handle_error do
17
+ result = with_progress("Fetching person visits") do
18
+ Pike13::Desk::PersonVisit.all(person_id: person_id)
19
+ end
20
+ output(result)
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module CLI
5
+ module Commands
6
+ class Desk < Base
7
+ class PersonWaitlistEntry < Base
8
+ # Override base_usage to match the actual subcommand registration
9
+ def self.base_usage
10
+ "desk person_waitlist"
11
+ end
12
+ desc "list PERSON_ID", "List waitlist entries for a person"
13
+ map "ls" => :list
14
+ format_options
15
+ def list(person_id)
16
+ handle_error do
17
+ result = with_progress("Fetching person waitlist entries") do
18
+ Pike13::Desk::PersonWaitlistEntry.all(person_id: person_id)
19
+ end
20
+ output(result)
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module CLI
5
+ module Commands
6
+ class Desk < Base
7
+ class PersonWaiver < Base
8
+ # Override base_usage to match the actual subcommand registration
9
+ def self.base_usage
10
+ "desk person_waivers"
11
+ end
12
+ desc "list PERSON_ID", "List waivers for a person"
13
+ map "ls" => :list
14
+ format_options
15
+ def list(person_id)
16
+ handle_error do
17
+ result = with_progress("Fetching person waivers") do
18
+ Pike13::Desk::PersonWaiver.all(person_id: person_id)
19
+ end
20
+ output(result)
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ 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 Plan < Base
8
+ desc "list", "List all plans"
9
+ map "ls" => :list
10
+ format_options
11
+ def list
12
+ handle_error do
13
+ result = with_progress("Fetching plans") do
14
+ Pike13::Desk::Plan.all
15
+ end
16
+ output(result)
17
+ end
18
+ end
19
+
20
+ desc "get ID", "Get a plan by ID"
21
+ format_options
22
+ def get(id)
23
+ handle_error { output(Pike13::Desk::Plan.find(id)) }
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module CLI
5
+ module Commands
6
+ class Desk < Base
7
+ class PlanProduct < Base
8
+ # Override base_usage to match the actual subcommand registration
9
+ def self.base_usage
10
+ "desk plan_products"
11
+ end
12
+ desc "list", "List all plan products"
13
+ format_options
14
+ def list
15
+ handle_error do
16
+ result = with_progress("Fetching plan products") do
17
+ Pike13::Desk::PlanProduct.all
18
+ end
19
+ output(result)
20
+ end
21
+ end
22
+
23
+ desc "get ID", "Get a plan product by ID"
24
+ format_options
25
+ def get(id)
26
+ handle_error do
27
+ result = Pike13::Desk::PlanProduct.find(id)
28
+ output(result)
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ 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 Punch < Base
8
+ desc "get ID", "Get a punch by ID"
9
+ format_options
10
+ def get(id)
11
+ handle_error do
12
+ result = Pike13::Desk::Punch.find(id)
13
+ output(result)
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module CLI
5
+ module Commands
6
+ class Desk < Base
7
+ class Refund < Base
8
+ desc "get ID", "Get a refund by ID"
9
+ format_options
10
+ def get(id)
11
+ handle_error do
12
+ result = Pike13::Desk::Refund.find(id)
13
+ output(result)
14
+ end
15
+ end
16
+
17
+ desc "void ID", "Void a refund"
18
+ format_options
19
+ def void(id)
20
+ handle_error do
21
+ result = with_progress("Voiding refund") do
22
+ Pike13::Desk::Refund.void(refund_id: id)
23
+ end
24
+ output(result)
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module CLI
5
+ module Commands
6
+ class Desk < Base
7
+ class RevenueCategory < Base
8
+ # Override base_usage to match the actual subcommand registration
9
+ def self.base_usage
10
+ "desk revenue_categories"
11
+ end
12
+ desc "list", "List all revenue categories"
13
+ map "ls" => :list
14
+ format_options
15
+ def list
16
+ handle_error do
17
+ result = with_progress("Fetching revenue categories") do
18
+ Pike13::Desk::RevenueCategory.all
19
+ end
20
+ output(result)
21
+ end
22
+ end
23
+
24
+ desc "get ID", "Get a revenue category by ID"
25
+ format_options
26
+ def get(id)
27
+ handle_error do
28
+ result = Pike13::Desk::RevenueCategory.find(id)
29
+ output(result)
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module CLI
5
+ module Commands
6
+ class Desk < Base
7
+ class SalesTax < Base
8
+ # Override base_usage to match the actual subcommand registration
9
+ def self.base_usage
10
+ "desk sales_taxes"
11
+ end
12
+ desc "list", "List all sales taxes"
13
+ map "ls" => :list
14
+ format_options
15
+ def list
16
+ handle_error do
17
+ result = with_progress("Fetching sales taxes") do
18
+ Pike13::Desk::SalesTax.all
19
+ end
20
+ output(result)
21
+ end
22
+ end
23
+
24
+ desc "get ID", "Get a sales tax by ID"
25
+ format_options
26
+ def get(id)
27
+ handle_error do
28
+ result = Pike13::Desk::SalesTax.find(id)
29
+ output(result)
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ 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 Service < Base
8
+ desc "list", "List all services"
9
+ map "ls" => :list
10
+ format_options
11
+ def list
12
+ handle_error do
13
+ result = with_progress("Fetching services") do
14
+ Pike13::Desk::Service.all
15
+ end
16
+ output(result)
17
+ end
18
+ end
19
+
20
+ desc "get ID", "Get a service by ID"
21
+ format_options
22
+ def get(id)
23
+ handle_error { output(Pike13::Desk::Service.find(id)) }
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module CLI
5
+ module Commands
6
+ class Desk < Base
7
+ class StaffMember < Base
8
+ desc "list", "List all staff"
9
+ map "ls" => :list
10
+ format_options
11
+ def list
12
+ handle_error do
13
+ result = with_progress("Fetching staff") do
14
+ Pike13::Desk::StaffMember.all
15
+ end
16
+ output(result)
17
+ end
18
+ end
19
+
20
+ desc "get ID", "Get a staff member by ID"
21
+ format_options
22
+ def get(id)
23
+ handle_error { output(Pike13::Desk::StaffMember.find(id)) }
24
+ end
25
+
26
+ desc "me", "Get current staff user"
27
+ format_options
28
+ def me
29
+ handle_error { output(Pike13::Desk::StaffMember.me) }
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module CLI
5
+ module Commands
6
+ class Desk < Base
7
+ class Visit < Base
8
+ desc "list", "List all visits"
9
+ map "ls" => :list
10
+ format_options
11
+ def list
12
+ handle_error do
13
+ result = with_progress("Fetching visits") do
14
+ Pike13::Desk::Visit.all
15
+ end
16
+ output(result)
17
+ end
18
+ end
19
+
20
+ desc "get ID", "Get a visit by ID"
21
+ format_options
22
+ def get(id)
23
+ handle_error { output(Pike13::Desk::Visit.find(id)) }
24
+ end
25
+
26
+ desc "summary", "Get visit summary for a person"
27
+ format_options
28
+ option :person_id, type: :numeric, required: true
29
+ def summary
30
+ handle_error { output(Pike13::Desk::Visit.summary(person_id: options[:person_id])) }
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,69 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pike13
4
+ module CLI
5
+ module Commands
6
+ class Desk < Base
7
+ class WaitlistEntry < Base
8
+ desc "list", "List waitlist entries"
9
+ map "ls" => :list
10
+ format_options
11
+ def list
12
+ handle_error do
13
+ result = with_progress("Fetching waitlist entries") do
14
+ Pike13::Desk::WaitlistEntry.all
15
+ end
16
+ output(result)
17
+ end
18
+ end
19
+
20
+ desc "get ID", "Get a waitlist entry by ID"
21
+ format_options
22
+ def get(id)
23
+ handle_error do
24
+ result = Pike13::Desk::WaitlistEntry.find(id)
25
+ output(result)
26
+ end
27
+ end
28
+
29
+ desc "create", "Create a waitlist entry"
30
+ format_options
31
+ option :person_id, type: :numeric, required: true, desc: "Person ID"
32
+ option :event_id, type: :numeric, required: true, desc: "Event ID"
33
+ def create
34
+ handle_error do
35
+ attributes = {
36
+ person_id: options[:person_id],
37
+ event_id: options[:event_id]
38
+ }
39
+ result = Pike13::Desk::WaitlistEntry.create(attributes)
40
+ output(result)
41
+ success_message "Waitlist entry created successfully"
42
+ end
43
+ end
44
+
45
+ desc "update ID", "Update a waitlist entry"
46
+ format_options
47
+ option :state, type: :string, desc: "Waitlist entry state"
48
+ def update(id)
49
+ handle_error do
50
+ attributes = {}
51
+ attributes[:state] = options[:state] if options[:state]
52
+ result = Pike13::Desk::WaitlistEntry.update(id, attributes)
53
+ output(result)
54
+ success_message "Waitlist entry updated successfully"
55
+ end
56
+ end
57
+
58
+ desc "delete ID", "Delete a waitlist entry"
59
+ def delete(id)
60
+ handle_error do
61
+ Pike13::Desk::WaitlistEntry.destroy(id)
62
+ success_message "Waitlist entry #{id} deleted successfully"
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end