=============== LIBRARY RULES =============== From library maintainers: - Install the gem as `uploadcare-ruby` and require it with `require "uploadcare"`. - Prefer explicit `Uploadcare::Client` instances for application code, especially when an app uses more than one Uploadcare project. - Configure credentials with `Uploadcare::Client.new(public_key: ..., secret_key: ...)`, `Uploadcare.configure`, or the UPLOADCARE_PUBLIC_KEY and UPLOADCARE_SECRET_KEY environment variables. - Never hardcode real Uploadcare API keys in examples or application code; use environment variables or an application secrets store. - Use `client.files`, `client.groups`, `client.uploads`, `client.project`, `client.webhooks`, `client.file_metadata`, `client.addons`, and `client.conversions` for normal application workflows. - Use `client.api.rest` and `client.api.upload` when exact REST API or Upload API endpoint parity is needed. - Use `client.uploads.upload` for automatic upload method selection and `client.uploads.multipart_upload` for explicit multipart uploads. - Use `MIGRATING_V5.md` when upgrading applications from uploadcare-ruby v4.x to v5. ### Run Upload API Example Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/api_examples/README.md Execute an Upload API example script using mise and Ruby. Ensure UPLOADCARE_PUBLIC_KEY and UPLOADCARE_SECRET_KEY environment variables are set. ```bash mise exec -- ruby api_examples/upload_api/post_base.rb ``` -------------------------------- ### POST /multipart/start/ Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/api_examples/README.md Starts a multipart upload process. ```APIDOC ## POST /multipart/start/ ### Description Starts a multipart upload process. ### Method POST ### Endpoint /multipart/start/ ### Notes Starts and completes a real multipart upload. ``` -------------------------------- ### Run REST API Example Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/api_examples/README.md Execute a REST API example script using mise and Ruby. Ensure UPLOADCARE_PUBLIC_KEY and UPLOADCARE_SECRET_KEY environment variables are set. ```bash mise exec -- ruby api_examples/rest_api/get_project.rb ``` -------------------------------- ### Install uploadcare-ruby Gem Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Add the uploadcare-ruby gem to your Gemfile and install it using bundler. ```ruby gem "uploadcare-ruby" ``` ```bash bundle ``` -------------------------------- ### Run Ruby Scripts with Mise Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/examples/README.md Execute Ruby example scripts using the 'mise' tool to manage project-specific Ruby versions. ```bash mise exec -- ruby examples/simple_upload.rb spec/fixtures/kitten.jpeg ``` -------------------------------- ### Example Usage: Upload File and Create Group Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Demonstrates uploading a file and then creating a group containing that file. Outputs the UUID and CDN URL for both the file and the group. ```ruby require "uploadcare" client = Uploadcare::Client.new( public_key: ENV.fetch("UPLOADCARE_PUBLIC_KEY"), secret_key: ENV.fetch("UPLOADCARE_SECRET_KEY") ) file = File.open("photo.jpg", "rb") do |io| client.files.upload(io, store: true) end group = client.groups.create(uuids: [file.uuid]) puts file.uuid puts file.cdn_url puts group.id puts group.cdn_url ``` -------------------------------- ### Quick Start: Upload a File with Global Configuration Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Configure a default global Uploadcare client and upload a file using the global instance. This is a less recommended style compared to explicit client instances. ```ruby Uploadcare.configure do |config| config.public_key = ENV.fetch("UPLOADCARE_PUBLIC_KEY") config.secret_key = ENV.fetch("UPLOADCARE_SECRET_KEY") end file = File.open("photo.jpg", "rb") do |io| Uploadcare.files.upload(io, store: true) end ``` -------------------------------- ### Quick Start: Upload a File with Client Instance Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Initialize an Uploadcare client and upload a local file. The file is stored by default. Access the file's UUID and CDN URL. ```ruby require "uploadcare" client = Uploadcare::Client.new( public_key: ENV.fetch("UPLOADCARE_PUBLIC_KEY"), secret_key: ENV.fetch("UPLOADCARE_SECRET_KEY") ) file = File.open("photo.jpg", "rb") do |io| client.files.upload(io, store: true) end puts file.uuid puts file.cdn_url ``` -------------------------------- ### GET /info/ Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/api_examples/README.md Retrieves information about an uploaded file using the raw Upload API. ```APIDOC ## GET /info/ ### Description Retrieves information about an uploaded file using the raw Upload API. ### Method GET ### Endpoint /info/ ### Notes Uses raw upload API. ``` -------------------------------- ### Get Current Project Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/api_examples/README.md Retrieves information about the current project. This operation uses the `client.project.current` method. ```APIDOC ## GET /project/ ### Description Retrieves information about the current project. ### Method GET ### Endpoint /project/ ``` -------------------------------- ### GET /from_url/status/ Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/api_examples/README.md Checks the status of an asynchronous upload initiated from a URL. ```APIDOC ## GET /from_url/status/ ### Description Checks the status of an asynchronous upload initiated from a URL. ### Method GET ### Endpoint /from_url/status/ ### Notes Starts async upload then checks status. ``` -------------------------------- ### Perform Document and Video Conversions Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Handles document and video conversions, allowing you to get information about conversion capabilities, initiate conversions, and check their status. Document conversion returns a hash, while video conversion returns a specific resource. ```ruby info = client.conversions.documents.info(uuid: file.uuid) job = client.conversions.documents.convert(uuid: file.uuid, format: :pdf) status = client.conversions.documents.status(token: job.fetch("result").first.fetch("token")) ``` ```ruby job = client.conversions.videos.convert(uuid: file.uuid, format: :webm, quality: :normal) status = client.conversions.videos.status(token: job.result.first.fetch("token")) ``` -------------------------------- ### GET /group/info/ Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/api_examples/README.md Retrieves information about a file group using the raw Upload API. ```APIDOC ## GET /group/info/ ### Description Retrieves information about a file group using the raw Upload API. ### Method GET ### Endpoint /group/info/ ### Notes Uses raw upload API. ``` -------------------------------- ### Get Specific File Metadata Key Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/api_examples/README.md Retrieves a specific metadata key for a file. This operation uses the `client.file_metadata.show` method. ```APIDOC ## GET /files/{uuid}/metadata/{key}/ ### Description Retrieves a specific metadata key for a file. ### Method GET ### Endpoint /files/{uuid}/metadata/{key}/ ### Parameters #### Path Parameters - **uuid** (string) - Required - The unique identifier of the file. - **key** (string) - Required - The metadata key to retrieve. ``` -------------------------------- ### Get File Metadata Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/api_examples/README.md Retrieves metadata for a specific file. This operation uses the `client.file_metadata.index` method. ```APIDOC ## GET /files/{uuid}/metadata/ ### Description Retrieves metadata for a specific file. ### Method GET ### Endpoint /files/{uuid}/metadata/ ### Parameters #### Path Parameters - **uuid** (string) - Required - The unique identifier of the file. ``` -------------------------------- ### Get Document Conversion Info Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/api_examples/README.md Retrieves information about a document conversion job. This operation uses the `client.conversions.documents.info` method. ```APIDOC ## GET /convert/document/{uuid}/ ### Description Retrieves information about a document conversion job. ### Method GET ### Endpoint /convert/document/{uuid}/ ### Parameters #### Path Parameters - **uuid** (string) - Required - The unique identifier of the document conversion job. ``` -------------------------------- ### Get File Info via REST API Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Retrieve information for a specific file using its UUID. Requires the 'rest' client. ```ruby client.api.rest.files.info(uuid: "file-uuid") ``` -------------------------------- ### Document Conversions Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Handles document conversion tasks, including getting info, converting, and checking status. ```APIDOC ## Conversions - Documents ### Description Handles document conversion tasks. ### Methods - `client.conversions.documents.info(uuid: file.uuid)`: Gets information about document conversion. - `client.conversions.documents.convert(uuid: file.uuid, format: :pdf)`: Converts a document to a specified format. - `client.conversions.documents.status(token: job.fetch("result").first.fetch("token"))`: Checks the status of a document conversion job. ### Request Example ```ruby info = client.conversions.documents.info(uuid: file.uuid) job = client.conversions.documents.convert(uuid: file.uuid, format: :pdf) status = client.conversions.documents.status(token: job.fetch("result").first.fetch("token")) ``` ### Response The `convert` method returns the API response hash. ``` -------------------------------- ### Get Video Conversion Status Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/api_examples/README.md Retrieves the status of a video conversion job using its token. This operation is part of the `client.conversions.videos.convert` process. ```APIDOC ## GET /convert/video/status/{token}/ ### Description Retrieves the status of a video conversion job. ### Method GET ### Endpoint /convert/video/status/{token}/ ### Parameters #### Path Parameters - **token** (string) - Required - The token for the video conversion job. ``` -------------------------------- ### Get Document Conversion Status Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/api_examples/README.md Retrieves the status of a document conversion job using its token. This operation is part of the `client.conversions.documents.convert` process. ```APIDOC ## GET /convert/document/status/{token}/ ### Description Retrieves the status of a document conversion job. ### Method GET ### Endpoint /convert/document/status/{token}/ ### Parameters #### Path Parameters - **token** (string) - Required - The token for the document conversion job. ``` -------------------------------- ### Get Remove BG Addon Status Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/api_examples/README.md Retrieves the status of a Remove BG addon execution. This operation uses `client.addons.*` and checks status. ```APIDOC ## GET /addons/remove_bg/execute/status/ ### Description Retrieves the status of a Remove BG addon execution. ### Method GET ### Endpoint /addons/remove_bg/execute/status/ ``` -------------------------------- ### REST API Access Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Access the REST API endpoints directly for operations like listing files, getting file information, and showing project details. ```APIDOC ## REST API Operations ### List Files - **Description**: Retrieves a list of files with optional parameters. - **Method**: Not applicable (Ruby method call) - **Endpoint**: Not applicable (Ruby method call) - **Parameters**: - `params` (Hash) - Optional - Parameters for filtering and pagination, e.g., `limit`. ### File Info - **Description**: Retrieves information about a specific file using its UUID. - **Method**: Not applicable (Ruby method call) - **Endpoint**: Not applicable (Ruby method call) - **Parameters**: - `uuid` (String) - Required - The unique identifier of the file. ### Show Project - **Description**: Retrieves project details. - **Method**: Not applicable (Ruby method call) - **Endpoint**: Not applicable (Ruby method call) ### List Webhooks - **Description**: Retrieves a list of configured webhooks. - **Method**: Not applicable (Ruby method call) - **Endpoint**: Not applicable (Ruby method call) ### Code Example ```ruby # List files with a limit of 10 client.api.rest.files.list(params: { limit: 10 }) # Get info for a specific file client.api.rest.files.info(uuid: "file-uuid") # Show project details client.api.rest.project.show # List webhooks client.api.rest.webhooks.list ``` ``` -------------------------------- ### Get AWS Rekognition Detect Labels Addon Status Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/api_examples/README.md Retrieves the status of an AWS Rekognition Detect Labels addon execution. This operation uses `client.addons.*` and checks status. ```APIDOC ## GET /addons/aws_rekognition_detect_labels/execute/status/ ### Description Retrieves the status of an AWS Rekognition Detect Labels addon execution. ### Method GET ### Endpoint /addons/aws_rekognition_detect_labels/execute/status/ ``` -------------------------------- ### Get UC ClamAV Virus Scan Addon Status Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/api_examples/README.md Retrieves the status of a UC ClamAV Virus Scan addon execution. This operation uses `client.addons.*` and checks status. ```APIDOC ## GET /addons/uc_clamav_virus_scan/execute/status/ ### Description Retrieves the status of a UC ClamAV Virus Scan addon execution. ### Method GET ### Endpoint /addons/uc_clamav_virus_scan/execute/status/ ``` -------------------------------- ### Get AWS Rekognition Detect Moderation Labels Addon Status Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/api_examples/README.md Retrieves the status of an AWS Rekognition Detect Moderation Labels addon execution. This operation uses `client.addons.*` and checks status. ```APIDOC ## GET /addons/aws_rekognition_detect_moderation_labels/execute/status/ ### Description Retrieves the status of an AWS Rekognition Detect Moderation Labels addon execution. ### Method GET ### Endpoint /addons/aws_rekognition_detect_moderation_labels/execute/status/ ``` -------------------------------- ### POST /base/ Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/api_examples/README.md Initiates a file upload using the raw Upload API. ```APIDOC ## POST /base/ ### Description Initiates a file upload using the raw Upload API. ### Method POST ### Endpoint /base/ ### Notes Uses raw upload API. ``` -------------------------------- ### Build Uploadcare Configuration Object Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Create configuration objects directly for initializing the Uploadcare client. This allows for more granular control over client configurations. ```ruby base_config = Uploadcare::Configuration.new( public_key: "public_key", secret_key: "secret_key" ) client = Uploadcare::Client.new(config: base_config) ``` -------------------------------- ### Set Uploadcare Credentials Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/examples/README.md Set your Uploadcare public and secret keys as environment variables before running scripts. ```bash export UPLOADCARE_PUBLIC_KEY=your_public_key export UPLOADCARE_SECRET_KEY=your_secret_key ``` -------------------------------- ### Configure CDN Helpers Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Configure CDN-related settings like subdomains, postfixes, and default base URLs. Access CDN configuration through the global configuration object. ```ruby Uploadcare.configure do |config| config.use_subdomains = true config.cdn_base_postfix = "https://ucarecd.net/" config.default_cdn_base = "https://ucarecdn.com/" end Uploadcare.configuration.custom_cname Uploadcare.configuration.cdn_base ``` -------------------------------- ### Show Project Info via REST API Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Fetches project details. Requires the 'rest' client. ```ruby client.api.rest.project.show ``` -------------------------------- ### POST /from_url/ Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/api_examples/README.md Initiates an upload from a URL using the raw Upload API. ```APIDOC ## POST /from_url/ ### Description Initiates an upload from a URL using the raw Upload API. ### Method POST ### Endpoint /from_url/ ### Notes Uses raw upload API. ``` -------------------------------- ### Create and Manage Groups Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Handles the creation, finding, listing, and deletion of file groups. Useful helpers for accessing group CDN URLs are also provided. ```ruby group = client.groups.create(uuids: ["uuid-1", "uuid-2"]) ``` ```ruby group = client.groups.find(group_id: "group-uuid~2") groups = client.groups.list(limit: 50) ``` ```ruby group.delete ``` ```ruby group.cdn_url group.file_cdn_urls ``` -------------------------------- ### Initialize Multiple Uploadcare Clients Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Support for multiple Uploadcare projects in the same process by initializing separate client instances with different API keys. ```ruby primary = Uploadcare::Client.new(public_key: "pk-1", secret_key: "sk-1") secondary = Uploadcare::Client.new(public_key: "pk-2", secret_key: "sk-2") primary_file = primary.files.find(uuid: "uuid-1") secondary_file = secondary.files.find(uuid: "uuid-2") ``` -------------------------------- ### Enable Signed Uploads Globally Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Enable signed uploads globally by configuring the client with `sign_uploads: true`. This applies to all subsequent uploads from this client instance. ```ruby client = Uploadcare::Client.new( public_key: "public", secret_key: "secret", sign_uploads: true ) ``` -------------------------------- ### List Files Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Fetches a list of files with options for pagination and filtering. Supports passing API parameters directly. ```APIDOC ## List Files ### Description Fetches a list of files, supporting pagination and filtering. ### Method `client.files.list` ### Parameters #### Query Parameters - **limit** (Integer) - Optional - Maximum number of files to return. - **stored** (Boolean) - Optional - Filter by stored status. - **removed** (Boolean) - Optional - Filter by removed status. ### Request Example ```ruby files = client.files.list(limit: 100) files = client.files.list(stored: true, removed: false, limit: 100) ``` ### Response Returns a `Uploadcare::Collections::Paginated` object with methods like `next_page`, `previous_page`, and `all`. ### Response Example ```ruby files.each { |file| puts file.uuid } ``` ``` -------------------------------- ### List Files via REST API Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Use this to list files with a specified limit. Requires the 'rest' client. ```ruby client.api.rest.files.list(params: { limit: 10 }) ``` -------------------------------- ### Configuration Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Configure Uploadcare with your public and secret keys, and other process-wide defaults. ```APIDOC ## Configuration Use `Uploadcare.configure` to set process-wide defaults: ```ruby Uploadcare.configure do |config| config.public_key = "public_key" config.secret_key = "secret_key" config.auth_type = "Uploadcare" config.use_subdomains = false end ``` Or build configuration objects directly: ```ruby base_config = Uploadcare::Configuration.new( public_key: "public_key", secret_key: "secret_key" ) client = Uploadcare::Client.new(config: base_config) ``` Common configuration options: - `public_key` - `secret_key` - `auth_type` - `multipart_size_threshold` - `multipart_chunk_size` - `upload_threads` - `upload_timeout` - `max_upload_retries` - `sign_uploads` - `upload_signature_lifetime` - `use_subdomains` - `cdn_base_postfix` - `default_cdn_base` ``` -------------------------------- ### Asynchronous Upload from URL Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Initiate an asynchronous upload from a URL. Returns a job token hash, and the file is not yet available. Use `upload_from_url_status` to check the status. ```ruby job = client.uploads.upload_from_url(url: "https://example.com/image.jpg", async: true, store: true) status = client.uploads.upload_from_url_status(token: job.fetch("token")) ``` -------------------------------- ### POST /group/ Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/api_examples/README.md Creates a group of files using the raw Upload API. ```APIDOC ## POST /group/ ### Description Creates a group of files using the raw Upload API. ### Method POST ### Endpoint /group/ ### Notes Uses raw upload API. ``` -------------------------------- ### Convert Video Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/api_examples/README.md Initiates a video conversion job. This operation uses the `client.conversions.videos.convert` method. ```APIDOC ## POST /convert/video/ ### Description Initiates a video conversion job. ### Method POST ### Endpoint /convert/video/ ``` -------------------------------- ### Create Webhook Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/api_examples/README.md Creates a new webhook subscription. This operation uses the `client.webhooks.create` method. ```APIDOC ## POST /webhooks/ ### Description Creates a new webhook subscription. ### Method POST ### Endpoint /webhooks/ ``` -------------------------------- ### Copy Uploadcare Configuration Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Configuration objects are copyable, allowing you to create new client instances with modified configurations, such as different API keys. ```ruby account_a = Uploadcare::Client.new(config: base_config.with(public_key: "pk-a", secret_key: "sk-a")) account_b = Uploadcare::Client.new(config: base_config.with(public_key: "pk-b", secret_key: "sk-b")) ``` -------------------------------- ### Synchronous Upload from URL Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Upload a file from a URL synchronously. The `store: true` option ensures the file is stored. ```ruby file = client.files.upload_from_url("https://example.com/image.jpg", store: true) ``` -------------------------------- ### Copy File to Local Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/api_examples/README.md Creates a local copy of a file. This operation uses the `client.files.copy_to_local` method. ```APIDOC ## POST /files/local_copy/ ### Description Creates a local copy of a file. ### Method POST ### Endpoint /files/local_copy/ ``` -------------------------------- ### Single File Upload with Metadata Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Upload a single local file with optional metadata. The `store: true` option ensures the file is stored. ```ruby file = File.open("photo.jpg", "rb") do |io| client.files.upload(io, store: true, metadata: { subsystem: "avatars" }) end ``` -------------------------------- ### Create and Manage Webhooks Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Allows for the creation, listing, updating, and deletion of webhooks. Webhooks can be configured with a target URL, event type, and active status. ```ruby webhook = client.webhooks.create( target_url: "https://example.com/uploadcare", event: "file.uploaded", is_active: true ) client.webhooks.list client.webhooks.update(id: webhook.id, is_active: false) client.webhooks.delete(target_url: webhook.target_url) ``` -------------------------------- ### List Files Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/api_examples/README.md Retrieves a list of all files managed by the account. This operation uses the `client.files.list` method. ```APIDOC ## GET /files/ ### Description Retrieves a list of all files. ### Method GET ### Endpoint /files/ ``` -------------------------------- ### Smart Upload from Remote URL Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Upload a file from a remote URL using the smart upload method. The `store: true` option ensures the file is stored. ```ruby remote_file = client.uploads.upload("https://example.com/image.jpg", store: true) ``` -------------------------------- ### Fetch Project Information Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Retrieves details about the current Uploadcare project, including its name, public key, and collaborators. ```ruby project = client.project.current puts project.name puts project.pub_key puts project.collaborators ``` -------------------------------- ### List Files with Uploadcare Ruby SDK Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Fetches a list of files from Uploadcare. Supports pagination and filtering by storage status and removal status. Use `files.next_page`, `files.previous_page`, or `files.all` for pagination. ```ruby files = client.files.list(limit: 100) files.each { |file| puts file.uuid } ``` ```ruby files.next_page files.previous_page files.all ``` ```ruby files = client.files.list(stored: true, removed: false, limit: 100) ``` -------------------------------- ### List Webhooks Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/api_examples/README.md Retrieves a list of all configured webhooks. This operation uses the `client.webhooks.list` method. ```APIDOC ## GET /webhooks/ ### Description Retrieves a list of all configured webhooks. ### Method GET ### Endpoint /webhooks/ ``` -------------------------------- ### Smart Upload File Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Upload a local file using the smart upload method. Accepts IO or file objects. The `store: true` option ensures the file is stored. ```ruby file = File.open("photo.jpg", "rb") do |io| client.uploads.upload(io, store: true) end ``` -------------------------------- ### POST /multipart/complete/ Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/api_examples/README.md Completes a multipart upload. ```APIDOC ## POST /multipart/complete/ ### Description Completes a multipart upload. ### Method POST ### Endpoint /multipart/complete/ ### Notes Completes a real multipart upload. ``` -------------------------------- ### List Webhooks via REST API Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Retrieves a list of configured webhooks. Requires the 'rest' client. ```ruby client.api.rest.webhooks.list ``` -------------------------------- ### Project Information Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Fetches details about the current Uploadcare project. ```APIDOC ## Project ### Description Fetches details about the current Uploadcare project. ### Method `client.project.current` ### Response Example ```ruby project = client.project.current puts project.name puts project.pub_key puts project.collaborators ``` ``` -------------------------------- ### Upload File from URL Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Initiates an asynchronous upload of a file from a given URL using the Upload API. Set 'async' to true for background processing. ```ruby client.api.upload.files.from_url(source_url: "https://example.com/image.jpg", async: true) ``` -------------------------------- ### Utilize Add-ons for File Processing Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Integrates with various add-ons like AWS Rekognition, ClamAV virus scanning, and background removal. Status of add-on executions can be checked using a request ID. ```ruby execution = client.addons.aws_rekognition_detect_labels(uuid: file.uuid) client.addons.aws_rekognition_detect_labels_status(request_id: execution.request_id) scan = client.addons.uc_clamav_virus_scan(uuid: file.uuid) client.addons.uc_clamav_virus_scan_status(request_id: scan.request_id) background = client.addons.remove_bg(uuid: file.uuid) client.addons.remove_bg_status(request_id: background.request_id) ``` -------------------------------- ### Upload Options Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Common options available for various upload methods. ```APIDOC ## Upload options Common upload options: - `store: true | false | "auto"` - `metadata: { key: value }` - `signature: "..."` - `expire: unix_timestamp` - `async: true` for URL uploads - `threads:` and `part_size:` for multipart uploads If you prefer the older top-level style, the same flows can still be written through the global client: ```ruby Uploadcare.configure do |config| config.public_key = ENV.fetch("UPLOADCARE_PUBLIC_KEY") config.secret_key = ENV.fetch("UPLOADCARE_SECRET_KEY") end file = File.open("photo.jpg", "rb") do |io| Uploadcare.files.upload(io, store: true) end ``` ``` -------------------------------- ### Upload from URL (Synchronous) Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Upload a file from a URL synchronously. ```APIDOC ## Upload from URL Synchronous: ```ruby file = client.files.upload_from_url("https://example.com/image.jpg", store: true) ``` ``` -------------------------------- ### Convert Document Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/api_examples/README.md Initiates a document conversion job. This operation uses the `client.conversions.documents.convert` method. ```APIDOC ## POST /convert/document/ ### Description Initiates a document conversion job. ### Method POST ### Endpoint /convert/document/ ``` -------------------------------- ### Smart Upload Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Upload files from IO objects, arrays of IO objects, or URL strings using the smart upload method. ```APIDOC ## Smart upload `client.uploads.upload` accepts: - an IO or file object - an array of IO or file objects - an HTTP or HTTPS URL string ```ruby file = File.open("photo.jpg", "rb") do |io| client.uploads.upload(io, store: true) end remote_file = client.uploads.upload("https://example.com/image.jpg", store: true) ``` ``` -------------------------------- ### Multipart Upload with Progress Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Perform a multipart upload for large files, with options for threads and progress tracking. A block is used to report upload progress. ```ruby File.open("large-video.mp4", "rb") do |io| file = client.uploads.multipart_upload(file: io, store: true, threads: 4) do |progress| uploaded = progress[:uploaded] total = progress[:total] puts "#{uploaded}/#{total}" end puts file.uuid end ``` -------------------------------- ### Multi-Account Usage Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Manage multiple Uploadcare projects within the same process by creating separate client instances. ```APIDOC ## Multi-Account Usage The gem is designed to support multiple Uploadcare projects in the same process: ```ruby primary = Uploadcare::Client.new(public_key: "pk-1", secret_key: "sk-1") secondary = Uploadcare::Client.new(public_key: "pk-2", secret_key: "sk-2") primary_file = primary.files.find(uuid: "uuid-1") secondary_file = secondary.files.find(uuid: "uuid-2") ``` You can also derive temporary variants from an existing client: ```ruby admin_client = primary.with(secret_key: "different-secret") ``` ``` -------------------------------- ### Execute AWS Rekognition Detect Labels Addon Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/api_examples/README.md Executes the AWS Rekognition Detect Labels addon. This operation uses the `client.addons.aws_rekognition_detect_labels` method. ```APIDOC ## POST /addons/aws_rekognition_detect_labels/execute/ ### Description Executes the AWS Rekognition Detect Labels addon. ### Method POST ### Endpoint /addons/aws_rekognition_detect_labels/execute/ ``` -------------------------------- ### Perform Resource Operations on Files Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Performs individual resource operations on a file, such as storing, deleting, or reloading. Reloading can include additional parameters like `include: "appdata"`. ```ruby file.store file.delete file.reload ``` ```ruby file.reload(params: { include: "appdata" }) ``` -------------------------------- ### Manage File Metadata Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Provides functionality to update, show, index, and delete metadata associated with files. Metadata is managed using a key-value pair system. ```ruby client.file_metadata.update(uuid: file.uuid, key: "category", value: "avatar") client.file_metadata.show(uuid: file.uuid, key: "category") client.file_metadata.index(uuid: file.uuid) client.file_metadata.delete(uuid: file.uuid, key: "category") ``` -------------------------------- ### Upload from URL (Asynchronous) Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Upload a file from a URL asynchronously and retrieve the job status. ```APIDOC Async: ```ruby job = client.uploads.upload_from_url(url: "https://example.com/image.jpg", async: true, store: true) status = client.uploads.upload_from_url_status(token: job.fetch("token")) ``` When async mode is enabled, the convenience layer returns the raw status token hash because the file does not exist yet. Polling options for synchronous URL uploads: - `poll_interval` (default: `1`) initial status polling interval in seconds - `poll_max_interval` (default: `10`) maximum polling interval in seconds - `poll_timeout` (default: `300`) maximum total polling time in seconds ``` -------------------------------- ### Signed Uploads (Global) Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Enable signed uploads globally for all subsequent upload requests. ```APIDOC ## Signed uploads You can enable signed uploads globally: ```ruby client = Uploadcare::Client.new( public_key: "public", secret_key: "secret", sign_uploads: true ) ``` ``` -------------------------------- ### Derive Temporary Client Variants Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Derive temporary client variants from an existing client, useful for making requests with different credentials or configurations without affecting the original client. ```ruby admin_client = primary.with(secret_key: "different-secret") ``` -------------------------------- ### Execute AWS Rekognition Detect Moderation Labels Addon Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/api_examples/README.md Executes the AWS Rekognition Detect Moderation Labels addon. This operation uses the `client.addons.aws_rekognition_detect_moderation_labels` method. ```APIDOC ## POST /addons/aws_rekognition_detect_moderation_labels/execute/ ### Description Executes the AWS Rekognition Detect Moderation Labels addon. ### Method POST ### Endpoint /addons/aws_rekognition_detect_moderation_labels/execute/ ``` -------------------------------- ### Multipart Upload with Progress Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Perform multipart uploads for large files and track progress. ```APIDOC ## Multipart upload with progress ```ruby File.open("large-video.mp4", "rb") do |io| file = client.uploads.multipart_upload(file: io, store: true, threads: 4) do |progress| uploaded = progress[:uploaded] total = progress[:total] puts "#{uploaded}/#{total}" end puts file.uuid end ``` ``` -------------------------------- ### Direct File Upload Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Uploads a file directly from a local file path using the Upload API. The 'store' option determines if the file is stored. ```ruby File.open("photo.jpg", "rb") do |io| client.api.upload.files.direct(file: io, store: true) end ``` -------------------------------- ### Multiple File Upload Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Upload multiple local files simultaneously. Ensure all file handles are closed after the upload. ```ruby files = [ File.open("photo-1.jpg", "rb"), File.open("photo-2.jpg", "rb") ] uploaded = client.uploads.upload(files, store: true) files.each(&:close) ``` -------------------------------- ### Find a File Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Retrieve a file by its UUID. ```APIDOC ## Files ### Find a file ```ruby file = client.files.find(uuid: "file-uuid") ``` ``` -------------------------------- ### PUT Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/api_examples/README.md Uploads a part of a multipart upload using a presigned URL. ```APIDOC ## PUT ### Description Uploads a part of a multipart upload using a presigned URL. ### Method PUT ### Endpoint ### Notes Uploads one part via gem multipart helper. ``` -------------------------------- ### Batch Store Files Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/api_examples/README.md Stores multiple files in a batch operation. This operation uses the `client.files.batch_store` method. ```APIDOC ## PUT /files/storage/ ### Description Stores multiple files in a batch operation. ### Method PUT ### Endpoint /files/storage/ ``` -------------------------------- ### Add-on Integrations Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Integrates with various add-ons like AWS Rekognition, ClamAV, and remove.bg. ```APIDOC ## Add-ons ### Description Integrates with various add-ons for enhanced processing. ### Methods - `client.addons.aws_rekognition_detect_labels(uuid: file.uuid)`: Detects labels using AWS Rekognition. - `client.addons.aws_rekognition_detect_labels_status(request_id: execution.request_id)`: Checks the status of the AWS Rekognition job. - `client.addons.uc_clamav_virus_scan(uuid: file.uuid)`: Scans files for viruses using ClamAV. - `client.addons.uc_clamav_virus_scan_status(request_id: scan.request_id)`: Checks the status of the ClamAV scan. - `client.addons.remove_bg(uuid: file.uuid)`: Removes the background from an image. - `client.addons.remove_bg_status(request_id: background.request_id)`: Checks the status of the background removal job. ### Request Example ```ruby execution = client.addons.aws_rekognition_detect_labels(uuid: file.uuid) scan = client.addons.uc_clamav_virus_scan(uuid: file.uuid) background = client.addons.remove_bg(uuid: file.uuid) ``` ### Response These methods return `Uploadcare::AddonExecution` resources. ``` -------------------------------- ### Copy Operations Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Copies files to local storage or to a remote target. ```APIDOC ## Copy Operations ### Description Copies files to local storage or to a remote target. ### Methods - `client.files.copy_to_local(source: file.uuid, options: { store: true })`: Copies a file to local storage. - `client.files.copy_to_remote(source: file.uuid, target: "custom_storage")`: Copies a file to a remote storage. - `file.copy_to_local(options: { store: true })`: Instance-level copy to local. - `file.copy_to_remote(target: "custom_storage")`: Instance-level copy to remote. ### Request Example ```ruby copied = client.files.copy_to_local(source: file.uuid, options: { store: true }) remote_url = client.files.copy_to_remote(source: file.uuid, target: "custom_storage") ``` ``` -------------------------------- ### Configure Uploadcare Defaults Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Set process-wide defaults for the Uploadcare gem using a block configuration. This is useful for setting global API keys and other settings. ```ruby Uploadcare.configure do |config| config.public_key = "public_key" config.secret_key = "secret_key" config.auth_type = "Uploadcare" config.use_subdomains = false end ``` -------------------------------- ### Create Group of Files Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Creates a group containing specified files by their UUIDs using the Upload API. ```ruby client.api.upload.groups.create(files: ["uuid-1", "uuid-2"]) ``` -------------------------------- ### Signed Uploads (Per Request) Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Provide explicit signature data for individual upload requests. ```APIDOC Or pass explicit signature data per request: ```ruby File.open("photo.jpg", "rb") do |io| client.files.upload(io, signature: "signature", expire: 1_900_000_000) end ``` ``` -------------------------------- ### Store File Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/api_examples/README.md Stores a specific file, making it permanent. This operation uses the `file.store` method. ```APIDOC ## PUT /files/{uuid}/storage/ ### Description Stores a specific file. ### Method PUT ### Endpoint /files/{uuid}/storage/ ### Parameters #### Path Parameters - **uuid** (string) - Required - The unique identifier of the file to store. ``` -------------------------------- ### Copy Files to Local or Remote Storage Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Copies files either to local storage or to a specified remote storage target. Instance-level variants are also available for direct file object operations. ```ruby copied = client.files.copy_to_local(source: file.uuid, options: { store: true }) remote_url = client.files.copy_to_remote(source: file.uuid, target: "custom_storage") ``` ```ruby copied = file.copy_to_local(options: { store: true }) remote_url = file.copy_to_remote(target: "custom_storage") ``` -------------------------------- ### Handle Uploadcare API Errors Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Demonstrates how to handle various Uploadcare exceptions, such as `NotFoundError` and `RequestError`. The raw API layer returns `Uploadcare::Result` objects, which have `success?` and error handling methods. ```ruby begin client.files.find(uuid: "missing") rescue Uploadcare::Exception::NotFoundError => e warn e.message end ``` ```ruby result = client.api.rest.files.info(uuid: "file-uuid") if result.success? puts result.success else warn result.error_message end ``` -------------------------------- ### Execute Remove BG Addon Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/api_examples/README.md Executes the Remove BG addon. This operation uses the `client.addons.remove_bg` method. ```APIDOC ## POST /addons/remove_bg/execute/ ### Description Executes the Remove BG addon. ### Method POST ### Endpoint /addons/remove_bg/execute/ ``` -------------------------------- ### Video Conversions Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Handles video conversion tasks, including converting and checking status. ```APIDOC ## Conversions - Videos ### Description Handles video conversion tasks. ### Methods - `client.conversions.videos.convert(uuid: file.uuid, format: :webm, quality: :normal)`: Converts a video to a specified format and quality. - `client.conversions.videos.status(token: job.result.first.fetch("token"))`: Checks the status of a video conversion job. ### Request Example ```ruby job = client.conversions.videos.convert(uuid: file.uuid, format: :webm, quality: :normal) status = client.conversions.videos.status(token: job.result.first.fetch("token")) ``` ### Response The `convert` method returns a `Uploadcare::VideoConversion` resource. ``` -------------------------------- ### Generate Signed URLs for Secure Delivery Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Generates signed URLs for secure content delivery using Akamai. Supports custom ACLs and wildcard matching for URL generation. ```ruby generator = Uploadcare::SignedUrlGenerators::AkamaiGenerator.new( cdn_host: "example.com", secret_key: "your_hex_encoded_akamai_secret" ) signed_url = generator.generate_url("a7d5645e-5cd7-4046-819f-a6a2933bafe3") ``` ```ruby generator.generate_url("a7d5645e-5cd7-4046-819f-a6a2933bafe3", "/*") generator.generate_url("a7d5645e-5cd7-4046-819f-a6a2933bafe3", wildcard: true) ``` -------------------------------- ### Single File Upload Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Upload a single file with optional metadata. ```APIDOC ## Single file upload ```ruby file = File.open("photo.jpg", "rb") do |io| client.files.upload(io, store: true, metadata: { subsystem: "avatars" }) end ``` ``` -------------------------------- ### Execute UC ClamAV Virus Scan Addon Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/api_examples/README.md Executes the UC ClamAV Virus Scan addon. This operation uses the `client.addons.uc_clamav_virus_scan` method. ```APIDOC ## POST /addons/uc_clamav_virus_scan/execute/ ### Description Executes the UC ClamAV Virus Scan addon. ### Method POST ### Endpoint /addons/uc_clamav_virus_scan/execute/ ``` -------------------------------- ### Secure Delivery URL Generation Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Generates signed URLs for secure delivery of files using Akamai. ```APIDOC ## Secure Delivery ### Description Generates signed URLs for secure delivery workflows. ### Usage Instantiate `Uploadcare::SignedUrlGenerators::AkamaiGenerator` with CDN host and secret key. ### Methods - `generator.generate_url(file_uuid, path_or_options)`: Generates a signed URL for a file. ### Request Example ```ruby generator = Uploadcare::SignedUrlGenerators::AkamaiGenerator.new( cdn_host: "example.com", secret_key: "your_hex_encoded_akamai_secret" ) signed_url = generator.generate_url("a7d5645e-5cd7-4046-819f-a6a2933bafe3") # With custom ACL and wildcard generator.generate_url("a7d5645e-5cd7-4046-819f-a6a2933bafe3", "/*") generator.generate_url("a7d5645e-5cd7-4046-819f-a6a2933bafe3", wildcard: true) ``` ``` -------------------------------- ### Request Options Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Allows passing custom options to the HTTP layer for specific requests, such as setting timeouts. ```APIDOC ## Request Options ### Description Allows passing custom options to the HTTP layer for per-request configuration. ### Usage Use the `request_options:` parameter in API calls. ### Example ```ruby client.files.find(uuid: "file-uuid", request_options: { timeout: 10 }) ``` ``` -------------------------------- ### Set Request Options for API Calls Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Allows specifying per-request options, such as timeout, to be passed to the HTTP layer. This is useful for fine-grained control over request behavior without altering the client's default configuration. ```ruby client.files.find(uuid: "file-uuid", request_options: { timeout: 10 }) ``` -------------------------------- ### Error Handling Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Details on exceptions raised by the client and the structure of raw API results. ```APIDOC ## Errors and Results ### Description Provides information on error handling and result structures. ### Exceptions The convenience layer raises the following exceptions: - `Uploadcare::Exception::RequestError` - `Uploadcare::Exception::InvalidRequestError` - `Uploadcare::Exception::NotFoundError` - `Uploadcare::Exception::UploadError` - `Uploadcare::Exception::MultipartUploadError` - `Uploadcare::Exception::UploadTimeoutError` - `Uploadcare::Exception::ThrottleError` ### Example (Exception Handling) ```ruby begin client.files.find(uuid: "missing") rescue Uploadcare::Exception::NotFoundError => e warn e.message end ``` ### Raw API Results The raw API layer returns `Uploadcare::Result` objects. ### Example (Raw API Result) ```ruby result = client.api.rest.files.info(uuid: "file-uuid") if result.success? puts result.success else warn result.error_message end ``` ``` -------------------------------- ### Multiple File Upload Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Upload multiple files simultaneously. ```APIDOC ## Multiple file upload ```ruby files = [ File.open("photo-1.jpg", "rb"), File.open("photo-2.jpg", "rb") ] uploaded = client.uploads.upload(files, store: true) files.each(&:close) ``` ``` -------------------------------- ### List Groups Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/api_examples/README.md Retrieves a list of all groups. This operation uses the `client.groups.list` method. ```APIDOC ## GET /groups/ ### Description Retrieves a list of all groups. ### Method GET ### Endpoint /groups/ ``` -------------------------------- ### Batch Operations Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Performs batch operations like storing or deleting multiple files using their UUIDs. ```APIDOC ## Batch Operations ### Description Performs batch operations on multiple files using their UUIDs. ### Methods - `client.files.batch_store(uuids: [...])`: Stores multiple files. - `client.files.batch_delete(uuids: [...])`: Deletes multiple files. ### Request Example ```ruby result = client.files.batch_store(uuids: ["uuid-1", "uuid-2"]) ``` ### Response Returns a result object with status, results, and problems. ### Response Example ```ruby puts result.status puts result.result.map(&:uuid) puts result.problems ``` ``` -------------------------------- ### Find File Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/api_examples/README.md Retrieves details for a specific file using its UUID. This operation uses the `client.files.find` method. ```APIDOC ## GET /files/{uuid}/ ### Description Retrieves details for a specific file. ### Method GET ### Endpoint /files/{uuid}/ ### Parameters #### Path Parameters - **uuid** (string) - Required - The unique identifier of the file to retrieve. ``` -------------------------------- ### Batch Operations for Files Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Executes batch operations like storing or deleting multiple files using their UUIDs. Returns a result object with status, processed items, and any problems encountered. ```ruby result = client.files.batch_store(uuids: ["uuid-1", "uuid-2"]) puts result.status puts result.result.map(&:uuid) puts result.problems ``` ```ruby client.files.batch_delete ``` -------------------------------- ### Group Operations Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Manages groups of files, including creation, finding, listing, and deletion. ```APIDOC ## Groups ### Description Manages groups of files. ### Methods - `client.groups.create(uuids: [...])`: Creates a new group with specified file UUIDs. - `client.groups.find(group_id: "group-uuid~2")`: Finds a specific group by its ID. - `client.groups.list(limit: 50)`: Lists available groups with a limit. - `group.delete`: Deletes a group. - `group.cdn_url`: Gets the CDN URL for the group. - `group.file_cdn_urls`: Gets CDN URLs for all files within the group. ### Request Example ```ruby group = client.groups.create(uuids: ["uuid-1", "uuid-2"]) group = client.groups.find(group_id: "group-uuid~2") groups = client.groups.list(limit: 50) group.delete ``` ``` -------------------------------- ### Webhook Management Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Manages webhooks for receiving event notifications from Uploadcare. ```APIDOC ## Webhooks ### Description Manages webhooks for receiving event notifications. ### Methods - `client.webhooks.create(...)`: Creates a new webhook. - `client.webhooks.list`: Lists existing webhooks. - `client.webhooks.update(id: webhook.id, is_active: false)`: Updates an existing webhook. - `client.webhooks.delete(target_url: webhook.target_url)`: Deletes a webhook. ### Request Example ```ruby webhook = client.webhooks.create( target_url: "https://example.com/uploadcare", event: "file.uploaded", is_active: true ) client.webhooks.list client.webhooks.update(id: webhook.id, is_active: false) client.webhooks.delete(target_url: webhook.target_url) ``` ``` -------------------------------- ### Copy File to Remote Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/api_examples/README.md Copies a file to a remote storage location. Requires `UPLOADCARE_REMOTE_STORAGE` to be configured. This operation uses the `client.files.copy_to_remote` method. ```APIDOC ## POST /files/remote_copy/ ### Description Copies a file to a remote storage location. ### Method POST ### Endpoint /files/remote_copy/ ### Notes Requires `UPLOADCARE_REMOTE_STORAGE` to be configured. ``` -------------------------------- ### Find a File by UUID Source: https://github.com/uploadcare/uploadcare-ruby/blob/main/README.md Retrieve a file object by its unique identifier (UUID). This is a common operation for accessing previously uploaded files. ```ruby file = client.files.find(uuid: "file-uuid") ```