Class: ReportsClient

Inherits:
Object
  • Object
show all
Defined in:
lib/lockstep_sdk/clients/reports.rb

Instance Method Summary collapse

Constructor Details

#initialize(lockstepsdk) ⇒ ReportsClient

Initialize the ReportsClient class with a lockstepsdk instance.

Parameters:

  • lockstepsdk (LockstepApi)

    The Lockstep API client object for this connection



24
25
26
# File 'lib/lockstep_sdk/clients/reports.rb', line 24

def initialize(lockstepsdk)
    @lockstepsdk = lockstepsdk
end

Instance Method Details

#accounts_receivable_aging_headerObject

Retrieves AR Aging Header information report broken down by aging bucket.

The AR Aging Header report contains aggregated information about the `TotalInvoicesPastDue`, `TotalCustomers`, and their respective `PercentageOfTotalAr` grouped by their aging `ReportBucket`.



91
92
93
94
# File 'lib/lockstep_sdk/clients/reports.rb', line 91

def accounts_receivable_aging_header()
    path = "/api/v1/Reports/ar-aging-header"
    @lockstepsdk.request(:get, path, nil, nil)
end

#accounts_receivable_header(report_date:, company_id:) ⇒ Object

Retrieves AR header information up to the date specified.

Parameters:

  • report_date (date)

    The date of the report.

  • company_id (uuid)

    Include a company to get AR data for a specific company, leave as null to include all Companies.



62
63
64
65
66
# File 'lib/lockstep_sdk/clients/reports.rb', line 62

def accounts_receivable_header(report_date:, company_id:)
    path = "/api/v1/Reports/ar-header"
    params = {:reportDate => report_date, :companyId => company_id}
    @lockstepsdk.request(:get, path, nil, params)
end

#attachments_header_information(company_id:) ⇒ Object

Retrieves Attachment Header information for the requested companyId.

The Attachment Header report contains aggregated information about the `TotalAttachments`, `TotalArchived`, and `TotalActive` attachment classifications.

Parameters:

  • company_id (uuid)

    Include a specific company to get Attachment data for, leave as null to include all Companies.



101
102
103
104
105
# File 'lib/lockstep_sdk/clients/reports.rb', line 101

def attachments_header_information(company_id:)
    path = "/api/v1/Reports/attachments-header"
    params = {:companyId => company_id}
    @lockstepsdk.request(:get, path, nil, params)
end

#cash_flow(timeframe:) ⇒ Object

Retrieves a current Cash Flow report for this account.

The Cash Flow report indicates the amount of payments retrieved and invoices billed within a given timeframe. You can use this report to determine the overall balance of money coming into and out of your accounts receivable and accounts payable businesses.

Parameters:

  • timeframe (int32)

    Number of days of data to include for the Cash Flow Report (default is 30 days from today)



34
35
36
37
38
# File 'lib/lockstep_sdk/clients/reports.rb', line 34

def cash_flow(timeframe:)
    path = "/api/v1/Reports/cashflow"
    params = {:timeframe => timeframe}
    @lockstepsdk.request(:get, path, nil, params)
end

#daily_sales_outstandingObject

Retrieves a current Daily Sales Outstanding (DSO) report for this account.

Daily Sales Outstanding, or DSO, is a metric that indicates the average number of days that it takes for an invoice to be fully paid. You can use this report to identify whether a company is improving on its ability to collect on invoices.



44
45
46
47
# File 'lib/lockstep_sdk/clients/reports.rb', line 44

def daily_sales_outstanding()
    path = "/api/v1/Reports/dailysalesoutstanding"
    @lockstepsdk.request(:get, path, nil, nil)
end

#invoice_aging_report(company_id:, recalculate:, currency_code:, currency_provider:, buckets:) ⇒ Object

The Aging Report contains information about the total dollar value of invoices broken down by their age. Last default or specified bucket treated as a catch all bucket for values that fit in that bucket or beyond.

You can specify viewing parameters for the aging report such as currency code and date bucket configuration. You can also view aging data for an entire account or a specific company.

This information is recalculated when invoice data changes. After each invoice data change occurs, Lockstep queues up a calculation based on the current invoice data at that time. This information is calculated and persisted for each customer so that the report will be available quickly.

To force a recalculation of aging data, specify the `recalculate` option. Note that forcing a recalculation will slow your API response time.

Parameters:

  • company_id (uuid)

    Company aging buckets are filtered by (all company aging returned if not company specified)

  • recalculate (boolean)

    Force api to recalculate aging data, cached data may be returned when set to false

  • currency_code (string)

    Currency aging buckets are converted to (all aging data returned without currency conversion if no currency is specified)

  • currency_provider (string)

    Currency provider currency rates should be returned from to convert aging amounts to (default Lockstep currency provider used if no data provider specified)

  • buckets (int32)

    Customized buckets used for aging calculations (default buckets [0,30,60,90,120,180] will be used if buckets not specified)



81
82
83
84
85
# File 'lib/lockstep_sdk/clients/reports.rb', line 81

def invoice_aging_report(company_id:, recalculate:, currency_code:, currency_provider:, buckets:)
    path = "/api/v1/Reports/aging"
    params = {:CompanyId => company_id, :Recalculate => recalculate, :CurrencyCode => currency_code, :CurrencyProvider => currency_provider, :Buckets => buckets}
    @lockstepsdk.request(:get, path, nil, params)
end

#risk_ratesObject

Retrieves a current Risk Rate report for this account.

Risk Rate is a metric that indicates the percentage of total AR balance left unpaid after 90 days. You can use this report to identify the percentage of invoice value that is not being collected in a timely manner.



53
54
55
56
# File 'lib/lockstep_sdk/clients/reports.rb', line 53

def risk_rates()
    path = "/api/v1/Reports/riskrates"
    @lockstepsdk.request(:get, path, nil, nil)
end