Polar::Api::Meters
API client for meters operations
Constants
Constructors
Creates a new Meters instance
@param client [Client] The Polar API client instance
Instance methods
Create Meter
Create a meter.
Scopes: meters:write
Endpoint: POST /v1/meters/
Parameters:
body(required): Request body as Polar::Models::MeterCreate
Returns: Polar::Models::Meter
Raises:
ResourceNotFoundErroron 404NotPermittedErroron 403HTTPValidationErroron 422PolarErroron other errors
Get Meter
Get a meter by ID.
Scopes: meters:read meters:write
Endpoint: GET /v1/meters/{id}
Parameters:
id(required): The meter ID.
Returns: Polar::Models::Meter
Raises:
ResourceNotFoundErroron 404NotPermittedErroron 403HTTPValidationErroron 422PolarErroron other errors
List Meters
List meters.
Scopes: meters:read meters:write
Endpoint: GET /v1/meters/
Parameters:
organization_id(optional): Filter by organization ID.query(optional): Filter by name.is_archived(optional): Filter on archived meters.page(optional): Page number, defaults to 1.limit(optional): Size of a page, defaults to 10. Maximum is 100.sorting(optional): Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign - before the criteria name to sort by descending order.metadata(optional): Filter by metadata key-value pairs. It uses the deepObject style, e.g. ?metadata[key]=value.
Returns: Polar::Models::ListResource(Polar::Models::Meter)
Raises:
ResourceNotFoundErroron 404NotPermittedErroron 403HTTPValidationErroron 422PolarErroron other errors
Get Meter Quantities
Get quantities of a meter over a time period.
Scopes: meters:read meters:write
Endpoint: GET /v1/meters/{id}/quantities
Parameters:
id(required): The meter ID.start_timestamp(required): Start timestamp.end_timestamp(required): End timestamp.interval(required): Interval between two timestamps.customer_id(optional): Filter by customer ID.external_customer_id(optional): Filter by external customer ID.customer_aggregation_function(optional): If set, will first compute the quantities per customer before aggregating them using the given function. If not set, the quantities will be aggregated across all events.metadata(optional): Filter by metadata key-value pairs. It uses the deepObject style, e.g. ?metadata[key]=value.
Returns: Polar::Models::MeterQuantities
Raises:
ResourceNotFoundErroron 404NotPermittedErroron 403HTTPValidationErroron 422PolarErroron other errors
Update Meter
Update a meter.
Scopes: meters:write
Endpoint: PATCH /v1/meters/{id}
Parameters:
id(required): The meter ID.body(required): Request body as Polar::Models::MeterUpdate
Returns: Polar::Models::Meter
Raises:
ResourceNotFoundErroron 404NotPermittedErroron 403HTTPValidationErroron 422PolarErroron other errors