Skip to content

Commit 9b2238f

Browse files
committed
add job status method
1 parent 0e21f3c commit 9b2238f

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

lib/imagekitio/client.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,10 @@ def move_folder(source_folder_path, destination_path)
144144
@file.move_folder(source_folder_path, destination_path)
145145
end
146146

147+
def bulk_job_status(job_id)
148+
@file.job_status(job_id)
149+
end
150+
147151
def phash_distance(first, second)
148152
# Get hamming distance between two phash(image hash) to check
149153
# similarity between images

lib/imagekitio/file.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,20 @@ def move_folder(source_folder_path, destination_path)
200200
if source_folder_path == '' || source_folder_path.nil? || destination_path == '' || destination_path.nil?
201201
raise ArgumentError, 'parameters required'
202202
end
203-
url = "#{constants.BULK_BASE_URL}/moveFolderr"
203+
url = "#{constants.BULK_BASE_URL}/moveFolder"
204204
payload = { 'sourceFolderPath': source_folder_path, 'destinationPath': destination_path }
205205
@req_obj.request('post', url, @req_obj.create_headers, payload)
206206
end
207207

208+
def job_status(id)
209+
if id == '' || id.nil?
210+
raise ArgumentError, 'job id is required'
211+
end
212+
url = "#{constants.BULK_BASE_URL}/#{id}"
213+
payload = { 'jobId': id }
214+
@req_obj.request('get', url, @req_obj.create_headers, payload)
215+
end
216+
208217
def validate_upload_options(options)
209218

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

0 commit comments

Comments
 (0)