Class: Putio::Client

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/putio/client.rb

Instance Method Summary collapse

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

#filesObject



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,options={})
  options.merge! @auth
  response = self.class.get(endpoint,options).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(options)
end