Skip to content

Commit 59376d9

Browse files
committed
add update custom metadata field method
1 parent 5790e2c commit 59376d9

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib/imagekitio/client.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,14 @@ def create_custom_metadata_fields(name, label, schema)
152152
@file.create_custom_metadata(name, label, schema)
153153
end
154154

155-
def get_custom_metadata(options = {})
155+
def get_custom_metadata_fields(options = {})
156156
@file.get_custom_metadata(options)
157157
end
158158

159+
def update_custom_metadata_fields(id, label, schema)
160+
@file.update_custom_metadata(id, label, schema)
161+
end
162+
159163
def phash_distance(first, second)
160164
# Get hamming distance between two phash(image hash) to check
161165
# similarity between images

lib/imagekitio/file.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,12 @@ def get_custom_metadata(options)
232232
@req_obj.request('get', url, @req_obj.create_headers, payload)
233233
end
234234

235+
def update_custom_metadata(id, label, schema)
236+
url = "#{constants.API_BASE_URL}/customMetadataFields/#{id}"
237+
payload = { 'label': label, 'schema': schema }
238+
@req_obj.request('patch', url, @req_obj.create_headers, payload)
239+
end
240+
235241
def validate_upload_options(options)
236242

237243
# Validates upload value, checks if params are valid,

0 commit comments

Comments
 (0)