Class: PapierkramApi::V1::BusinessIntelligence::ExpensesByCategory

Inherits:
Object
  • Object
show all
Defined in:
lib/papierkram_api/v1/business_intelligence/expenses_by_category.rb

Overview

Business Intelligence for Expenses

Instance Method Summary collapse

Instance Method Details

#call(expense_vouchers:, &block) ⇒ <Type>

Calculate the expenses by category

Parameters:

  • expense_vouchers (Array<Hash>)

    represents a list of expense vouchers in the format:

  • &block (<Type>)

    <description>

Returns:

  • (<Type>)

    <description>



17
18
19
20
21
22
23
24
# File 'lib/papierkram_api/v1/business_intelligence/expenses_by_category.rb', line 17

def call(expense_vouchers:, &block)
  return {} if expense_vouchers.is_a?(Array) && expense_vouchers.empty?

  validate_expense_vouchers!(expense_vouchers)
  return results(expense_vouchers, &block) if block

  results(expense_vouchers)
end