Class: Imagekitio::Resources::Accounts::Origins

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Origins

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

Parameters:



139
140
141
# File 'lib/imagekitio/resources/accounts/origins.rb', line 139

def initialize(client:)
  @client = client
end

Instance Method Details

#create(origin_request: , request_options: {}) ⇒ Imagekitio::Models::Accounts::OriginResponse::S3, ...

Note: This API is currently in beta. Creates a new origin and returns the origin object.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/imagekitio/resources/accounts/origins.rb', line 19

def create(params)
  parsed, options = Imagekitio::Accounts::OriginCreateParams.dump_request(params)
  case parsed
  in {origin_request: Hash => union, **rest}
    parsed = {**rest, **union}
  else
  end
  @client.request(
    method: :post,
    path: "v1/accounts/origins",
    body: parsed,
    model: Imagekitio::Accounts::OriginResponse,
    options: options
  )
end

#delete(id, request_options: {}) ⇒ nil

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

Note: This API is currently in beta. Permanently removes the origin identified by ‘id`. If the origin is in use by any URL‑endpoints, the API will return an error.

Parameters:

  • id (String)

    Unique identifier for the origin. This is generated by ImageKit when you create

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

Returns:

  • (nil)

See Also:



103
104
105
106
107
108
109
110
# File 'lib/imagekitio/resources/accounts/origins.rb', line 103

def delete(id, params = {})
  @client.request(
    method: :delete,
    path: ["v1/accounts/origins/%1$s", id],
    model: NilClass,
    options: params[:request_options]
  )
end

#get(id, request_options: {}) ⇒ Imagekitio::Models::Accounts::OriginResponse::S3, ...

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

Note: This API is currently in beta. Retrieves the origin identified by ‘id`.



127
128
129
130
131
132
133
134
# File 'lib/imagekitio/resources/accounts/origins.rb', line 127

def get(id, params = {})
  @client.request(
    method: :get,
    path: ["v1/accounts/origins/%1$s", id],
    model: Imagekitio::Accounts::OriginResponse,
    options: params[:request_options]
  )
end

#list(request_options: {}) ⇒ Array<Imagekitio::Models::Accounts::OriginResponse::S3, Imagekitio::Models::Accounts::OriginResponse::S3Compatible, Imagekitio::Models::Accounts::OriginResponse::CloudinaryBackup, Imagekitio::Models::Accounts::OriginResponse::WebFolder, Imagekitio::Models::Accounts::OriginResponse::WebProxy, Imagekitio::Models::Accounts::OriginResponse::Gcs, Imagekitio::Models::Accounts::OriginResponse::AzureBlob, Imagekitio::Models::Accounts::OriginResponse::AkeneoPim>

Note: This API is currently in beta. Returns an array of all configured origins for the current account.



78
79
80
81
82
83
84
85
# File 'lib/imagekitio/resources/accounts/origins.rb', line 78

def list(params = {})
  @client.request(
    method: :get,
    path: "v1/accounts/origins",
    model: Imagekitio::Internal::Type::ArrayOf[union: Imagekitio::Accounts::OriginResponse],
    options: params[:request_options]
  )
end

#update(id, origin_request: , request_options: {}) ⇒ Imagekitio::Models::Accounts::OriginResponse::S3, ...

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

Note: This API is currently in beta. Updates the origin identified by ‘id` and returns the updated origin object.



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/imagekitio/resources/accounts/origins.rb', line 52

def update(id, params)
  parsed, options = Imagekitio::Accounts::OriginUpdateParams.dump_request(params)
  case parsed
  in {origin_request: Hash => union, **rest}
    parsed = {**rest, **union}
  else
  end
  @client.request(
    method: :put,
    path: ["v1/accounts/origins/%1$s", id],
    body: parsed,
    model: Imagekitio::Accounts::OriginResponse,
    options: options
  )
end