Method: CloudFS::Item#move
- Defined in:
- lib/cloudfs/item.rb
#move(destination, name: nil, exists: 'RENAME') ⇒ Item
Note:
Updates this item and it's reference is returned.
Note:
Locally changed properties get discarded
Move this item to destination folder
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
# File 'lib/cloudfs/item.rb', line 235
def move(destination, name: nil, exists: 'RENAME')
FileSystemCommon.validate_item_state(self)
FileSystemCommon.validate_item_state(destination)
destination_url = FileSystemCommon.get_folder_url(destination)
name ||= @name
if @type == 'folder'
response = @rest_adapter.move_folder(
@url,
destination_url,
name,
exists: exists)
else
response = @rest_adapter.move_file(
@url,
destination_url,
name,
exists: exists)
end
# Overwrite this item's properties with Moved Item's properties
set_item_properties(parent: destination_url, ** response)
self
end
|