lib/twitter/profile.rb in twitter-5.15.0 vs lib/twitter/profile.rb in twitter-5.16.0

- old
+ new

@@ -24,22 +24,22 @@ # Return the URL to the user's profile banner image # # @param size [String, Symbol] The size of the image. Must be one of: 'mobile', 'mobile_retina', 'web', 'web_retina', 'ipad', or 'ipad_retina' # @return [Addressable::URI] def profile_banner_uri(size = :web) - parse_encoded_uri(insecure_uri([@attrs[:profile_banner_url], size].join('/'))) unless @attrs[:profile_banner_url].nil? + parse_uri(insecure_uri([@attrs[:profile_banner_url], size].join('/'))) unless @attrs[:profile_banner_url].nil? end - alias_method :profile_banner_url, :profile_banner_uri + alias profile_banner_url profile_banner_uri # Return the secure URL to the user's profile banner image # # @param size [String, Symbol] The size of the image. Must be one of: 'mobile', 'mobile_retina', 'web', 'web_retina', 'ipad', or 'ipad_retina' # @return [Addressable::URI] def profile_banner_uri_https(size = :web) - parse_encoded_uri([@attrs[:profile_banner_url], size].join('/')) unless @attrs[:profile_banner_url].nil? + parse_uri([@attrs[:profile_banner_url], size].join('/')) unless @attrs[:profile_banner_url].nil? end - alias_method :profile_banner_url_https, :profile_banner_uri_https + alias profile_banner_url_https profile_banner_uri_https # @return [Boolean] def profile_banner_uri? !!@attrs[:profile_banner_url] end @@ -49,13 +49,13 @@ # Return the URL to the user's profile image # # @param size [String, Symbol] The size of the image. Must be one of: 'mini', 'normal', 'bigger' or 'original' # @return [Addressable::URI] def profile_image_uri(size = :normal) - parse_encoded_uri(insecure_uri(profile_image_uri_https(size))) unless @attrs[:profile_image_url_https].nil? + parse_uri(insecure_uri(profile_image_uri_https(size))) unless @attrs[:profile_image_url_https].nil? end - alias_method :profile_image_url, :profile_image_uri + alias profile_image_url profile_image_uri # Return the secure URL to the user's profile image # # @param size [String, Symbol] The size of the image. Must be one of: 'mini', 'normal', 'bigger' or 'original' # @return [Addressable::URI] @@ -64,24 +64,24 @@ # 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_encoded_uri(@attrs[:profile_image_url_https].sub(PROFILE_IMAGE_SUFFIX_REGEX, profile_image_suffix(size))) unless @attrs[:profile_image_url_https].nil? + parse_uri(@attrs[:profile_image_url_https].sub(PROFILE_IMAGE_SUFFIX_REGEX, profile_image_suffix(size))) unless @attrs[:profile_image_url_https].nil? end - alias_method :profile_image_url_https, :profile_image_uri_https + alias profile_image_url_https profile_image_uri_https # @return [Boolean] def profile_image_uri? !!@attrs[:profile_image_url_https] end memoize :profile_image_uri? alias_predicate_uri_methods :profile_image_uri? private - def parse_encoded_uri(uri) - Addressable::URI.parse(URI.encode(uri)) + def parse_uri(uri) + Addressable::URI.parse(uri) end def insecure_uri(uri) uri.to_s.sub(/^https/i, 'http') end