Class: Imagekitio::Resources::Accounts::UsageAnalytics

Inherits:
Object
  • Object
show all
Defined in:
lib/imagekitio/resources/accounts/usage_analytics.rb,
sig/imagekitio/resources/accounts/usage_analytics.rbs

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ UsageAnalytics

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of UsageAnalytics.

Parameters:



49
50
51
# File 'lib/imagekitio/resources/accounts/usage_analytics.rb', line 49

def initialize(client:)
  @client = client
end

Instance Method Details

#get(end_date:, start_date:, request_options: {}) ⇒ Imagekitio::Models::Accounts::UsageAnalyticsResponse

Some parameter documentations has been truncated, see Models::Accounts::UsageAnalyticsGetParams for more details.

Note: This API is currently in beta.

Get the account analytics data between two dates. The response covers the period from the start date to the end date, both dates inclusive. Both dates are interpreted as UTC calendar days.

The returned data is scoped to the requesting account only. Unlike /v1/accounts/usage, an agency account's analytics are not aggregated across its child accounts.

The response is cached for 5 minutes per account and date range. Use generatedAt to check how fresh the returned data is.

Parameters:

  • end_date (Date)

    Specify an endDate in YYYY-MM-DD format, interpreted as a UTC calendar day.

  • start_date (Date)

    Specify a startDate in YYYY-MM-DD format, interpreted as a UTC calendar day.

  • request_options (Imagekitio::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



34
35
36
37
38
39
40
41
42
43
44
# File 'lib/imagekitio/resources/accounts/usage_analytics.rb', line 34

def get(params)
  parsed, options = Imagekitio::Accounts::UsageAnalyticsGetParams.dump_request(params)
  query = Imagekitio::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "v1/accounts/usage-analytics",
    query: query.transform_keys(end_date: "endDate", start_date: "startDate"),
    model: Imagekitio::Accounts::UsageAnalyticsResponse,
    options: options
  )
end