Class: TwitPhoto::Adaptors::ImglyAdaptor

Inherits:
Object
  • Object
show all
Defined in:
lib/adaptors.rb

Class Method Summary collapse

Class Method Details

.domainsObject

check for “yfrog.” (no domain since yfrog supports many domains)



91
92
93
# File 'lib/adaptors.rb', line 91

def self.domains
  %w(http://img.ly)
end

.getImageUrl(url) ⇒ Object



95
96
97
98
99
100
101
102
103
104
# File 'lib/adaptors.rb', line 95

def self.getImageUrl url
    domain = self.domains.select { |d| url.to_s.start_with?(d) }
    return nil if domain.empty?

    uri = URI.parse(url)
    id = uri.path.split('/').last

    # Must end with /
    return "http://img.ly/show/full/" + id + "/"
end