Class: Pike13::API::V3::Desk::EventOccurrences

Inherits:
Base
  • Object
show all
Defined in:
lib/pike13/api/v3/desk/event_occurrences.rb

Overview

Event Occurrences resource Data about scheduled instances of services (e.g., “Group Workout from 9am-10am on 2024/09/01”)

Examples:

Basic query

Pike13::Reporting::EventOccurrences.query(
  fields: ['event_occurrence_id', 'event_name', 'service_date', 'enrollment_count', 'capacity']
)

Query high attendance classes

Pike13::Reporting::EventOccurrences.query(
  fields: ['event_name', 'service_date', 'completed_enrollment_count', 'capacity'],
  filter: ['gt', 'completed_enrollment_count', 15],
  sort: ['completed_enrollment_count-']
)

Group by service name

Pike13::Reporting::EventOccurrences.query(
  fields: ['total_enrollment_count', 'total_completed_enrollment_count', 'total_noshowed_enrollment_count'],
  group: 'service_name'
)

Constant Summary collapse

DETAIL_FIELDS =

Available detail fields (when not grouping)

%w[
  attendance_completed
  business_id
  business_name
  business_subdomain
  capacity
  completed_enrollment_count
  completed_unpaid_count
  currency_code
  duration_in_hours
  duration_in_minutes
  end_at
  enrollment_count
  event_id
  event_name
  event_occurrence_id
  expired_enrollment_count
  franchise_id
  instructor_names
  is_waitlist_count
  key
  late_canceled_enrollment_count
  noshowed_enrollment_count
  paid_count
  registered_enrollment_count
  removed_enrollment_count
  reserved_enrollment_count
  service_category
  service_date
  service_day
  service_id
  service_location_id
  service_location_name
  service_name
  service_state
  service_time
  service_type
  start_at
  visit_count
  waiting_enrollment_count
  waitlist_to_visit_count
].freeze
SUMMARY_FIELDS =

Available summary fields (when grouping)

%w[
  attendance_completed_count
  business_id_summary
  business_subdomain_summary
  event_count
  event_occurrence_count
  service_count
  total_capacity
  total_completed_enrollment_count
  total_completed_unpaid_count
  total_count
  total_duration_in_hours
  total_duration_in_minutes
  total_enrollment_count
  total_expired_enrollment_count
  total_is_waitlist_count
  total_late_canceled_enrollment_count
  total_noshowed_enrollment_count
  total_paid_count
  total_registered_enrollment_count
  total_removed_enrollment_count
  total_reserved_enrollment_count
  total_visit_count
  total_waiting_enrollment_count
  total_waitlist_to_visit_count
].freeze
GROUPINGS =

Available grouping fields

%w[
  attendance_completed
  business_id
  business_name
  business_subdomain
  event_id
  event_name
  event_occurrence_id
  instructor_names
  service_category
  service_date
  service_day
  service_id
  service_location_id
  service_location_name
  service_month_start_date
  service_name
  service_quarter_start_date
  service_state
  service_time
  service_type
  service_week_mon_start_date
  service_week_sun_start_date
  service_year_start_date
].freeze

Class Method Summary collapse

Methods inherited from Base

client, configure

Class Method Details

.query(fields:, filter: nil, group: nil, sort: nil, page: nil, total_count: nil) ⇒ Hash

Execute an event occurrences query

Parameters:

  • fields (Array<String>)

    Fields to return (detail or summary fields)

  • filter (Array, nil) (defaults to: nil)

    Filter criteria (optional)

  • group (String, nil) (defaults to: nil)

    Grouping field (optional)

  • sort (Array<String>, nil) (defaults to: nil)

    Sort order (optional)

  • page (Hash, nil) (defaults to: nil)

    Pagination options (optional)

  • total_count (Boolean) (defaults to: nil)

    Whether to return total count (optional)

Returns:

  • (Hash)

    Query result with rows, fields, and metadata

See Also:



40
41
42
43
44
45
46
47
48
49
# File 'lib/pike13/api/v3/desk/event_occurrences.rb', line 40

def query(fields:, filter: nil, group: nil, sort: nil, page: nil, total_count: nil)
  query_params = { fields: fields }
  query_params[:filter] = filter if filter
  query_params[:group] = group if group
  query_params[:sort] = sort if sort
  query_params[:page] = page if page
  query_params[:total_count] = total_count if total_count

  super("event_occurrences", query_params)
end