Class: Nombaone::Resources::Metrics

Inherits:
BaseResource show all
Defined in:
lib/nombaone/resources/metrics.rb,
sig/nombaone/resources.rbs

Overview

Metrics — MRR, churn, and the dunning funnel, computed from the ledger on read (never stored, never stale).

Instance Method Summary collapse

Methods inherited from BaseResource

#encode, #initialize, #request, #request_page

Constructor Details

This class inherits a constructor from Nombaone::Resources::BaseResource

Instance Method Details

#billing(from: OMIT, to: OMIT, request_options: {}) ⇒ NombaObject

Billing KPIs over a window (defaults to a recent window server-side).

Examples:

metrics = nombaone.metrics.billing
puts "MRR ₦#{metrics.mrr_in_kobo / 100}"

Parameters:

  • from (String) (defaults to: OMIT)

    ISO-8601 date-time, start of the window.

  • to (String) (defaults to: OMIT)

    ISO-8601 date-time, end of the window.

  • request_options (Hash) (defaults to: {})
  • from: (String) (defaults to: OMIT)
  • to: (String) (defaults to: OMIT)
  • request_options: (Nombaone::request_options) (defaults to: {})

Returns:

  • (NombaObject)

    with mrr_in_kobo, active_count, churn counts, and the dunning_funnel.



19
20
21
# File 'lib/nombaone/resources/metrics.rb', line 19

def billing(from: OMIT, to: OMIT, request_options: {})
  request(:get, "/metrics/billing", query: { from: from, to: to }, options: request_options)
end