Class: TwitPhoto::Adaptors::YFrogAdaptor

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)



56
57
58
# File 'lib/adaptors.rb', line 56

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

.getImageUrl(url) ⇒ Object



60
61
62
63
64
65
66
67
68
# File 'lib/adaptors.rb', line 60

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

    return "http://yfrog.com" + id + ":medium"
end