pike13 0.1.0.beta → 0.1.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +67 -116
- data/README.md +1222 -315
- data/lib/pike13/api/v2/account.rb +19 -0
- data/lib/pike13/api/v2/desk/booking.rb +10 -0
- data/lib/pike13/api/v2/desk/business.rb +2 -1
- data/lib/pike13/api/v2/desk/event_occurrence.rb +2 -2
- data/lib/pike13/api/v2/desk/person.rb +5 -3
- data/lib/pike13/api/v2/desk/plan.rb +2 -2
- data/lib/pike13/api/v2/desk/plan_product.rb +2 -2
- data/lib/pike13/api/v2/desk/service.rb +2 -2
- data/lib/pike13/api/v2/desk/visit.rb +2 -2
- data/lib/pike13/api/v2/front/branding.rb +2 -1
- data/lib/pike13/api/v2/front/business.rb +2 -1
- data/lib/pike13/api/v2/front/event_occurrence.rb +2 -2
- data/lib/pike13/api/v2/front/plan_product.rb +2 -2
- data/lib/pike13/api/v2/front/service.rb +2 -2
- data/lib/pike13/api/v2/front/visit.rb +2 -2
- data/lib/pike13/api/v3/desk/base.rb +46 -0
- data/lib/pike13/api/v3/desk/clients.rb +180 -0
- data/lib/pike13/api/v3/desk/enrollments.rb +203 -0
- data/lib/pike13/api/v3/desk/event_occurrence_staff_members.rb +170 -0
- data/lib/pike13/api/v3/desk/event_occurrences.rb +154 -0
- data/lib/pike13/api/v3/desk/invoice_item_transactions.rb +189 -0
- data/lib/pike13/api/v3/desk/invoice_items.rb +193 -0
- data/lib/pike13/api/v3/desk/invoices.rb +167 -0
- data/lib/pike13/api/v3/desk/monthly_business_metrics.rb +151 -0
- data/lib/pike13/api/v3/desk/pays.rb +128 -0
- data/lib/pike13/api/v3/desk/person_plans.rb +265 -0
- data/lib/pike13/api/v3/desk/staff_members.rb +127 -0
- data/lib/pike13/api/v3/desk/transactions.rb +169 -0
- data/lib/pike13/http_client.rb +4 -1
- data/lib/pike13/http_client_v3.rb +101 -0
- data/lib/pike13/validators.rb +136 -0
- data/lib/pike13/version.rb +1 -1
- data/lib/pike13.rb +26 -7
- metadata +17 -2
- data/lib/pike13/api/v2/account/me.rb +0 -20
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pike13
|
|
4
|
+
module API
|
|
5
|
+
module V3
|
|
6
|
+
module Desk
|
|
7
|
+
# Invoices resource
|
|
8
|
+
# Details of invoices, their status, revenue, and payment information
|
|
9
|
+
#
|
|
10
|
+
# @example Basic query
|
|
11
|
+
# Pike13::Reporting::Invoices.query(
|
|
12
|
+
# fields: ['invoice_id', 'invoice_number', 'expected_amount', 'outstanding_amount']
|
|
13
|
+
# )
|
|
14
|
+
#
|
|
15
|
+
# @example Query unpaid invoices
|
|
16
|
+
# Pike13::Reporting::Invoices.query(
|
|
17
|
+
# fields: ['invoice_number', 'invoice_payer_name', 'outstanding_amount', 'invoice_due_date'],
|
|
18
|
+
# filter: ['gt', 'outstanding_amount', 0]
|
|
19
|
+
# )
|
|
20
|
+
#
|
|
21
|
+
# @example Group by invoice state
|
|
22
|
+
# Pike13::Reporting::Invoices.query(
|
|
23
|
+
# fields: ['invoice_count', 'total_expected_amount', 'total_outstanding_amount'],
|
|
24
|
+
# group: 'invoice_state'
|
|
25
|
+
# )
|
|
26
|
+
class Invoices < Base
|
|
27
|
+
class << self
|
|
28
|
+
# Execute an invoices query
|
|
29
|
+
#
|
|
30
|
+
# @param fields [Array<String>] Fields to return (detail or summary fields)
|
|
31
|
+
# @param filter [Array, nil] Filter criteria (optional)
|
|
32
|
+
# @param group [String, nil] Grouping field (optional)
|
|
33
|
+
# @param sort [Array<String>, nil] Sort order (optional)
|
|
34
|
+
# @param page [Hash, nil] Pagination options (optional)
|
|
35
|
+
# @param total_count [Boolean] Whether to return total count (optional)
|
|
36
|
+
# @return [Hash] Query result with rows, fields, and metadata
|
|
37
|
+
#
|
|
38
|
+
# @see https://developer.pike13.com/docs/api/v3/reports/invoices
|
|
39
|
+
def query(fields:, filter: nil, group: nil, sort: nil, page: nil, total_count: nil)
|
|
40
|
+
query_params = { fields: fields }
|
|
41
|
+
query_params[:filter] = filter if filter
|
|
42
|
+
query_params[:group] = group if group
|
|
43
|
+
query_params[:sort] = sort if sort
|
|
44
|
+
query_params[:page] = page if page
|
|
45
|
+
query_params[:total_count] = total_count if total_count
|
|
46
|
+
|
|
47
|
+
super("invoices", query_params)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Available detail fields (when not grouping)
|
|
51
|
+
DETAIL_FIELDS = %w[
|
|
52
|
+
adjustments_amount
|
|
53
|
+
business_id
|
|
54
|
+
business_name
|
|
55
|
+
business_subdomain
|
|
56
|
+
closed_at
|
|
57
|
+
closed_date
|
|
58
|
+
commission_recipient_name
|
|
59
|
+
coupons_amount
|
|
60
|
+
created_by_client
|
|
61
|
+
created_by_name
|
|
62
|
+
currency_code
|
|
63
|
+
days_since_invoice_due
|
|
64
|
+
discounts_amount
|
|
65
|
+
expected_amount
|
|
66
|
+
expected_revenue_amount
|
|
67
|
+
expected_tax_amount
|
|
68
|
+
failed_transactions
|
|
69
|
+
franchise_id
|
|
70
|
+
gross_amount
|
|
71
|
+
invoice_autobill
|
|
72
|
+
invoice_due_date
|
|
73
|
+
invoice_id
|
|
74
|
+
invoice_number
|
|
75
|
+
invoice_payer_email
|
|
76
|
+
invoice_payer_home_location
|
|
77
|
+
invoice_payer_id
|
|
78
|
+
invoice_payer_name
|
|
79
|
+
invoice_payer_phone
|
|
80
|
+
invoice_payer_primary_staff_name_at_sale
|
|
81
|
+
invoice_state
|
|
82
|
+
issued_at
|
|
83
|
+
issued_date
|
|
84
|
+
key
|
|
85
|
+
net_paid_amount
|
|
86
|
+
net_paid_revenue_amount
|
|
87
|
+
net_paid_tax_amount
|
|
88
|
+
outstanding_amount
|
|
89
|
+
outstanding_revenue_amount
|
|
90
|
+
outstanding_tax_amount
|
|
91
|
+
payments_amount
|
|
92
|
+
purchase_order_number
|
|
93
|
+
purchase_request_cancel_reason
|
|
94
|
+
purchase_request_message
|
|
95
|
+
purchase_request_state
|
|
96
|
+
refunded_transactions
|
|
97
|
+
refunds_amount
|
|
98
|
+
sale_location_name
|
|
99
|
+
voided_transactions
|
|
100
|
+
].freeze
|
|
101
|
+
|
|
102
|
+
# Available summary fields (when grouping)
|
|
103
|
+
SUMMARY_FIELDS = %w[
|
|
104
|
+
business_id_summary
|
|
105
|
+
business_subdomain_summary
|
|
106
|
+
created_by_client_count
|
|
107
|
+
invoice_autobill_count
|
|
108
|
+
invoice_count
|
|
109
|
+
total_adjustments_amount
|
|
110
|
+
total_count
|
|
111
|
+
total_coupons_amount
|
|
112
|
+
total_discounts_amount
|
|
113
|
+
total_expected_amount
|
|
114
|
+
total_expected_revenue_amount
|
|
115
|
+
total_expected_tax_amount
|
|
116
|
+
total_gross_amount
|
|
117
|
+
total_net_paid_amount
|
|
118
|
+
total_net_paid_revenue_amount
|
|
119
|
+
total_net_paid_tax_amount
|
|
120
|
+
total_outstanding_amount
|
|
121
|
+
total_outstanding_revenue_amount
|
|
122
|
+
total_outstanding_tax_amount
|
|
123
|
+
total_payments_amount
|
|
124
|
+
total_refunds_amount
|
|
125
|
+
].freeze
|
|
126
|
+
|
|
127
|
+
# Available grouping fields
|
|
128
|
+
GROUPINGS = %w[
|
|
129
|
+
business_id
|
|
130
|
+
business_name
|
|
131
|
+
business_subdomain
|
|
132
|
+
closed_date
|
|
133
|
+
closed_month_start_date
|
|
134
|
+
closed_quarter_start_date
|
|
135
|
+
closed_week_mon_start_date
|
|
136
|
+
closed_week_sun_start_date
|
|
137
|
+
closed_year_start_date
|
|
138
|
+
commission_recipient_name
|
|
139
|
+
created_by_client
|
|
140
|
+
created_by_name
|
|
141
|
+
due_month_start_date
|
|
142
|
+
due_quarter_start_date
|
|
143
|
+
due_week_mon_start_date
|
|
144
|
+
due_week_sun_start_date
|
|
145
|
+
due_year_start_date
|
|
146
|
+
invoice_autobill
|
|
147
|
+
invoice_due_date
|
|
148
|
+
invoice_payer_home_location
|
|
149
|
+
invoice_payer_id
|
|
150
|
+
invoice_payer_name
|
|
151
|
+
invoice_payer_primary_staff_name_at_sale
|
|
152
|
+
invoice_state
|
|
153
|
+
issued_date
|
|
154
|
+
issued_month_start_date
|
|
155
|
+
issued_quarter_start_date
|
|
156
|
+
issued_week_mon_start_date
|
|
157
|
+
issued_week_sun_start_date
|
|
158
|
+
issued_year_start_date
|
|
159
|
+
purchase_request_state
|
|
160
|
+
sale_location_name
|
|
161
|
+
].freeze
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
end
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pike13
|
|
4
|
+
module API
|
|
5
|
+
module V3
|
|
6
|
+
module Desk
|
|
7
|
+
# Monthly Business Metrics resource
|
|
8
|
+
# Summary of monthly transaction amounts, members, and enrollments
|
|
9
|
+
#
|
|
10
|
+
# @example Basic query
|
|
11
|
+
# Pike13::Reporting::MonthlyBusinessMetrics.query(
|
|
12
|
+
# fields: ['month_start_date', 'net_paid_amount', 'new_client_count']
|
|
13
|
+
# )
|
|
14
|
+
#
|
|
15
|
+
# @example Query with filters and sorting
|
|
16
|
+
# Pike13::Reporting::MonthlyBusinessMetrics.query(
|
|
17
|
+
# fields: ['month_start_date', 'net_paid_amount', 'member_count'],
|
|
18
|
+
# filter: ['btw', 'month_start_date', '2024-01-01', '2024-12-31'],
|
|
19
|
+
# sort: ['month_start_date-']
|
|
20
|
+
# )
|
|
21
|
+
#
|
|
22
|
+
# @example Query with grouping
|
|
23
|
+
# Pike13::Reporting::MonthlyBusinessMetrics.query(
|
|
24
|
+
# fields: ['total_net_paid_amount', 'total_new_client_count'],
|
|
25
|
+
# group: 'year_start_date'
|
|
26
|
+
# )
|
|
27
|
+
#
|
|
28
|
+
# @example Query with pagination
|
|
29
|
+
# Pike13::Reporting::MonthlyBusinessMetrics.query(
|
|
30
|
+
# fields: ['month_start_date', 'net_paid_amount'],
|
|
31
|
+
# page: { limit: 50, starting_after: 'abc123' }
|
|
32
|
+
# )
|
|
33
|
+
class MonthlyBusinessMetrics < Base
|
|
34
|
+
class << self
|
|
35
|
+
# Execute a monthly business metrics query
|
|
36
|
+
#
|
|
37
|
+
# @param fields [Array<String>] Fields to return (detail or summary fields)
|
|
38
|
+
# @param filter [Array, nil] Filter criteria (optional)
|
|
39
|
+
# @param group [String, nil] Grouping field (optional)
|
|
40
|
+
# @param sort [Array<String>, nil] Sort order (optional)
|
|
41
|
+
# @param page [Hash, nil] Pagination options (optional)
|
|
42
|
+
# @param total_count [Boolean] Whether to return total count (optional)
|
|
43
|
+
# @return [Hash] Query result with rows, fields, and metadata
|
|
44
|
+
#
|
|
45
|
+
# @see https://developer.pike13.com/docs/api/v3/reports/monthly-business-metrics
|
|
46
|
+
def query(fields:, filter: nil, group: nil, sort: nil, page: nil, total_count: nil)
|
|
47
|
+
query_params = { fields: fields }
|
|
48
|
+
query_params[:filter] = filter if filter
|
|
49
|
+
query_params[:group] = group if group
|
|
50
|
+
query_params[:sort] = sort if sort
|
|
51
|
+
query_params[:page] = page if page
|
|
52
|
+
query_params[:total_count] = total_count if total_count
|
|
53
|
+
|
|
54
|
+
super("monthly_business_metrics", query_params)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Available detail fields (when not grouping)
|
|
58
|
+
DETAIL_FIELDS = %w[
|
|
59
|
+
appointment_count
|
|
60
|
+
attendance_completed_count
|
|
61
|
+
business_id
|
|
62
|
+
business_name
|
|
63
|
+
business_subdomain
|
|
64
|
+
class_count
|
|
65
|
+
client_booked_count
|
|
66
|
+
client_completed_enrollment_count
|
|
67
|
+
client_w_plan_count
|
|
68
|
+
completed_appointment_enrollment_count
|
|
69
|
+
completed_class_enrollment_count
|
|
70
|
+
completed_course_enrollment_count
|
|
71
|
+
completed_enrollment_count
|
|
72
|
+
completed_enrollment_per_client
|
|
73
|
+
completed_unpaid_count
|
|
74
|
+
course_count
|
|
75
|
+
currency_code
|
|
76
|
+
due_invoice_count
|
|
77
|
+
enrollment_count
|
|
78
|
+
event_occurrence_count
|
|
79
|
+
event_occurrence_organizer_count
|
|
80
|
+
expected_amount
|
|
81
|
+
expired_enrollment_count
|
|
82
|
+
failed_transaction_count
|
|
83
|
+
first_visit_count
|
|
84
|
+
franchise_id
|
|
85
|
+
key
|
|
86
|
+
late_canceled_enrollment_count
|
|
87
|
+
member_count
|
|
88
|
+
membership_count
|
|
89
|
+
month_start_date
|
|
90
|
+
net_paid_amount
|
|
91
|
+
net_paid_pass_revenue_amount
|
|
92
|
+
net_paid_prepaid_revenue_amount
|
|
93
|
+
net_paid_recurring_revenue_amount
|
|
94
|
+
net_paid_retail_revenue_amount
|
|
95
|
+
net_paid_revenue_amount
|
|
96
|
+
new_client_count
|
|
97
|
+
new_client_w_plan_count
|
|
98
|
+
new_member_count
|
|
99
|
+
new_staff_count
|
|
100
|
+
noshowed_enrollment_count
|
|
101
|
+
outstanding_amount
|
|
102
|
+
pack_count
|
|
103
|
+
payments_amount
|
|
104
|
+
plan_end_count
|
|
105
|
+
plan_start_count
|
|
106
|
+
prepaid_count
|
|
107
|
+
refunds_amount
|
|
108
|
+
registered_enrollment_count
|
|
109
|
+
removed_enrollment_count
|
|
110
|
+
reserved_enrollment_count
|
|
111
|
+
waiting_enrollment_count
|
|
112
|
+
].freeze
|
|
113
|
+
|
|
114
|
+
# Available summary fields (when grouping)
|
|
115
|
+
SUMMARY_FIELDS = %w[
|
|
116
|
+
avg_client_completed_enrollment_count
|
|
117
|
+
avg_client_w_plan_count
|
|
118
|
+
avg_member_count
|
|
119
|
+
business_id_summary
|
|
120
|
+
business_subdomain_summary
|
|
121
|
+
monthly_business_count
|
|
122
|
+
total_attendance_completed_count
|
|
123
|
+
total_completed_enrollment_count
|
|
124
|
+
total_count
|
|
125
|
+
total_enrollment_count
|
|
126
|
+
total_event_occurrence_count
|
|
127
|
+
total_first_visit_count
|
|
128
|
+
total_net_paid_amount
|
|
129
|
+
total_net_paid_revenue_amount
|
|
130
|
+
total_new_client_count
|
|
131
|
+
total_new_client_w_plan_count
|
|
132
|
+
total_new_member_count
|
|
133
|
+
total_payments_amount
|
|
134
|
+
total_refunds_amount
|
|
135
|
+
].freeze
|
|
136
|
+
|
|
137
|
+
# Available grouping fields
|
|
138
|
+
GROUPINGS = %w[
|
|
139
|
+
business_id
|
|
140
|
+
business_name
|
|
141
|
+
business_subdomain
|
|
142
|
+
currency_code
|
|
143
|
+
quarter_start_date
|
|
144
|
+
year_start_date
|
|
145
|
+
].freeze
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
end
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pike13
|
|
4
|
+
module API
|
|
5
|
+
module V3
|
|
6
|
+
module Desk
|
|
7
|
+
# Pays resource
|
|
8
|
+
# Details of staff member pay, pay rates, services, and hours
|
|
9
|
+
#
|
|
10
|
+
# @example Basic query
|
|
11
|
+
# Pike13::Reporting::Pays.query(
|
|
12
|
+
# fields: ['pay_id', 'staff_name', 'pay_type', 'final_pay_amount', 'pay_state']
|
|
13
|
+
# )
|
|
14
|
+
#
|
|
15
|
+
# @example Query by staff member
|
|
16
|
+
# Pike13::Reporting::Pays.query(
|
|
17
|
+
# fields: ['staff_name', 'service_name', 'service_date', 'final_pay_amount', 'service_hours'],
|
|
18
|
+
# filter: ['eq', 'staff_id', 12345]
|
|
19
|
+
# )
|
|
20
|
+
#
|
|
21
|
+
# @example Group by staff member
|
|
22
|
+
# Pike13::Reporting::Pays.query(
|
|
23
|
+
# fields: ['pay_count', 'total_final_pay_amount', 'total_service_hours'],
|
|
24
|
+
# group: 'staff_name'
|
|
25
|
+
# )
|
|
26
|
+
class Pays < Base
|
|
27
|
+
class << self
|
|
28
|
+
# Execute a pays query
|
|
29
|
+
#
|
|
30
|
+
# @param fields [Array<String>] Fields to return (detail or summary fields)
|
|
31
|
+
# @param filter [Array, nil] Filter criteria (optional)
|
|
32
|
+
# @param group [String, nil] Grouping field (optional)
|
|
33
|
+
# @param sort [Array<String>, nil] Sort order (optional)
|
|
34
|
+
# @param page [Hash, nil] Pagination options (optional)
|
|
35
|
+
# @param total_count [Boolean] Whether to return total count (optional)
|
|
36
|
+
# @return [Hash] Query result with rows, fields, and metadata
|
|
37
|
+
#
|
|
38
|
+
# @see https://developer.pike13.com/docs/api/v3/reports/pays
|
|
39
|
+
def query(fields:, filter: nil, group: nil, sort: nil, page: nil, total_count: nil)
|
|
40
|
+
query_params = { fields: fields }
|
|
41
|
+
query_params[:filter] = filter if filter
|
|
42
|
+
query_params[:group] = group if group
|
|
43
|
+
query_params[:sort] = sort if sort
|
|
44
|
+
query_params[:page] = page if page
|
|
45
|
+
query_params[:total_count] = total_count if total_count
|
|
46
|
+
|
|
47
|
+
super("pays", query_params)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Available detail fields (when not grouping)
|
|
51
|
+
DETAIL_FIELDS = %w[
|
|
52
|
+
base_pay_amount
|
|
53
|
+
business_id
|
|
54
|
+
business_name
|
|
55
|
+
business_subdomain
|
|
56
|
+
currency_code
|
|
57
|
+
final_pay_amount
|
|
58
|
+
franchise_id
|
|
59
|
+
key
|
|
60
|
+
pay_description
|
|
61
|
+
pay_id
|
|
62
|
+
pay_period
|
|
63
|
+
pay_period_end_date
|
|
64
|
+
pay_period_start_date
|
|
65
|
+
pay_recorded_at
|
|
66
|
+
pay_reviewed_at
|
|
67
|
+
pay_reviewed_by_id
|
|
68
|
+
pay_reviewed_by_name
|
|
69
|
+
pay_reviewed_date
|
|
70
|
+
pay_state
|
|
71
|
+
pay_type
|
|
72
|
+
per_head_pay_amount
|
|
73
|
+
revenue_category
|
|
74
|
+
service_category
|
|
75
|
+
service_date
|
|
76
|
+
service_hours
|
|
77
|
+
service_id
|
|
78
|
+
service_location_name
|
|
79
|
+
service_name
|
|
80
|
+
service_type
|
|
81
|
+
staff_home_location_name
|
|
82
|
+
staff_id
|
|
83
|
+
staff_name
|
|
84
|
+
tiered_pay_amount
|
|
85
|
+
].freeze
|
|
86
|
+
|
|
87
|
+
# Available summary fields (when grouping)
|
|
88
|
+
SUMMARY_FIELDS = %w[
|
|
89
|
+
business_id_summary
|
|
90
|
+
business_subdomain_summary
|
|
91
|
+
pay_count
|
|
92
|
+
service_count
|
|
93
|
+
total_base_pay_amount
|
|
94
|
+
total_count
|
|
95
|
+
total_final_pay_amount
|
|
96
|
+
total_per_head_pay_amount
|
|
97
|
+
total_service_hours
|
|
98
|
+
total_tiered_pay_amount
|
|
99
|
+
].freeze
|
|
100
|
+
|
|
101
|
+
# Available grouping fields
|
|
102
|
+
GROUPINGS = %w[
|
|
103
|
+
business_id
|
|
104
|
+
business_name
|
|
105
|
+
business_subdomain
|
|
106
|
+
pay_period
|
|
107
|
+
pay_reviewed_by_id
|
|
108
|
+
pay_reviewed_by_name
|
|
109
|
+
pay_reviewed_date
|
|
110
|
+
pay_state
|
|
111
|
+
pay_type
|
|
112
|
+
revenue_category
|
|
113
|
+
service_category
|
|
114
|
+
service_date
|
|
115
|
+
service_id
|
|
116
|
+
service_location_name
|
|
117
|
+
service_name
|
|
118
|
+
service_type
|
|
119
|
+
staff_home_location_name
|
|
120
|
+
staff_id
|
|
121
|
+
staff_name
|
|
122
|
+
].freeze
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
end
|