Class: Renren2::Interface::Status

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

Overview

Status API

Instance Method Summary collapse

Methods inherited from Base

#check_scope, #initialize, #post, #request

Constructor Details

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

Instance Method Details

#add_comment(owner_id, content, status_id, opts = {}) ⇒ Object

Note:

require “read_user_status,publish_comment” scope

no test 对一条状态增加一条回复

Parameters:

  • owner_id (int)

    状态所有者的id

  • content (String)

    回复的内容

  • status_id (int64)

    状态的id

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

Options Hash (opts):

  • :rid (int64)

    被回复的用户的ID,如果是直接回复某条状态,此参数不用传

See Also:



76
77
78
79
80
# File 'lib/renren2/interface/status.rb', line 76

def add_comment(owner_id, content, status_id, opts={})
  check_scope "read_user_status"
  check_scope "publish_comment"
  post 'status.addComment', :body => {:owner_id => owner_id, :content => content, :status_id => status_id}.merge(opts)
end

#forward(status, forward_id, forward_owner) ⇒ Object

Note:

require “status_update” scope

用户转发状态的操作,支持同时评论给转发人

Parameters:

  • status (String)

    用户更新的状态信息,与转发前的内容加在一起最多140个字符

  • forward_id (int64)

    被转发的状态id

  • forward_owner (int)

    被转发的状态所有者的id

See Also:



100
101
102
103
# File 'lib/renren2/interface/status.rb', line 100

def forward(status, forward_id, forward_owner)
  check_scope "status_update"
  post 'status.forward', :body => {:status => status, :forward_id => forward_id, :forward_owner => forward_owner}
end

#get(status_id, opts = {}) ⇒ Object

Note:

require “read_user_status” scope

返回用户某条状态,不包含回复内容

Parameters:

  • status_id (int64)

    状态的id,如果未指定状态id则返回当前用户最新的状态

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

Options Hash (opts):

  • :owner_id (int64)

    状态信息所属用户id,不指定则为当前用户

See Also:



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

def get(status_id, opts={})
  check_scope "read_user_status"
  post 'status.get', :body => {:status_id => status_id}.merge(opts)
end

#get_comment(status_id, owner_id, opts = {}) ⇒ Object

Note:

require “read_user_status” scope

获取一条状态中的所有最新回复内容

Parameters:

  • status_id (int64)

    状态的id

  • owner_id (int)

    状态所有者的id

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

Options Hash (opts):

  • :page (int)

    支持分页,指定页号,页号从1开始。缺省返回第一页数据

  • :count (int)

    支持分页,指定每页记录数,缺省为每页10条记录

  • :order (int)

    获取留言的排序规则,0表示升序(最旧到新),1表示降序(最新到旧),默认为0

See Also:



60
61
62
63
# File 'lib/renren2/interface/status.rb', line 60

def get_comment(status_id, owner_id, opts={})
  check_scope "read_user_status"
  post 'status.getComment', :body => {:status_id => status_id, :owner_id => owner_id}.merge(opts)
end

#get_emoticons(opts = {}) ⇒ Object

获取状态中的表情图片和表情符号对应列表

Parameters:

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

Options Hash (opts):

  • :type (String)

    获取列表的类型,type为all返回全部数据,type为recent返回网页同步数据,默认网页同步数据

See Also:



88
89
90
# File 'lib/renren2/interface/status.rb', line 88

def get_emoticons(opts={})
  post 'status.getEmoticons', :body => opts
end

#gets(opts = {}) ⇒ Object

Note:

require “read_user_status” scope

返回指定用户的状态列表,不包含回复内容。如果不指定用户,则获取当前用户的状态信息

Parameters:

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

Options Hash (opts):

  • :uid (int)

    状态信息所属用户id,不指定则判断为当前用户

  • :page (int)

    支持分页,指定页号,页号从1开始。缺省返回第一页数据

  • :count (int)

    支持分页,指定每页记录数,缺省为每页10条记录。最大不能超过1000

See Also:



18
19
20
21
# File 'lib/renren2/interface/status.rb', line 18

def gets(opts={})
  check_scope "read_user_status"
  post 'status.gets', :body => opts
end

#set(status, opts = {}) ⇒ Object

Note:

require “status_update” scope

用户更新状态

Parameters:

  • status (String)

    用户更新的状态信息,最多140个字符

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

Options Hash (opts):

  • :place_id (String)

    发状态时所在地点的ID

See Also:



31
32
33
34
# File 'lib/renren2/interface/status.rb', line 31

def set(status, opts={})
  check_scope "status_update"
  post 'status.set', :body => {:status => status}.merge(opts)
end