Class: Weibo2::Interface::Trends

Inherits:
Base
  • Object
show all
Defined in:
lib/weibo2/interface/trends.rb

Overview

Trends API

Instance Method Summary collapse

Methods inherited from Base

#get, #initialize, #post, #request

Constructor Details

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

Instance Method Details

#daily(opts = {}) ⇒ Object

返回最近一天内的热门话题

Parameters:

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

Options Hash (opts):

  • :base_app (int)

    是否只获取当前应用的数据。0为否(所有数据),1为是(仅当前应用),默认为0

See Also:



46
47
48
# File 'lib/weibo2/interface/trends.rb', line 46

def daily(opts={})
  get 'trends/daily.json', :params => opts
end

#destroy(trend_id) ⇒ Object

8485304 no pass 取消对某话题的关注

Parameters:

  • trend_id (int64)

    要取消关注的话题ID

See Also:



78
79
80
# File 'lib/weibo2/interface/trends.rb', line 78

def destroy(trend_id)
  post 'trends/destroy.json', :body => {:trend_id => trend_id}
end

#follow(trend_name) ⇒ Object

关注某话题

Parameters:

  • trend_name (String)

    要关注的话题关键词

See Also:



68
69
70
# File 'lib/weibo2/interface/trends.rb', line 68

def follow(trend_name)
  post 'trends/follow.json', :body => {:trend_name => trend_name}
end

#hourly(opts = {}) ⇒ Object

返回最近一小时内的热门话题

Parameters:

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

Options Hash (opts):

  • :base_app (int)

    是否只获取当前应用的数据。0为否(所有数据),1为是(仅当前应用),默认为0

See Also:



36
37
38
# File 'lib/weibo2/interface/trends.rb', line 36

def hourly(opts={})
  get 'trends/hourly.json', :params => opts
end

#is_follow(trend_name) ⇒ Object

判断当前用户是否关注某话题

Parameters:

  • trend_name (String)

    话题关键字

See Also:



26
27
28
# File 'lib/weibo2/interface/trends.rb', line 26

def is_follow(trend_name)
  get 'trends/is_follow.json', :params => {:trend_name => trend_name}
end

获取某人的话题列表

Parameters:

  • uid (int64)

    需要获取话题的用户的UID

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

Options Hash (opts):

  • :count (int)

    单页返回的记录条数,默认为10

  • :page (int)

    返回结果的页码,默认为1

See Also:



17
18
19
# File 'lib/weibo2/interface/trends.rb', line 17

def trends(uid, opts={})
  get 'trends.json', :params => {:uid => uid}.merge(opts)
end

#weekly(opts = {}) ⇒ Object

返回最近一周内的热门话题

Parameters:

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

Options Hash (opts):

  • :base_app (int)

    是否只获取当前应用的数据。0为否(所有数据),1为是(仅当前应用),默认为0

See Also:



56
57
58
# File 'lib/weibo2/interface/trends.rb', line 56

def weekly(opts={})
  get 'trends/weekly.json', :params => opts
end