Class: WeiboApi::User
- Inherits:
-
Object
- Object
- WeiboApi::User
- Includes:
- Endpoint
- Defined in:
- lib/weibo_api/user.rb
Constant Summary
Constants included from Endpoint
Instance Method Summary collapse
- #custom_request(path, options = {}) ⇒ Object
-
#info(options = {}) ⇒ Object
Return the authenticating user’s personnal infos or the one specified on the options (uid).
-
#initialize(access_token, uid) ⇒ User
constructor
A new instance of User.
-
#show_status(id) ⇒ Object
Return the single weibo’s content by its ID.
-
#statistics(options = {}) ⇒ Object
Return the authenticating user’s followers statistics.
-
#timeline(options = {}) ⇒ Object
Return the authenticating user’s latest weibos.
Constructor Details
#initialize(access_token, uid) ⇒ User
Returns a new instance of User.
5 6 7 8 |
# File 'lib/weibo_api/user.rb', line 5 def initialize(access_token, uid) @access_token = access_token @uid = uid end |
Instance Method Details
#custom_request(path, options = {}) ⇒ Object
35 36 37 38 |
# File 'lib/weibo_api/user.rb', line 35 def custom_request(path, = {}) params = .merge(access_token: @access_token) { |_, important, _| important } make_request resource_path(path, params), {} end |
#info(options = {}) ⇒ Object
Return the authenticating user’s personnal infos or the one specified on the options (uid).
11 12 13 14 |
# File 'lib/weibo_api/user.rb', line 11 def info( = {}) params = .merge(access_token: @access_token, uid: @uid) { |_, important, _| important } make_request resource_path('users/show', params), {} end |
#show_status(id) ⇒ Object
Return the single weibo’s content by its ID
30 31 32 33 |
# File 'lib/weibo_api/user.rb', line 30 def show_status(id) params = { access_token: @access_token, id: id } make_request resource_path('statuses/show', params), {} end |
#statistics(options = {}) ⇒ Object
Return the authenticating user’s followers statistics.
- WIP
18 19 20 21 |
# File 'lib/weibo_api/user.rb', line 18 def statistics( = {}) params = .merge(access_token: @access_token, uid: @uid) { |_, important, _| important } make_request resource_path('friendships/followers', params), {} end |
#timeline(options = {}) ⇒ Object
Return the authenticating user’s latest weibos.
24 25 26 27 |
# File 'lib/weibo_api/user.rb', line 24 def timeline( = {}) params = .merge(access_token: @access_token, trim_user: 1) { |_, important, _| important } make_request resource_path('statuses/user_timeline', params), {} end |