class

Polar::Api::Metrics

Inherits Reference < Object

API client for metrics operations

Constants

Log = ::Log.for(self)

Constructors

new(client : Client)

Creates a new Metrics instance

@param client [Client] The Polar API client instance

Source

Instance methods

get(start_date : String, end_date : String, interval : String, timezone : String | Nil = nil, organization_id : String | Nil = nil, product_id : String | Nil = nil, billing_type : String | Nil = nil, customer_id : String | Nil = nil) : Polar::Models::MetricsResponse

Get Metrics

Get metrics about your orders and subscriptions.

Currency values are output in cents.

Scopes: metrics:read

Endpoint: GET /v1/metrics/

Parameters:

  • start_date (required): Start date.
  • end_date (required): End date.
  • timezone (optional): Timezone to use for the timestamps. Default is UTC.
  • interval (required): Interval between two timestamps.
  • organization_id (optional): Filter by organization ID.
  • product_id (optional): Filter by product ID.
  • billing_type (optional): Filter by billing type. recurring will filter data corresponding to subscriptions creations or renewals. one_time will filter data corresponding to one-time purchases.
  • customer_id (optional): Filter by customer ID.

Returns: Polar::Models::MetricsResponse

Raises:

  • ResourceNotFoundError on 404
  • NotPermittedError on 403
  • HTTPValidationError on 422
  • PolarError on other errors
Source
limits

Get Metrics Limits

Get the interval limits for the metrics endpoint.

Scopes: metrics:read

Endpoint: GET /v1/metrics/limits

Returns: Polar::Models::MetricsLimits

Raises:

  • ResourceNotFoundError on 404
  • NotPermittedError on 403
  • HTTPValidationError on 422
  • PolarError on other errors
Source