Description
Mar 04, 2008 mash up no.6 seeed - release rammstein - sonne i think its quite good, finally a new mash up after a month of doing nothin´ hope u like it to download this t.
This gem provides a wrapper for RapidShare API.
Full documentation of RapidShare API is available athttp://images.rapidshare.com/apidoc.txt
Installation
Usage
This example shows a simple script which downloads files from Rapidshare:
Login
Rapidshare gem is meant to be used mostly by premium users. In order to call Rapidshareservices as premium user, you need to log in first, using your login and password.
Alternatively you can use cookie parameter, which stores encrypted login andpassword parameters.
Best practice is to use cookie. You probably don't want to enter your Rapidsharepassword every time or have it stored in some config file on your hard drive.
How to get Rapidshare cookie
Rapidshare Services
Get Account Details
Check Files
Download File
Download workflow: file is checked by
API#check_files
method first. If itcan be downloaded, progress bar is shown for download and afterwards API
instance is returned with downloaded
attribute set to true. If the file isinvalid, API
instance is returned with downloaded
attribute set to (wait forit) false. (downloaded
attribute is also accessible by downloaded?
method.)Service Calls
All calls to Rapidshare services are done internally by
API#request
method:Syntax:
Example:
Use this method to call Rapidshare services which don't have dedicated methodsavailable.
Parser Parameter
API#request
method has an optional parameter :parser which specifies how toparse the response from Rapidshare. (Rapidshare doesn't unified API, there areseveral 'types' of responses.) Following options are supported at the moment:- :none - default, returns response body as it is
- :csv - parses response like CSV file into array of arrays
- :hash - parses response like a hash - key=value strings separated by newlines
Example:
PS: cookie is automatically added if you call request method on a
API
instance.Method Missing
Let's say you want to call service for which rapidshare gem doesn't havededicated method yet, for example: getrapidtranslogs . While you canexplicitly call
API#request
method:the cooler way is to make a service call using
API#method_missing
:If you call an uknown method on
API
instance, missing_method
assumesthat you want to make a service call to Rapidshare and invokes the request
method, using the missing method name as service name and passing any availableparams. For example:invokes
method_missing
also removes any underscores from the service name, so thesemethod calls are equivalent:PS: This is used for aliasing dedicated methods as well:
rs.get_account_details
invokes rs.getaccountdetails
. In this case the corresponding dedicatedmethod is called instead of low-level request
method, because we check forexistense of dedicated method first.Examples
In examples directory you will other examples of usingRapidshare gem. Among other things there are scripts which can serve as simpledownload clients.
License
Copyright (c) 2009-2011 Tomasz Mazur, Lukas Stejskal