Class: SnipSnap::Flickr
- Inherits:
-
Object
- Object
- SnipSnap::Flickr
- Includes:
- Client
- Defined in:
- lib/snip_snap/flickr.rb
Instance Method Summary collapse
- #endpoint_url ⇒ Object
- #identifier ⇒ Object
- #image_url ⇒ Object
-
#photo ⇒ Object
TODO: Handle case when this fetch fails (e.g. invalid photo ID).
Methods included from Client
Instance Method Details
#endpoint_url ⇒ Object
8 9 10 |
# File 'lib/snip_snap/flickr.rb', line 8 def endpoint_url response.last_effective_url end |
#identifier ⇒ Object
12 13 14 15 16 17 |
# File 'lib/snip_snap/flickr.rb', line 12 def identifier pattern = /^http:\/\/(?:www\.)?flickr.com\/photos\/[^\/]+\/(\d+)/ match = endpoint_url.match(pattern) match[1] unless match.nil? end |
#image_url ⇒ Object
24 25 26 |
# File 'lib/snip_snap/flickr.rb', line 24 def image_url photo.medium.url end |
#photo ⇒ Object
TODO: Handle case when this fetch fails (e.g. invalid photo ID)
20 21 22 |
# File 'lib/snip_snap/flickr.rb', line 20 def photo Fleakr::Objects::Photo.find_by_id(identifier) end |