Class: TwitPhoto::Adaptors::ImglyAdaptor
- Inherits:
-
Object
- Object
- TwitPhoto::Adaptors::ImglyAdaptor
- Defined in:
- lib/adaptors.rb
Class Method Summary collapse
-
.domains ⇒ Object
check for “yfrog.” (no domain since yfrog supports many domains).
- .getImageUrl(url) ⇒ Object
Class Method Details
.domains ⇒ Object
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 |