Class: MOCO::ReportsProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/moco/client.rb

Overview

Proxy for accessing report endpoints

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ ReportsProxy

Returns a new instance of ReportsProxy.



67
68
69
# File 'lib/moco/client.rb', line 67

def initialize(client)
  @client = client
end

Instance Method Details

#absences(year: nil, active: nil) ⇒ Object

Get absences report

Parameters:

  • year (Integer) (defaults to: nil)

    optional year filter

  • active (Boolean) (defaults to: nil)

    optional active status filter



74
75
76
77
78
79
# File 'lib/moco/client.rb', line 74

def absences(year: nil, active: nil)
  params = {}
  params[:year] = year if year
  params[:active] = active unless active.nil?
  @client.get("report/absences", params)
end

#cashflow(from: nil, to: nil, term: nil) ⇒ Object

Get cashflow report

Parameters:

  • from (String) (defaults to: nil)

    start date (YYYY-MM-DD)

  • to (String) (defaults to: nil)

    end date (YYYY-MM-DD)

  • term (String) (defaults to: nil)

    optional search term



85
86
87
88
89
90
91
# File 'lib/moco/client.rb', line 85

def cashflow(from: nil, to: nil, term: nil)
  params = {}
  params[:from] = from if from
  params[:to] = to if to
  params[:term] = term if term
  @client.get("report/cashflow", params)
end

#finance(from: nil, to: nil, term: nil) ⇒ Object

Get finance report

Parameters:

  • from (String) (defaults to: nil)

    start date (YYYY-MM-DD)

  • to (String) (defaults to: nil)

    end date (YYYY-MM-DD)

  • term (String) (defaults to: nil)

    optional search term



97
98
99
100
101
102
103
# File 'lib/moco/client.rb', line 97

def finance(from: nil, to: nil, term: nil)
  params = {}
  params[:from] = from if from
  params[:to] = to if to
  params[:term] = term if term
  @client.get("report/finance", params)
end

#utilization(from:, to:) ⇒ Object

Get utilization report

Parameters:

  • from (String)

    start date (YYYY-MM-DD) - required

  • to (String)

    end date (YYYY-MM-DD) - required



108
109
110
# File 'lib/moco/client.rb', line 108

def utilization(from:, to:)
  @client.get("report/utilization", { from:, to: })
end