Class: Uploadcare::Client::FileMetadataClient
- Inherits:
-
RestClient
- Object
- ApiStruct::Client
- RestClient
- Uploadcare::Client::FileMetadataClient
- Defined in:
- lib/uploadcare/client/file_metadata_client.rb
Overview
API client for handling single metadata_files
Instance Method Summary collapse
-
#delete(uuid, key) ⇒ Object
Delete a file's metadata key.
-
#index(uuid) ⇒ Object
Get file's metadata keys and values.
-
#show(uuid, key) ⇒ Object
Get the value of a single metadata key.
-
#update(uuid, key, value) ⇒ Object
Update the value of a single metadata key.
Methods inherited from RestClient
#api_root, #api_struct_delete, #api_struct_get, #api_struct_post, #api_struct_put, #get, #headers, #post, #put, #request
Methods included from Uploadcare::Concerns::ThrottleHandler
Methods included from Uploadcare::Concerns::ErrorHandler
Instance Method Details
#delete(uuid, key) ⇒ Object
Delete a file's metadata key.
31 32 33 |
# File 'lib/uploadcare/client/file_metadata_client.rb', line 31 def delete(uuid, key) request(method: 'DELETE', uri: "/files/#{uuid}/metadata/#{key}/") end |
#index(uuid) ⇒ Object
Get file's metadata keys and values
13 14 15 |
# File 'lib/uploadcare/client/file_metadata_client.rb', line 13 def index(uuid) get(uri: "/files/#{uuid}/metadata/") end |
#show(uuid, key) ⇒ Object
Get the value of a single metadata key.
19 20 21 |
# File 'lib/uploadcare/client/file_metadata_client.rb', line 19 def show(uuid, key) get(uri: "/files/#{uuid}/metadata/#{key}/") end |
#update(uuid, key, value) ⇒ Object
Update the value of a single metadata key. If the key does not exist, it will be created.
25 26 27 |
# File 'lib/uploadcare/client/file_metadata_client.rb', line 25 def update(uuid, key, value) put(uri: "/files/#{uuid}/metadata/#{key}/", content: value.to_json) end |