Class: Pike13::API::V3::Desk::StaffMembers

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

Overview

Staff Members resource All staff member data — from tenure and events to birthdays and custom fields

Examples:

Basic query

Pike13::Reporting::StaffMembers.query(
  fields: ['person_id', 'full_name', 'email', 'role', 'person_state']
)

Query active staff members

Pike13::Reporting::StaffMembers.query(
  fields: ['full_name', 'email', 'role', 'tenure', 'future_events'],
  filter: ['eq', 'person_state', 'active']
)

Group by role

Pike13::Reporting::StaffMembers.query(
  fields: ['person_count', 'total_future_events', 'total_past_events'],
  group: 'role'
)

Constant Summary collapse

DETAIL_FIELDS =

Available detail fields (when not grouping)

%w[
  address
  age
  also_client
  attendance_not_completed_events
  birthdate
  business_id
  business_name
  business_subdomain
  city
  country_code
  currency_code
  custom_fields
  days_until_birthday
  email
  first_name
  franchise_id
  full_name
  future_events
  home_location_id
  home_location_name
  key
  last_name
  middle_name
  past_events
  person_id
  person_state
  phone
  postal_code
  role
  show_to_clients
  staff_since_date
  state_code
  street_address
  street_address2
  tenure
  tenure_group
].freeze
SUMMARY_FIELDS =

Available summary fields (when grouping)

%w[
  also_client_count
  business_id_summary
  business_subdomain_summary
  demoted_staff_count
  person_count
  total_attendance_not_completed_events
  total_count
  total_future_events
  total_past_events
].freeze
GROUPINGS =

Available grouping fields

%w[
  age
  also_client
  business_id
  business_name
  business_subdomain
  home_location_name
  person_state
  role
  show_to_clients
  staff_since_date
  staff_since_month_start_date
  staff_since_quarter_start_date
  staff_since_week_mon_start_date
  staff_since_week_sun_start_date
  staff_since_year_start_date
  tenure_group
].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 a staff members 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:



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

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("staff_members", query_params)
end