Class: Imagekitio::Resources::Cache::Invalidation

Inherits:
Object
  • Object
show all
Defined in:
lib/imagekitio/resources/cache/invalidation.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Invalidation

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

Parameters:



60
61
62
# File 'lib/imagekitio/resources/cache/invalidation.rb', line 60

def initialize(client:)
  @client = client
end

Instance Method Details

#create(url: , request_options: {}) ⇒ Imagekitio::Models::Cache::InvalidationCreateResponse

Some parameter documentations has been truncated, see Models::Cache::InvalidationCreateParams for more details.

This API will purge CDN cache and ImageKit.io’s internal cache for a file. Note: Purge cache is an asynchronous process and it may take some time to reflect the changes.

Parameters:

Returns:

See Also:



23
24
25
26
27
28
29
30
31
32
# File 'lib/imagekitio/resources/cache/invalidation.rb', line 23

def create(params)
  parsed, options = Imagekitio::Cache::InvalidationCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "v1/files/purge",
    body: parsed,
    model: Imagekitio::Models::Cache::InvalidationCreateResponse,
    options: options
  )
end

#get(request_id, request_options: {}) ⇒ Imagekitio::Models::Cache::InvalidationGetResponse

Some parameter documentations has been truncated, see Models::Cache::InvalidationGetParams for more details.

This API returns the status of a purge cache request.

Parameters:

Returns:

See Also:



48
49
50
51
52
53
54
55
# File 'lib/imagekitio/resources/cache/invalidation.rb', line 48

def get(request_id, params = {})
  @client.request(
    method: :get,
    path: ["v1/files/purge/%1$s", request_id],
    model: Imagekitio::Models::Cache::InvalidationGetResponse,
    options: params[:request_options]
  )
end