Class: Renren2::Interface::Blog

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

Overview

Blog Interface

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_blog(title, content, opts = {}) ⇒ Object

Note:

require “publish_blog” scope

创建一篇日志

Parameters:

  • title (String)

    日志的标题

  • content (String)

    日志的内容

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

Options Hash (opts):

  • :visible (int)

    日志的隐私设置,可用值有99(所有人可见)1(仅好友可见)4(需要密码)-1(仅自己可见),错传或没传,默认为99

  • :password (String)

    用户设置的密码

See Also:



19
20
21
22
# File 'lib/renren2/interface/blog.rb', line 19

def add_blog(title, content, opts={})
  check_scope "publish_blog"
  post 'blog.addBlog', :body => {:title => title, :content => content}.merge(opts)
end

#add_comment(id, uid, content, opts = {}) ⇒ Object

Note:

require “publish_blog,publish_comment” scope

发布一个人人网日志的评论

Parameters:

  • id (String)

    日志id

  • uid (int64)

    日志所有者的ID或公共主页的ID

  • content (String)

    评论的内容

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

Options Hash (opts):

  • :rid (int)

    用于二级回复,被回复的人的用户ID

  • :type (int)

    是否为悄悄话,1表示悄悄话,0表示公开评论

See Also:



81
82
83
84
85
# File 'lib/renren2/interface/blog.rb', line 81

def add_comment(id, uid, content, opts={})
  check_scope "publish_blog"
  check_scope "publish_comment"
  post 'blog.addComment', :body => {:id => id, :uid => uid, :content => content}.merge(opts)
end

#get(id, uid, opts = {}) ⇒ Object

Note:

require “read_user_blog” scope

获取自己或好友一篇日志的信息

Parameters:

  • id (String)

    日志id

  • uid (int64)

    日志所有者的ID或公共主页的ID

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

Options Hash (opts):

  • :comment (int)

    返回评论内容,最大值为50,默认值0

  • :password (String)

    日志的密码(当日志有密码时

See Also:



48
49
50
51
# File 'lib/renren2/interface/blog.rb', line 48

def get(id, uid, opts={})
  check_scope "read_user_blog"
  post 'blog.get', :body => {:id => id, :uid => uid}.merge(opts)
end

#get_comments(id, uid, opts = {}) ⇒ Object

Note:

require “read_user_blog,read_user_comment” scope

获取一篇日志的评论

Parameters:

  • id (String)

    日志id

  • uid (int64)

    日志所有者的ID或公共主页的ID

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

Options Hash (opts):

  • :page (int)

    分页的页数,默认值为1

  • :count (int)

    每页所包含的评论数,默认值为20, 最大值为50

  • :order (int)

    排序方式。1:代表逆序;0:正序。默认值为0

See Also:



64
65
66
67
68
# File 'lib/renren2/interface/blog.rb', line 64

def get_comments(id, uid, opts={})
  check_scope "read_user_blog"
  check_scope "read_user_comment"
  post 'blog.getComments', :body => {:id => id, :uid => uid}.merge(opts)
end

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

Note:

require “read_user_blog” scope

获取指定用户的可见日志信息列表

Parameters:

  • uid (int64)

    用户的ID

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

Options Hash (opts):

  • :page (int)

    分页的页数,默认值为1

  • :count (int)

    每页显示的日志的数量, 缺省值为20

See Also:



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

def gets(uid, opts={})
  check_scope "read_user_blog"
  post 'blog.gets', :body => {:uid => uid}.merge(opts)
end