Class: ImageKitIo::ApiService::Folder
- Inherits:
-
Object
- Object
- ImageKitIo::ApiService::Folder
- Includes:
- Constantable
- Defined in:
- lib/imagekitio/api_service/folder.rb
Instance Method Summary collapse
- #copy(source_folder_path: nil, destination_path: nil, include_file_versions: false) ⇒ Object
- #create(folder_name: nil, parent_folder_path: nil) ⇒ Object
- #delete(folder_path: nil) ⇒ Object
-
#initialize(req_obj) ⇒ Folder
constructor
A new instance of Folder.
- #move(source_folder_path: nil, destination_path: nil) ⇒ Object
Methods included from Constantable
Constructor Details
#initialize(req_obj) ⇒ Folder
Returns a new instance of Folder.
8 9 10 |
# File 'lib/imagekitio/api_service/folder.rb', line 8 def initialize(req_obj) @req_obj = req_obj end |
Instance Method Details
#copy(source_folder_path: nil, destination_path: nil, include_file_versions: false) ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/imagekitio/api_service/folder.rb', line 30 def copy(source_folder_path: nil, destination_path: nil, include_file_versions: false) if source_folder_path == '' || source_folder_path.nil? || destination_path == '' || destination_path.nil? raise ArgumentError, 'Parameters required' end url = "#{constants.BULK_BASE_URL}/copyFolder" payload = { 'sourceFolderPath': source_folder_path, 'destinationPath': destination_path, 'includeFileVersions': include_file_versions }.to_json @req_obj.request('post', url, @req_obj.create_headers, payload) end |
#create(folder_name: nil, parent_folder_path: nil) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/imagekitio/api_service/folder.rb', line 12 def create(folder_name: nil, parent_folder_path: nil) if folder_name == '' || folder_name.nil? raise ArgumentError, 'folder_name is required' end url = "#{constants.API_BASE_URL}/folder" payload = { 'folderName': folder_name, 'parentFolderPath': parent_folder_path }.to_json @req_obj.request('post', url, @req_obj.create_headers, payload) end |
#delete(folder_path: nil) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/imagekitio/api_service/folder.rb', line 21 def delete(folder_path: nil) if folder_path == '' || folder_path.nil? raise ArgumentError, 'folder_path is required' end url = "#{constants.API_BASE_URL}/folder" payload = { 'folderPath': folder_path } @req_obj.request('delete', url, @req_obj.create_headers, payload) end |
#move(source_folder_path: nil, destination_path: nil) ⇒ Object
39 40 41 42 43 44 45 46 |
# File 'lib/imagekitio/api_service/folder.rb', line 39 def move(source_folder_path: nil, destination_path: nil) if source_folder_path == '' || source_folder_path.nil? || destination_path == '' || destination_path.nil? raise ArgumentError, 'Parameters required' end url = "#{constants.BULK_BASE_URL}/moveFolder" payload = { 'sourceFolderPath': source_folder_path, 'destinationPath': destination_path } @req_obj.request('post', url, @req_obj.create_headers, payload) end |