Object
A Flickr photo.
Don't instantiate this class yourself. Use the methods in Flickr::Photos to retrieve photos from Flickr.
Deletes this photo from Flickr. This method requires authentication with delete permission.
# File lib/net/flickr/photo.rb, line 63 def delete @flickr.photos.delete(@id) end
Gets this photo's description.
# File lib/net/flickr/photo.rb, line 68 def description info_xml = get_info return info_xml.at('description').inner_text end
Sets this photo's description. This method requires authentication with write permission.
# File lib/net/flickr/photo.rb, line 75 def description=(value) set_meta(@title, value) end
flickr.photos.getExif
# File lib/net/flickr/photo.rb, line 80 def exif raise NotImplementedError end
Whether or not this photo is visible to family.
# File lib/net/flickr/photo.rb, line 85 def family? get_info if @is_family.nil? return @is_family || @is_public end
flickr.photos.getFavorites
# File lib/net/flickr/photo.rb, line 91 def favorites raise NotImplementedError end
Whether or not this photo is visible to friends.
# File lib/net/flickr/photo.rb, line 96 def friend? get_info if @is_friend.nil? return @is_friend || @is_public end
flickr.photos.getExif
# File lib/net/flickr/photo.rb, line 102 def gps raise NotImplementedError end
Gets the time this photo was last modified.
# File lib/net/flickr/photo.rb, line 107 def modified info_xml = get_info return Time.at(info_xml.at('dates')[:lastupdate].to_i) end
Gets the next photo in the owner's photo stream, or nil if this is the last photo in the stream.
# File lib/net/flickr/photo.rb, line 114 def next context_xml = get_context next_xml = context_xml.at('nextphoto') return Photo.new(@flickr, next_xml) if next_xml[:id] != '0' return nil end
Gets the user id of this photo's owner.
# File lib/net/flickr/photo.rb, line 123 def owner @owner end
Gets the URL of this photo's Flickr photo page.
# File lib/net/flickr/photo.rb, line 128 def page_url return "http://www.flickr.com/photos/#{@owner}/#{@id}" end
flickr.photos.getAllContexts
# File lib/net/flickr/photo.rb, line 133 def pools raise NotImplementedError end
Gets the time this photo was posted to Flickr.
# File lib/net/flickr/photo.rb, line 138 def posted info_xml = get_info return Time.at(info_xml.at('dates')[:posted].to_i) end
flickr.photos.setDates
# File lib/net/flickr/photo.rb, line 144 def posted=(time) end
Gets the previous photo in the owner's photo stream, or nil if this is the first photo in the stream.
# File lib/net/flickr/photo.rb, line 149 def previous context_xml = get_context prev_xml = context_xml.at('prevphoto') return Photo.new(@flickr, prev_xml) if prev_xml[:id] != '0' return nil end
Whether or not this photo is visible to the general public.
# File lib/net/flickr/photo.rb, line 160 def public? get_info if @is_public.nil? return @is_public end
flickr.photos.getAllContexts
# File lib/net/flickr/photo.rb, line 166 def sets raise NotImplementedError end
flickr.photos.getSizes
# File lib/net/flickr/photo.rb, line 171 def sizes raise NotImplementedError end
Gets the source URL for this photo at one of the following specified sizes. Returns nil if the specified size is not available.
75x75px
100px on longest side
240px on longest side
500px on longest side
1024px on longest side (not available for all images)
original image in original file format
# File lib/net/flickr/photo.rb, line 184 def source_url(size = :medium) suffix = SIZE_SUFFIX[size] case size when :medium return "http://farm#{@farm}.static.flickr.com/#{@server}/#{@id}_" + "#{@secret}.jpg" when :original info_xml = get_info original_secret = info_xml[:originalsecret] original_format = info_xml[:originalformat] return nil if original_secret.nil? || original_format.nil? return "http://farm#{@farm}.static.flickr.com/#{@server}/#{@id}_" + "#{original_secret}_o.#{original_format}" else return "http://farm#{@farm}.static.flickr.com/#{@server}/#{@id}_" + "#{@secret}_#{suffix}.jpg" end end
Gets the time this photo was taken.
# File lib/net/flickr/photo.rb, line 214 def taken info_xml = get_info return Time.parse(info_xml.at('dates')[:taken]) end
flickr.photos.setDates
# File lib/net/flickr/photo.rb, line 220 def taken=(time) raise NotImplementedError end
flickr.photos.getExif
# File lib/net/flickr/photo.rb, line 225 def tiff raise NotImplementedError end
Generated with the Darkfish Rdoc Generator 2.