Class: Putio::Client
Instance Method Summary collapse
- #files ⇒ Object
- #get_endpoint(endpoint, options = {}) ⇒ Object
-
#initialize(user_token) ⇒ Client
constructor
A new instance of Client.
- #search(options) ⇒ Object
Constructor Details
#initialize(user_token) ⇒ Client
Returns a new instance of Client.
6 7 8 9 |
# File 'lib/putio/client.rb', line 6 def initialize(user_token) @auth = {:query =>{:oauth_token=> user_token},:headers => {"Accept:" => "application/json"}} @options = {} end |
Instance Method Details
#files ⇒ Object
11 12 13 |
# File 'lib/putio/client.rb', line 11 def files get_endpoint("/files/list")["files"] end |
#get_endpoint(endpoint, options = {}) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/putio/client.rb', line 17 def get_endpoint(endpoint,={}) .merge! @auth response = self.class.get(endpoint,).parsed_response if response["status"] == "ERROR" raise AuthError else return response end end |
#search(options) ⇒ Object
14 15 |
# File 'lib/putio/client.rb', line 14 def search() end |