Class: Twitter::User
- Includes:
- Creatable
- Defined in:
- lib/twitter/user.rb
Constant Summary collapse
- PROFILE_IMAGE_SUFFIX_REGEX =
/_normal(\.gif|\.jpe?g|\.png)$/
Instance Attribute Summary collapse
-
#connections ⇒ Object
readonly
Returns the value of attribute connections.
-
#contributors_enabled ⇒ Object
(also: #contributors_enabled?)
readonly
Returns the value of attribute contributors_enabled.
-
#default_profile ⇒ Object
(also: #default_profile?)
readonly
Returns the value of attribute default_profile.
-
#default_profile_image ⇒ Object
(also: #default_profile_image?)
readonly
Returns the value of attribute default_profile_image.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#favourites_count ⇒ Object
(also: #favorite_count, #favorites_count, #favourite_count)
readonly
Returns the value of attribute favourites_count.
-
#follow_request_sent ⇒ Object
(also: #follow_request_sent?)
readonly
Returns the value of attribute follow_request_sent.
-
#followers_count ⇒ Object
(also: #follower_count)
readonly
Returns the value of attribute followers_count.
-
#friends_count ⇒ Object
(also: #friend_count)
readonly
Returns the value of attribute friends_count.
-
#geo_enabled ⇒ Object
(also: #geo_enabled?)
readonly
Returns the value of attribute geo_enabled.
-
#is_translator ⇒ Object
(also: #is_translator?, #translator, #translator?)
readonly
Returns the value of attribute is_translator.
-
#lang ⇒ Object
readonly
Returns the value of attribute lang.
-
#listed_count ⇒ Object
readonly
Returns the value of attribute listed_count.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#notifications ⇒ Object
(also: #notifications?)
readonly
Returns the value of attribute notifications.
-
#profile_background_color ⇒ Object
readonly
Returns the value of attribute profile_background_color.
-
#profile_background_image_url ⇒ Object
readonly
Returns the value of attribute profile_background_image_url.
-
#profile_background_image_url_https ⇒ Object
readonly
Returns the value of attribute profile_background_image_url_https.
-
#profile_background_tile ⇒ Object
(also: #profile_background_tile?)
readonly
Returns the value of attribute profile_background_tile.
-
#profile_link_color ⇒ Object
readonly
Returns the value of attribute profile_link_color.
-
#profile_sidebar_border_color ⇒ Object
readonly
Returns the value of attribute profile_sidebar_border_color.
-
#profile_sidebar_fill_color ⇒ Object
readonly
Returns the value of attribute profile_sidebar_fill_color.
-
#profile_text_color ⇒ Object
readonly
Returns the value of attribute profile_text_color.
-
#profile_use_background_image ⇒ Object
(also: #profile_use_background_image?)
readonly
Returns the value of attribute profile_use_background_image.
-
#protected ⇒ Object
(also: #protected?)
readonly
Returns the value of attribute protected.
-
#statuses_count ⇒ Object
(also: #status_count, #tweet_count, #tweets_count, #update_count, #updates_count)
readonly
Returns the value of attribute statuses_count.
-
#time_zone ⇒ Object
readonly
Returns the value of attribute time_zone.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
-
#utc_offset ⇒ Object
readonly
Returns the value of attribute utc_offset.
-
#verified ⇒ Object
(also: #verified?)
readonly
Returns the value of attribute verified.
Attributes inherited from BasicUser
Attributes inherited from Base
Instance Method Summary collapse
-
#profile_image_url(size = :normal) ⇒ String
Return the URL to the user’s profile image.
-
#profile_image_url_https(size = :normal) ⇒ String
Return the secure URL to the user’s profile image.
- #status ⇒ Twitter::Tweet
- #status? ⇒ Boolean
Methods included from Creatable
Methods inherited from Identity
#==, fetch, #id, #initialize, store
Methods inherited from Base
#[], attr_reader, fetch, fetch_or_new, from_response, identity_map, #initialize, store, #update
Constructor Details
This class inherits a constructor from Twitter::Identity
Instance Attribute Details
#connections ⇒ Object (readonly)
Returns the value of attribute connections.
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def connections @connections end |
#contributors_enabled ⇒ Object (readonly) Also known as: contributors_enabled?
Returns the value of attribute contributors_enabled.
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def contributors_enabled @contributors_enabled end |
#default_profile ⇒ Object (readonly) Also known as: default_profile?
Returns the value of attribute default_profile.
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def default_profile @default_profile end |
#default_profile_image ⇒ Object (readonly) Also known as: default_profile_image?
Returns the value of attribute default_profile_image.
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def default_profile_image @default_profile_image end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def description @description end |
#favourites_count ⇒ Object (readonly) Also known as: favorite_count, favorites_count, favourite_count
Returns the value of attribute favourites_count.
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def favourites_count @favourites_count end |
#follow_request_sent ⇒ Object (readonly) Also known as: follow_request_sent?
Returns the value of attribute follow_request_sent.
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def follow_request_sent @follow_request_sent end |
#followers_count ⇒ Object (readonly) Also known as: follower_count
Returns the value of attribute followers_count.
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def followers_count @followers_count end |
#friends_count ⇒ Object (readonly) Also known as: friend_count
Returns the value of attribute friends_count.
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def friends_count @friends_count end |
#geo_enabled ⇒ Object (readonly) Also known as: geo_enabled?
Returns the value of attribute geo_enabled.
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def geo_enabled @geo_enabled end |
#is_translator ⇒ Object (readonly) Also known as: is_translator?, translator, translator?
Returns the value of attribute is_translator.
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def is_translator @is_translator end |
#lang ⇒ Object (readonly)
Returns the value of attribute lang.
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def lang @lang end |
#listed_count ⇒ Object (readonly)
Returns the value of attribute listed_count.
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def listed_count @listed_count end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def location @location end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def name @name end |
#notifications ⇒ Object (readonly) Also known as: notifications?
Returns the value of attribute notifications.
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def notifications @notifications end |
#profile_background_color ⇒ Object (readonly)
Returns the value of attribute profile_background_color.
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def profile_background_color @profile_background_color end |
#profile_background_image_url ⇒ Object (readonly)
Returns the value of attribute profile_background_image_url.
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def profile_background_image_url @profile_background_image_url end |
#profile_background_image_url_https ⇒ Object (readonly)
Returns the value of attribute profile_background_image_url_https.
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def profile_background_image_url_https @profile_background_image_url_https end |
#profile_background_tile ⇒ Object (readonly) Also known as: profile_background_tile?
Returns the value of attribute profile_background_tile.
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def profile_background_tile @profile_background_tile end |
#profile_link_color ⇒ Object (readonly)
Returns the value of attribute profile_link_color.
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def profile_link_color @profile_link_color end |
#profile_sidebar_border_color ⇒ Object (readonly)
Returns the value of attribute profile_sidebar_border_color.
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def @profile_sidebar_border_color end |
#profile_sidebar_fill_color ⇒ Object (readonly)
Returns the value of attribute profile_sidebar_fill_color.
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def @profile_sidebar_fill_color end |
#profile_text_color ⇒ Object (readonly)
Returns the value of attribute profile_text_color.
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def profile_text_color @profile_text_color end |
#profile_use_background_image ⇒ Object (readonly) Also known as: profile_use_background_image?
Returns the value of attribute profile_use_background_image.
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def profile_use_background_image @profile_use_background_image end |
#protected ⇒ Object (readonly) Also known as: protected?
Returns the value of attribute protected.
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def protected @protected end |
#statuses_count ⇒ Object (readonly) Also known as: status_count, tweet_count, tweets_count, update_count, updates_count
Returns the value of attribute statuses_count.
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def statuses_count @statuses_count end |
#time_zone ⇒ Object (readonly)
Returns the value of attribute time_zone.
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def time_zone @time_zone end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def url @url end |
#utc_offset ⇒ Object (readonly)
Returns the value of attribute utc_offset.
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def utc_offset @utc_offset end |
#verified ⇒ Object (readonly) Also known as: verified?
Returns the value of attribute verified.
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def verified @verified end |
Instance Method Details
#profile_image_url(size = :normal) ⇒ String
Return the URL to the user’s profile image
48 49 50 51 52 53 54 55 56 |
# File 'lib/twitter/user.rb', line 48 def profile_image_url(size=:normal) # The profile image URL comes in looking like like this: # http://a0.twimg.com/profile_images/1759857427/image1326743606_normal.png # It can be converted to any of the following sizes: # http://a0.twimg.com/profile_images/1759857427/image1326743606.png # http://a0.twimg.com/profile_images/1759857427/image1326743606_mini.png # http://a0.twimg.com/profile_images/1759857427/image1326743606_bigger.png resize_profile_image_url(@attrs[:profile_image_url], size) end |
#profile_image_url_https(size = :normal) ⇒ String
Return the secure URL to the user’s profile image
62 63 64 65 66 67 68 69 70 |
# File 'lib/twitter/user.rb', line 62 def profile_image_url_https(size=:normal) # The profile image URL comes in looking like like this: # https://a0.twimg.com/profile_images/1759857427/image1326743606_normal.png # It can be converted to any of the following sizes: # https://a0.twimg.com/profile_images/1759857427/image1326743606.png # https://a0.twimg.com/profile_images/1759857427/image1326743606_mini.png # https://a0.twimg.com/profile_images/1759857427/image1326743606_bigger.png resize_profile_image_url(@attrs[:profile_image_url_https], size) end |
#status ⇒ Twitter::Tweet
73 74 75 |
# File 'lib/twitter/user.rb', line 73 def status @status ||= Twitter::Tweet.fetch_or_new(@attrs.dup[:status].merge(:user => @attrs.except(:status))) if status? end |
#status? ⇒ Boolean
77 78 79 |
# File 'lib/twitter/user.rb', line 77 def status? !@attrs[:status].nil? end |