Class: SocialOauthApi::Weibo::User

Inherits:
Base
  • Object
show all
Defined in:
lib/social_oauth_api/weibo.rb

Constant Summary collapse

UID_URL =
'https://api.weibo.com/2/account/get_uid.json'
SHOW_URL =
'https://api.weibo.com/2/users/show.json'

Instance Attribute Summary

Attributes inherited from Base

#access_token, #client_id, #client_secret

Instance Method Summary collapse

Methods inherited from Base

#get, #initialize

Constructor Details

This class inherits a constructor from SocialOauthApi::Base

Instance Method Details

#default_queryObject



9
10
11
# File 'lib/social_oauth_api/weibo.rb', line 9

def default_query
  { source: client_id, access_token: access_token }
end

#profile_image_urlObject Also known as: image_url



26
27
28
# File 'lib/social_oauth_api/weibo.rb', line 26

def profile_image_url
  show['profile_image_url']
end

#screen_nameObject Also known as: name



22
23
24
# File 'lib/social_oauth_api/weibo.rb', line 22

def screen_name
  show['screen_name']
end

#showObject Also known as: user_info



18
19
20
# File 'lib/social_oauth_api/weibo.rb', line 18

def show
  @user_info ||= JSON.parse(get(SHOW_URL, default_query.merge(uid: uid)))
end

#uidObject Also known as: id



13
14
15
16
# File 'lib/social_oauth_api/weibo.rb', line 13

def uid
  @uid ||= JSON.parse(get(UID_URL, default_query))
  @uid['uid'].to_s
end