README.md in rapidshare-ext-0.0.5 vs README.md in rapidshare-ext-0.0.6

- old
+ new

@@ -26,11 +26,11 @@ api = Rapidshare::API.new(:cookie => 'cookie_here') # More preferable way ``` ### Files -Now you can perform file download in two ways: by the HTTP url or by the absolute path. +Now you can perform file downloading in two ways: by HTTP url or by absolute path. First, by the HTTP url, as it has worked before: ```ruby @rs.download "https://rapidshare.com/files/4226120320/upload_file_1.txt", :downloads_dir => "/tmp", @@ -39,19 +39,19 @@ # With a default local file name @rs.download "https://rapidshare.com/files/4226120320/upload_file_1.txt", :downloads_dir => "/tmp" ``` -Download by absolute path: +Download by absolute path from account you owned: ```ruby @rs.download "/foo/bar/baz/upload_file_1.txt", :downloads_dir => "/tmp" ``` In both the first and second samples the result will be the same. -File uploading became very simple now: +File uploading is also became very simple: ```ruby api.upload("/home/odiszapc/my_damn_cat.mov", :to => "/gallery/video", :as => "cat1.mov") # => { # :id => 1, # :size => 12345, # File size in bytes @@ -66,15 +66,37 @@ ```ruby result = api.upload("/home/odiszapc/my_damn_cat.mov", :to => "/gallery/video", :as => "cat1.mov") result[:url] ``` -By default, file is uploaded to the root folder: +By default, file is uploaded into the root folder: ```ruby api.upload("/home/odiszapc/my_damn_humster.mov") ``` +Rapidshare allows to store multiple files having equal names under the same folder. I believe this behaviour is absolutely wrong. +Therefore, each time upload performed it checks if the file with the given name already exists in a folder. +If it's true, the upload() just returns info about the existing file with the :already_exists? flag is set to true without any real upload being performed. +To force file being overwritten set the :overwrite parameter to true: + +```ruby +api.upload "/home/odiszapc/my_damn_cat.mov", + :to => "/gallery/video", + :as => "cat1.mov" + +# No upload will be performed +api.upload "/home/odiszapc/my_damn_cat.mov", + :to => "/gallery/video", + :as => "cat1.mov" + +# With the following notation file will be uploaded with overwriting the existing one +api.upload "/home/odiszapc/my_damn_cat.mov", + :to => "/gallery/video", + :as => "cat1.mov", + :overwrite => true +``` + Deleting files: ```ruby api.remove_file("/putin/is/a/good/reason/to/live/abroad/ticket_to_Nicaragua.jpg") ``` @@ -93,13 +115,13 @@ ```ruby api.file_id("/foo/bar/baz.rar") # => <ID> ``` ### Folders -As you note you can have a hierarchy of folders in your account. +As you note it's possible having a hierarchy of folders in your account. -Creating folders: +Creating folder hierarchy: ```ruby folder_id = api.add_folder "a/b/c" # => <FOLDER ID> ``` Deleting folders: @@ -109,13 +131,13 @@ Moving folders: ```ruby api.move_folder("/a/b/c", :to => "/a") ``` -This moves folder "c" from directory "/a/b/" and places it under the directory "/a" +This moves the folder "c" from the directory "/a/b/" and places it under the directory "/a" -Get the hierarchy of all folders in account: +You can get hierarchy of all the folders in account: ```ruby api.folders_hierarchy # => { # <folder ID> => { # :parent => <parent folder ID>, @@ -157,24 +179,24 @@ As mentioned earlier, the Rapidshare has its common problem: the chance of orphan folders to be appeared. What does it mean? When you delete parent folder by its ID the folder will be deleted without any of its child folders being deleted. For example, let we have the basic directory tree: ``` ROOT -`-a <- RS API allows us to delete JUST THIS folder, so hierarchy relation between folders will be lost and the folders "c" and "b" will become orphans +`-a <- Raw Rapidshare API allows you to delete JUST THIS folder, so hierarchy relation between folders will be lost and the folders "c" and "b" will became orphans `-b `-c ``` -My know-how: orphan folders become invisible in your File Manager on the Rapidshare web site, so you may want to hide all the data in this way (stupid idea) +**Know-how:** orphan folders become invisible in your File Manager on the Rapidshare web site, so you may want to hide all the data in this way (stupid idea) -So, the best way to delete some directory tree without washing away its consistency is the following: +So, the best way to delete a directory tree without washing away consistency of account folder hierarchy is the following: ```ruby -api.remove_folder "/a" # This will correctly delete all child directories +api.remove_folder "/a" # This will delete all the child directories correctly ``` -But if you already have orphans in your account there is possible to fix them. -The next method detects all orphan folders in your account and moves them into a specific folder: +However, if you already have orphans in your account there is possible to fix them. +So ,the next method detects all orphan folders in your account and moves them into a specific folder: ```ruby api.move_orphans :to => "/" ``` Or we can just delete all of them (be careful): @@ -186,10 +208,10 @@ You can null your account by deleting all the data stored inside: ```ruby api.erase_all_data! ``` -**Be careful with it, because all you lose all your data** +**Be careful with it, because you stake losing all your data** ## Contributing 1. Fork it 2. Create your feature branch (`git checkout -b my-new-feature`) \ No newline at end of file