Class: Renren2::Interface::Users

Inherits:
Base
  • Object
show all
Defined in:
lib/renren2/interface/users.rb

Overview

Users API

Instance Method Summary collapse

Methods inherited from Base

#check_scope, #get, #initialize, #post, #request

Constructor Details

This class inherits a constructor from Renren2::Interface::Base

Instance Method Details

#get_info(opts = {}) ⇒ Object

获取用户的信息

Parameters:

  • opts (Hash) (defaults to: {})

Options Hash (opts):

  • :uids (String)

    需要查询的用户的ID,多个ID用逗号隔开。当此参数为空时,返回当前用户

  • :fields (String)

    返回的字段列表,可以指定返回那些字段,用逗号分隔

See Also:



17
18
19
# File 'lib/renren2/interface/users.rb', line 17

def get_info(opts={})
  post 'users.getInfo', :body => opts
end

#get_logged_in_userObject

得到当前session的用户ID



24
25
26
# File 'lib/renren2/interface/users.rb', line 24

def get_logged_in_user
  post 'users.getLoggedInUser'
end

#get_profile_info(uid, opts = {}) ⇒ Object

获取用户个人主页的信息,包括日志数、好友数、相册数、个人基本资料等

Parameters:

  • uid (int)

    个人主页用户的ID

  • opts (Hash) (defaults to: {})

Options Hash (opts):

  • :fields (String)

    需要获取的信息的字段列表,各个字段用逗号隔开

See Also:



44
45
46
# File 'lib/renren2/interface/users.rb', line 44

def get_profile_info(uid, opts={})
  post 'users.getProfileInfo', :body => {:uid => uid}.merge(opts)
end

#get_visitors(opts = {}) ⇒ Object

获得当前用户最近来访的列表

Parameters:

  • opts (Hash) (defaults to: {})

Options Hash (opts):

  • :page (int)

    支持分页,指定页号,页号从1开始

  • :count (int)

    支持分页,指定每页记录数,缺省值为6

See Also:



55
56
57
# File 'lib/renren2/interface/users.rb', line 55

def get_visitors(opts={})
  post 'users.getVisitors', :body => opts
end

#has_app_permission(ext_perm) ⇒ Object

检查用户是否授予应用扩展权限

Parameters:

  • ext_perm (String)

    用户可操作的扩展授权,例如email

See Also:



33
34
35
# File 'lib/renren2/interface/users.rb', line 33

def has_app_permission(ext_perm)
  post 'users.hasAppPermission', :body => {:ext_perm => ext_perm}
end