Sha256: cb1e969a02982686cde27e63f552d58e96dfe83e1de7a3bafe5bdd2e8b2edd4f

Contents?: true

Size: 1.3 KB

Versions: 12

Compression:

Stored size: 1.3 KB

Contents

# frozen_string_literal: true

require_relative 'rest_client'

module Uploadcare
  module Client
    # API client for handling single metadata_files
    # @see https://uploadcare.com/docs/file-metadata/
    # @see https://uploadcare.com/api-refs/rest-api/v0.7.0/#tag/File-metadata
    class FileMetadataClient < RestClient
      # Get file's metadata keys and values
      # @see https://uploadcare.com/api-refs/rest-api/v0.7.0/#operation/fileMetadata
      def index(uuid)
        get(uri: "/files/#{uuid}/metadata/")
      end

      # Get the value of a single metadata key.
      # @see https://uploadcare.com/api-refs/rest-api/v0.7.0/#operation/fileMetadataKey
      def show(uuid, key)
        get(uri: "/files/#{uuid}/metadata/#{key}/")
      end

      # Update the value of a single metadata key. If the key does not exist, it will be created.
      # @see https://uploadcare.com/api-refs/rest-api/v0.7.0/#operation/updateFileMetadataKey
      def update(uuid, key, value)
        put(uri: "/files/#{uuid}/metadata/#{key}/", content: value.to_json)
      end

      # Delete a file's metadata key.
      # @see https://uploadcare.com/api-refs/rest-api/v0.7.0/#operation/deleteFileMetadataKey
      def delete(uuid, key)
        request(method: 'DELETE', uri: "/files/#{uuid}/metadata/#{key}/")
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
uploadcare-ruby-4.4.3 lib/uploadcare/client/file_metadata_client.rb
uploadcare-ruby-4.4.2 lib/uploadcare/client/file_metadata_client.rb
uploadcare-ruby-4.4.1 lib/uploadcare/client/file_metadata_client.rb
uploadcare-ruby-4.4.0 lib/uploadcare/client/file_metadata_client.rb
uploadcare-ruby-4.3.6 lib/uploadcare/client/file_metadata_client.rb
uploadcare-ruby-4.3.5 lib/uploadcare/client/file_metadata_client.rb
uploadcare-ruby-4.3.4 lib/uploadcare/client/file_metadata_client.rb
uploadcare-ruby-4.3.3 lib/uploadcare/client/file_metadata_client.rb
uploadcare-ruby-4.3.2 lib/uploadcare/client/file_metadata_client.rb
uploadcare-ruby-4.3.1 lib/uploadcare/client/file_metadata_client.rb
uploadcare-ruby-4.3.0 lib/uploadcare/client/file_metadata_client.rb
uploadcare-ruby-4.2.0 lib/uploadcare/client/file_metadata_client.rb