Class: TwitPhoto::Adaptors::InstagramAdaptor

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

Class Method Summary collapse

Class Method Details

.domainsObject



6
7
8
# File 'lib/adaptors.rb', line 6

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

.getImageUrl(url) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/adaptors.rb', line 10

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

  # ensure last char is '/'
  if url[url.length - 1] != "/"[0]
    url = url + "/"
  end

  return url + "media/?size=l"
end