Class: Twitter::User
- Inherits:
- BasicUser show all
- Includes:
- Creatable, Exceptable
- Defined in:
- lib/twitter/user.rb
Constant Summary
- PROFILE_IMAGE_SUFFIX_REGEX =
/_normal(\.gif|\.jpe?g|\.png)$/
Instance Attribute Summary (collapse)
-
- (Object) connections
readonly
Returns the value of attribute connections.
-
- (Object) contributors_enabled
readonly
Returns the value of attribute contributors_enabled.
-
- (Object) default_profile
readonly
Returns the value of attribute default_profile.
-
- (Object) default_profile_image
readonly
Returns the value of attribute default_profile_image.
-
- (Object) description
readonly
Returns the value of attribute description.
-
- (Object) favourites_count
(also: #favorite_count, #favoriters_count, #favorites_count, #favourite_count, #favouriters_count)
readonly
Returns the value of attribute favourites_count.
-
- (Object) follow_request_sent
readonly
Returns the value of attribute follow_request_sent.
-
- (Object) followers_count
(also: #follower_count)
readonly
Returns the value of attribute followers_count.
-
- (Object) friends_count
(also: #friend_count)
readonly
Returns the value of attribute friends_count.
-
- (Object) geo_enabled
readonly
Returns the value of attribute geo_enabled.
-
- (Object) is_translator
(also: #translator)
readonly
Returns the value of attribute is_translator.
-
- (Object) lang
readonly
Returns the value of attribute lang.
-
- (Object) listed_count
readonly
Returns the value of attribute listed_count.
-
- (Object) location
readonly
Returns the value of attribute location.
-
- (Object) name
readonly
Returns the value of attribute name.
-
- (Object) notifications
readonly
Returns the value of attribute notifications.
-
- (Object) profile_background_color
readonly
Returns the value of attribute profile_background_color.
-
- (Object) profile_background_image_url
readonly
Returns the value of attribute profile_background_image_url.
-
- (Object) profile_background_image_url_https
readonly
Returns the value of attribute profile_background_image_url_https.
-
- (Object) profile_background_tile
readonly
Returns the value of attribute profile_background_tile.
-
- (Object) profile_link_color
readonly
Returns the value of attribute profile_link_color.
-
- (Object) profile_sidebar_border_color
readonly
Returns the value of attribute profile_sidebar_border_color.
-
- (Object) profile_sidebar_fill_color
readonly
Returns the value of attribute profile_sidebar_fill_color.
-
- (Object) profile_text_color
readonly
Returns the value of attribute profile_text_color.
-
- (Object) profile_use_background_image
readonly
Returns the value of attribute profile_use_background_image.
-
- (Object) protected
readonly
Returns the value of attribute protected.
-
- (Object) statuses_count
(also: #status_count, #tweet_count, #tweets_count, #update_count, #updates_count)
readonly
Returns the value of attribute statuses_count.
-
- (Object) time_zone
readonly
Returns the value of attribute time_zone.
-
- (Object) url
readonly
Returns the value of attribute url.
-
- (Object) utc_offset
readonly
Returns the value of attribute utc_offset.
-
- (Object) verified
readonly
Returns the value of attribute verified.
Attributes inherited from BasicUser
Instance Method Summary (collapse)
- - (Array<Twitter::Entity::Url>) description_urls
-
- (String) profile_banner_url(size = :web)
Return the URL to the user's profile banner image.
- - (Boolean) profile_banner_url? (also: #profile_banner_url_https?)
-
- (String) profile_banner_url_https(size = :web)
Return the secure URL to the user's profile banner image.
-
- (String) profile_image_url(size = :normal)
Return the URL to the user's profile image.
- - (Boolean) profile_image_url? (also: #profile_image_url_https?)
-
- (String) profile_image_url_https(size = :normal)
Return the secure URL to the user's profile image.
- - (Twitter::Tweet) status
- - (Boolean) status?
Methods included from Creatable
Methods inherited from Identity
#==, fetch, #id, #initialize, store
Methods inherited from Base
#[], #attr_equal, attr_reader, #attrs, #attrs_equal, fetch, fetch_or_new, from_response, identity_map, #initialize, store, #update
Constructor Details
This class inherits a constructor from Twitter::Identity
Instance Attribute Details
- (Object) connections (readonly)
Returns the value of attribute connections
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def connections @connections end |
- (Object) contributors_enabled (readonly)
Returns the value of attribute contributors_enabled
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def contributors_enabled @contributors_enabled end |
- (Object) default_profile (readonly)
Returns the value of attribute default_profile
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def default_profile @default_profile end |
- (Object) default_profile_image (readonly)
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 |
- (Object) description (readonly)
Returns the value of attribute description
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def description @description end |
- (Object) favourites_count (readonly) Also known as: favorite_count, favoriters_count, favorites_count, favourite_count, favouriters_count
Returns the value of attribute favourites_count
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def favourites_count @favourites_count end |
- (Object) follow_request_sent (readonly)
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 |
- (Object) followers_count (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 |
- (Object) friends_count (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 |
- (Object) geo_enabled (readonly)
Returns the value of attribute geo_enabled
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def geo_enabled @geo_enabled end |
- (Object) is_translator (readonly) Also known as: translator
Returns the value of attribute is_translator
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def is_translator @is_translator end |
- (Object) lang (readonly)
Returns the value of attribute lang
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def lang @lang end |
- (Object) listed_count (readonly)
Returns the value of attribute listed_count
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def listed_count @listed_count end |
- (Object) location (readonly)
Returns the value of attribute location
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def location @location end |
- (Object) name (readonly)
Returns the value of attribute name
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def name @name end |
- (Object) notifications (readonly)
Returns the value of attribute notifications
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def notifications @notifications end |
- (Object) profile_background_color (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 |
- (Object) profile_background_image_url (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 |
- (Object) profile_background_image_url_https (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 |
- (Object) profile_background_tile (readonly)
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 |
- (Object) profile_link_color (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 |
- (Object) profile_sidebar_border_color (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 |
- (Object) profile_sidebar_fill_color (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 |
- (Object) profile_text_color (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 |
- (Object) profile_use_background_image (readonly)
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 |
- (Object) protected (readonly)
Returns the value of attribute protected
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def protected @protected end |
- (Object) statuses_count (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 |
- (Object) time_zone (readonly)
Returns the value of attribute time_zone
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def time_zone @time_zone end |
- (Object) url (readonly)
Returns the value of attribute url
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def url @url end |
- (Object) utc_offset (readonly)
Returns the value of attribute utc_offset
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def utc_offset @utc_offset end |
- (Object) verified (readonly)
Returns the value of attribute verified
10 11 12 |
# File 'lib/twitter/user.rb', line 10 def verified @verified end |
Instance Method Details
- (Array<Twitter::Entity::Url>) description_urls
36 37 38 39 40 |
# File 'lib/twitter/user.rb', line 36 def description_urls @description_urls ||= Array(@attrs[:entities][:description][:urls]).map do |entity| Twitter::Entity::Url.fetch_or_new(entity) end end |
- (String) profile_banner_url(size = :web)
Return the URL to the user's profile banner image
46 47 48 |
# File 'lib/twitter/user.rb', line 46 def (size=:web) insecure_url([@attrs[:profile_banner_url], size].join('/')) if end |
- (Boolean) profile_banner_url? Also known as:
58 59 60 |
# File 'lib/twitter/user.rb', line 58 def !@attrs[:profile_banner_url].nil? end |
- (String) profile_banner_url_https(size = :web)
Return the secure URL to the user's profile banner image
54 55 56 |
# File 'lib/twitter/user.rb', line 54 def (size=:web) [@attrs[:profile_banner_url], size].join('/') if end |
- (String) profile_image_url(size = :normal)
Return the URL to the user's profile image
67 68 69 |
# File 'lib/twitter/user.rb', line 67 def profile_image_url(size=:normal) insecure_url(profile_image_url_https(size)) if profile_image_url? end |
- (Boolean) profile_image_url? Also known as: profile_image_url_https?
85 86 87 |
# File 'lib/twitter/user.rb', line 85 def profile_image_url? !@attrs[:profile_image_url_https].nil? end |
- (String) profile_image_url_https(size = :normal)
Return the secure URL to the user's profile image
75 76 77 78 79 80 81 82 83 |
# File 'lib/twitter/user.rb', line 75 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) if profile_image_url? end |
- (Twitter::Tweet) status
91 92 93 |
# File 'lib/twitter/user.rb', line 91 def status @status ||= fetch_or_new_without_self(Twitter::Tweet, @attrs, :status, :user) end |
- (Boolean) status?
95 96 97 |
# File 'lib/twitter/user.rb', line 95 def status? !@attrs[:status].nil? end |