Class: Imagekitio::Resources::Accounts::Usage

Inherits:
Object
  • Object
show all
Defined in:
lib/imagekitio/resources/accounts/usage.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Usage

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 Usage.

Parameters:



40
41
42
# File 'lib/imagekitio/resources/accounts/usage.rb', line 40

def initialize(client:)
  @client = client
end

Instance Method Details

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

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

Get the account usage information between two dates. Note that the API response includes data from the start date while excluding data from the end date. In other words, the data covers the period starting from the specified start date up to, but not including, the end date.

Parameters:

  • end_date (Date)

    Specify a ‘endDate` in `YYYY-MM-DD` format. It should be after the `startDate`.

  • start_date (Date)

    Specify a ‘startDate` in `YYYY-MM-DD` format. It should be before the `endDate`.

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

Returns:

See Also:



26
27
28
29
30
31
32
33
34
35
# File 'lib/imagekitio/resources/accounts/usage.rb', line 26

def get(params)
  parsed, options = Imagekitio::Accounts::UsageGetParams.dump_request(params)
  @client.request(
    method: :get,
    path: "v1/accounts/usage",
    query: parsed.transform_keys(end_date: "endDate", start_date: "startDate"),
    model: Imagekitio::Models::Accounts::UsageGetResponse,
    options: options
  )
end