Class: TwitPhoto::Adaptors::TwitPicAdaptor

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

Class Method Summary collapse

Class Method Details

.domainsObject



39
40
41
# File 'lib/adaptors.rb', line 39

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

.getImageUrl(url) ⇒ Object



43
44
45
46
47
48
49
50
51
# File 'lib/adaptors.rb', line 43

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://twitpic.com/show/large" + id
end