Class: Pike13::API::V3::Desk::Pays

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

Overview

Pays resource Details of staff member pay, pay rates, services, and hours

Examples:

Basic query

Pike13::Reporting::Pays.query(
  fields: ['pay_id', 'staff_name', 'pay_type', 'final_pay_amount', 'pay_state']
)

Query by staff member

Pike13::Reporting::Pays.query(
  fields: ['staff_name', 'service_name', 'service_date', 'final_pay_amount', 'service_hours'],
  filter: ['eq', 'staff_id', 12345]
)

Group by staff member

Pike13::Reporting::Pays.query(
  fields: ['pay_count', 'total_final_pay_amount', 'total_service_hours'],
  group: 'staff_name'
)

Constant Summary collapse

DETAIL_FIELDS =

Available detail fields (when not grouping)

%w[
  base_pay_amount
  business_id
  business_name
  business_subdomain
  currency_code
  final_pay_amount
  franchise_id
  key
  pay_description
  pay_id
  pay_period
  pay_period_end_date
  pay_period_start_date
  pay_recorded_at
  pay_reviewed_at
  pay_reviewed_by_id
  pay_reviewed_by_name
  pay_reviewed_date
  pay_state
  pay_type
  per_head_pay_amount
  revenue_category
  service_category
  service_date
  service_hours
  service_id
  service_location_name
  service_name
  service_type
  staff_home_location_name
  staff_id
  staff_name
  tiered_pay_amount
].freeze
SUMMARY_FIELDS =

Available summary fields (when grouping)

%w[
  business_id_summary
  business_subdomain_summary
  pay_count
  service_count
  total_base_pay_amount
  total_count
  total_final_pay_amount
  total_per_head_pay_amount
  total_service_hours
  total_tiered_pay_amount
].freeze
GROUPINGS =

Available grouping fields

%w[
  business_id
  business_name
  business_subdomain
  pay_period
  pay_reviewed_by_id
  pay_reviewed_by_name
  pay_reviewed_date
  pay_state
  pay_type
  revenue_category
  service_category
  service_date
  service_id
  service_location_name
  service_name
  service_type
  staff_home_location_name
  staff_id
  staff_name
].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 pays 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/pays.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("pays", query_params)
end