class Wykop::Operations::User
Public Class Methods
new(client)
click to toggle source
Documentation: www.wykop.pl/dla-programistow/dokumentacja/#info6_7
# File lib/wykop/operations/user.rb, line 5 def initialize(client) @client = client @request = Wykop::Operations::Request.new(@client) end
Public Instance Methods
favorites()
click to toggle source
# File lib/wykop/operations/user.rb, line 28 def favorites() # Listing favourites for current user return @request.execute(@request.replace_url({:banana => 'user', :potato => 'favorites'}), Hash.new) end
info(what = nil)
click to toggle source
# File lib/wykop/operations/user.rb, line 19 def info(what = nil) # Getting information about user account if what == nil return @client.user_info else return @client.user_info[what] end end
login()
click to toggle source
# File lib/wykop/operations/user.rb, line 10 def login # Opening new connection to wykop API. It returns configuration hash and all the client information @client.user_info = login_request if @client.user_info.nil? return false end return true end
observed()
click to toggle source
# File lib/wykop/operations/user.rb, line 33 def observed() # Listing observed for current user return @request.execute(@request.replace_url({:banana => 'user', :potato => 'observed'}), Hash.new) end
Private Instance Methods
login_request(params = nil)
click to toggle source
Needs to be here, at least till i figure out where to put it
# File lib/wykop/operations/user.rb, line 47 def login_request(params = nil) # Building request URL q_body = {'login' => @client.configuration.app_username, 'accountkey' => @client.configuration.app_generated_key} q_url = "#{@client.configuration.api_host}/user/login/appkey,#{@client.configuration.app_user_key}" @request.execute(q_url, q_body) end