Class: Imagekitio::Resources::NamedTransformations
- Inherits:
-
Object
- Object
- Imagekitio::Resources::NamedTransformations
- Defined in:
- lib/imagekitio/resources/named_transformations.rb,
sig/imagekitio/resources/named_transformations.rbs
Instance Method Summary collapse
-
#create(name:, transformation:, enabled: nil, request_options: {}) ⇒ Imagekitio::Models::NamedTransformation
Some parameter documentations has been truncated, see Models::NamedTransformationCreateParams for more details.
-
#delete(id, request_options: {}) ⇒ nil
Permanently deletes the named transformation identified by
id. -
#get(id, request_options: {}) ⇒ Imagekitio::Models::NamedTransformation
Retrieves the named transformation identified by
id. -
#initialize(client:) ⇒ NamedTransformations
constructor
private
A new instance of NamedTransformations.
-
#list(request_options: {}) ⇒ Array<Imagekitio::Models::NamedTransformation>
Returns an array of all named transformations configured for your account.
-
#update(id, enabled: nil, name: nil, transformation: nil, request_options: {}) ⇒ Imagekitio::Models::NamedTransformation
Some parameter documentations has been truncated, see Models::NamedTransformationUpdateParams for more details.
Constructor Details
#initialize(client:) ⇒ NamedTransformations
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 NamedTransformations.
146 147 148 |
# File 'lib/imagekitio/resources/named_transformations.rb', line 146 def initialize(client:) @client = client end |
Instance Method Details
#create(name:, transformation:, enabled: nil, request_options: {}) ⇒ Imagekitio::Models::NamedTransformation
Some parameter documentations has been truncated, see Models::NamedTransformationCreateParams for more details.
Creates a new named transformation and returns the created object.
A named transformation is a short, reusable name for a transformation string.
Use it in image and video URLs as tr:n-<name>, and update the underlying
transformation later without changing existing URLs. Learn more about
named transformations.
You can create up to 250 named transformations per account.
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/imagekitio/resources/named_transformations.rb', line 31 def create(params) parsed, = Imagekitio::NamedTransformationCreateParams.dump_request(params) @client.request( method: :post, path: "v1/named-transformations", body: parsed, model: Imagekitio::NamedTransformation, options: ) end |
#delete(id, request_options: {}) ⇒ nil
Permanently deletes the named transformation identified by id.
Deletion fails with a 409 error if the named transformation is still
referenced (via the n-<name> token) by an upload pre-transformation or
post-transformation setting. This check is best-effort and can't detect
references in your own application code or in previously generated URLs.
114 115 116 117 118 119 120 121 |
# File 'lib/imagekitio/resources/named_transformations.rb', line 114 def delete(id, params = {}) @client.request( method: :delete, path: ["v1/named-transformations/%1$s", id], model: NilClass, options: params[:request_options] ) end |
#get(id, request_options: {}) ⇒ Imagekitio::Models::NamedTransformation
Retrieves the named transformation identified by id.
134 135 136 137 138 139 140 141 |
# File 'lib/imagekitio/resources/named_transformations.rb', line 134 def get(id, params = {}) @client.request( method: :get, path: ["v1/named-transformations/%1$s", id], model: Imagekitio::NamedTransformation, options: params[:request_options] ) end |
#list(request_options: {}) ⇒ Array<Imagekitio::Models::NamedTransformation>
Returns an array of all named transformations configured for your account.
89 90 91 92 93 94 95 96 |
# File 'lib/imagekitio/resources/named_transformations.rb', line 89 def list(params = {}) @client.request( method: :get, path: "v1/named-transformations", model: Imagekitio::Internal::Type::ArrayOf[Imagekitio::NamedTransformation], options: params[:request_options] ) end |
#update(id, enabled: nil, name: nil, transformation: nil, request_options: {}) ⇒ Imagekitio::Models::NamedTransformation
Some parameter documentations has been truncated, see Models::NamedTransformationUpdateParams for more details.
Updates the named transformation identified by id and returns the updated
object. Only the fields present in the request body are updated; other fields
stay unchanged.
Renaming or disabling a named transformation fails with a 409 error if it is
still referenced (via the n-<name> token) by an upload pre-transformation or
post-transformation setting. This check is best-effort and can't detect
references in your own application code or in previously generated URLs.
69 70 71 72 73 74 75 76 77 78 |
# File 'lib/imagekitio/resources/named_transformations.rb', line 69 def update(id, params = {}) parsed, = Imagekitio::NamedTransformationUpdateParams.dump_request(params) @client.request( method: :patch, path: ["v1/named-transformations/%1$s", id], body: parsed, model: Imagekitio::NamedTransformation, options: ) end |