Sha256: 0cc3f37db549e6d1c4779318c4f6f41c141f8060be7af8a54ef97737628125e5

Contents?: true

Size: 478 Bytes

Versions: 5

Compression:

Stored size: 478 Bytes

Contents

require "social_avatar_proxy/avatar"

module SocialAvatarProxy
  class TwitterAvatar < Avatar
    def remote_url
      if identifier =~ /^\d+$/
        "http://api.twitter.com/1/users/profile_image?user_id=#{identifier}&size=original"
      elsif identifier =~ /^[\w\-\.]+$/i
        "http://api.twitter.com/1/users/profile_image?screen_name=#{identifier}&size=original"
      else
        raise RuntimeError, "Identifier contains invalid characters"
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
social-avatar-proxy-0.0.5 lib/social_avatar_proxy/twitter_avatar.rb
social-avatar-proxy-0.0.4 lib/social_avatar_proxy/twitter_avatar.rb
social-avatar-proxy-0.0.3 lib/social_avatar_proxy/twitter_avatar.rb
social-avatar-proxy-0.0.2 lib/social_avatar_proxy/twitter_avatar.rb
social-avatar-proxy-0.0.1 lib/social_avatar_proxy/twitter_avatar.rb