Module: Twitter::Profile
Constant Summary collapse
- PROFILE_IMAGE_SUFFIX_REGEX =
/_normal(\.gif|\.jpe?g|\.png)$/i
- PREDICATE_URI_METHOD_REGEX =
/_uri\?$/
Instance Method Summary collapse
-
#profile_banner_uri(size = :web) ⇒ Addressable::URI
(also: #profile_banner_url)
Return the URL to the user's profile banner image.
- #profile_banner_uri? ⇒ Boolean
-
#profile_banner_uri_https(size = :web) ⇒ Addressable::URI
(also: #profile_banner_url_https)
Return the secure URL to the user's profile banner image.
-
#profile_image_uri(size = :normal) ⇒ Addressable::URI
(also: #profile_image_url)
Return the URL to the user's profile image.
- #profile_image_uri? ⇒ Boolean
-
#profile_image_uri_https(size = :normal) ⇒ Addressable::URI
(also: #profile_image_url_https)
Return the secure URL to the user's profile image.
Instance Method Details
#profile_banner_uri(size = :web) ⇒ Addressable::URI Also known as:
Return the URL to the user's profile banner image
29 30 31 |
# File 'lib/twitter/profile.rb', line 29 def (size = :web) parse_uri(insecure_uri([@attrs[:profile_banner_url], size].join("/"))) unless @attrs[:profile_banner_url].nil? end |
#profile_banner_uri? ⇒ Boolean
44 45 46 |
# File 'lib/twitter/profile.rb', line 44 def !!@attrs[:profile_banner_url] end |
#profile_banner_uri_https(size = :web) ⇒ Addressable::URI Also known as:
Return the secure URL to the user's profile banner image
38 39 40 |
# File 'lib/twitter/profile.rb', line 38 def (size = :web) parse_uri([@attrs[:profile_banner_url], size].join("/")) unless @attrs[:profile_banner_url].nil? end |
#profile_image_uri(size = :normal) ⇒ Addressable::URI Also known as: profile_image_url
Return the URL to the user's profile image
54 55 56 |
# File 'lib/twitter/profile.rb', line 54 def profile_image_uri(size = :normal) parse_uri(insecure_uri(profile_image_uri_https(size))) unless @attrs[:profile_image_url_https].nil? end |
#profile_image_uri? ⇒ Boolean
75 76 77 |
# File 'lib/twitter/profile.rb', line 75 def profile_image_uri? !!@attrs[:profile_image_url_https] end |
#profile_image_uri_https(size = :normal) ⇒ Addressable::URI Also known as: profile_image_url_https
Return the secure URL to the user's profile image
63 64 65 66 67 68 69 70 71 |
# File 'lib/twitter/profile.rb', line 63 def profile_image_uri_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 parse_uri(@attrs[:profile_image_url_https].sub(PROFILE_IMAGE_SUFFIX_REGEX, profile_image_suffix(size))) unless @attrs[:profile_image_url_https].nil? end |