Skip to content

Commit c17947d

Browse files
committed
add move file method
1 parent 2ea48ef commit c17947d

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

lib/imagekitio/client.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ def copy_file(source_file_path, destination_path)
120120
@file.copy(source_file_path, destination_path)
121121
end
122122

123+
def move_file(source_file_path, destination_path)
124+
@file.move(source_file_path, destination_path)
125+
end
126+
123127
def phash_distance(first, second)
124128
# Get hamming distance between two phash(image hash) to check
125129
# similarity between images

lib/imagekitio/file.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,12 @@ def copy(source_file_path, destination_path)
148148
@req_obj.request('post', url, @req_obj.create_headers, payload)
149149
end
150150

151+
def move(source_file_path, destination_path)
152+
url = "#{constants.BASE_URL}/move"
153+
payload = { 'sourceFilePath': source_file_path, 'destinationPath': destination_path }
154+
@req_obj.request('post', url, @req_obj.create_headers, payload)
155+
end
156+
151157
def validate_upload_options(options)
152158

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

0 commit comments

Comments
 (0)