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:



129
130
131
# File 'lib/imagekitio/resources/accounts/origins.rb', line 129

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
# File 'lib/imagekitio/resources/accounts/origins.rb', line 19

def create(params)
  parsed, options = Imagekitio::Accounts::OriginCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "v1/accounts/origins",
    body: parsed[:origin_request],
    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:



93
94
95
96
97
98
99
100
# File 'lib/imagekitio/resources/accounts/origins.rb', line 93

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



117
118
119
120
121
122
123
124
# File 'lib/imagekitio/resources/accounts/origins.rb', line 117

def get(id, params = {})
  @client.request(
    method: :get,
    path: ["v1/accounts/origins/%1$s", id],
    model: 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.



47
48
49
50
51
52
53
54
55
56
# File 'lib/imagekitio/resources/accounts/origins.rb', line 47

def update(id, params)
  parsed, options = Imagekitio::Accounts::OriginUpdateParams.dump_request(params)
  @client.request(
    method: :put,
    path: ["v1/accounts/origins/%1$s", id],
    body: parsed[:origin_request],
    model: Imagekitio::Accounts::OriginResponse,
    options: options
  )
end