Class: SocialOauthApi::Weibo::User
- Inherits:
-
Base
- Object
- Base
- SocialOauthApi::Weibo::User
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
Instance Method Details
#default_query ⇒ Object
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_url ⇒ Object
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_name ⇒ Object
Also known as:
name
22
23
24
|
# File 'lib/social_oauth_api/weibo.rb', line 22
def screen_name
show['screen_name']
end
|
#show ⇒ Object
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
|
#uid ⇒ Object
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
|