class Pcloud::Client
Attributes
auth_token[RW]
password[W]
username[W]
Public Class Methods
new(options = {})
click to toggle source
# File lib/pcloud/client.rb, line 11 def initialize(options = {}) @username, @password = options.values_at(:username, :password) @auth_token = options[:auth_token] end
Public Instance Methods
authenticate(options = {})
click to toggle source
# File lib/pcloud/client.rb, line 32 def authenticate(options = {}) @auth_token = authorize(options)['auth'] self end
file()
click to toggle source
# File lib/pcloud/client.rb, line 24 def file @file ||= FileHandler.new(self) end
get(path, params={})
click to toggle source
# File lib/pcloud/client.rb, line 16 def get(path, params={}) request(:get, path, params) end
http_client()
click to toggle source
# File lib/pcloud/client.rb, line 28 def http_client @http_client ||= RestClient::Resource.new(BASE_URL) end
post(path, payload={}, params={})
click to toggle source
# File lib/pcloud/client.rb, line 20 def post(path, payload={}, params={}) request(:post, path, params, payload) end
request(verb, path, params, payload = {})
click to toggle source
# File lib/pcloud/client.rb, line 37 def request(verb, path, params, payload = {}) Pcloud::Request.call(self, verb, path, params, payload) end
Private Instance Methods
digest_data(text)
click to toggle source
# File lib/pcloud/client.rb, line 58 def digest_data text Digest::SHA1.hexdigest(text) end