Parent

Net::Flickr::Photos

Provides methods for retrieving and/or manipulating one or more Flickr photos.

Don't instantiate this class yourself. Instead, create an instance of the Flickr class and then use Flickr.photos to access this class, like so:

require 'net/flickr'

flickr = Net::Flickr.new('524266cbd9d3c2xa2679fee8b337fip2')

flickr.photos.recent.each do |photo|
  puts photo.title
end

Public Class Methods

new(flickr) click to toggle source
# File lib/net/flickr/photos.rb, line 48
def initialize(flickr)
  @flickr = flickr
end

Public Instance Methods

contacts(args = {}) click to toggle source

Gets a list of recent photos from the calling user's contacts. This method requires authentication with read permission.

See flickr.com/services/api/flickr.photos.getContactsPhotos.html for details.

# File lib/net/flickr/photos.rb, line 57
def contacts(args = {})
  response = @flickr.request('flickr.photos.getContactsPhotos', args)
  
  photos = []
  
  response.search('photos/photo').each do |photo_xml|
    photos << Photo.new(@flickr, photo_xml)
  end
  
  return photos
end
contacts_public(user_id, args = {}) click to toggle source

Gets a list of recent public photos from the specified user's contacts.

See flickr.com/services/api/flickr.photos.getContactsPublicPhotos.html for details.

# File lib/net/flickr/photos.rb, line 73
def contacts_public(user_id, args = {})
  args[:user_id] = user_id
  
  response = @flickr.request('flickr.photos.getContactsPublicPhotos', args)
  
  photos = []
  
  response.search('photos/photo').each do |photo_xml|
    photos << Photo.new(@flickr, photo_xml)
  end
  
  return photos
end
counts(args = {}) click to toggle source

Gets a list of photo counts for the given date ranges for the calling user. The list of photo counts is returned as an XML chunk. This method requires authentication with read permission.

See flickr.com/services/api/flickr.photos.getCounts.html for details.

# File lib/net/flickr/photos.rb, line 93
def counts(args = {})
  @flickr.request('flickr.photos.getCounts', args).at('photocounts').
      to_original_html
end
delete(photo_id) click to toggle source

Deletes the specified photo from Flickr. This method requires authentication with delete permission.

See flickr.com/services/api/flickr.photos.delete.html for details.

# File lib/net/flickr/photos.rb, line 102
def delete(photo_id)
  @flickr.request('flickr.photos.delete', :photo_id => photo_id)
end
geotagged(args = {}) click to toggle source

Gets a list of the calling user's geotagged photos. This method requires authentication with read permission.

See flickr.com/services/api/flickr.photos.getWithGeoData.html for details.

# File lib/net/flickr/photos.rb, line 111
def geotagged(args = {})
  PhotoList.new(@flickr, 'flickr.photos.getWithGeoData', args)
end
not_geotagged(args = {}) click to toggle source

Gets a list of the calling user's photos that have not been geotagged. This method requires authentication with read permission.

See flickr.com/services/api/flickr.photos.getWithoutGeoData.html for details.

# File lib/net/flickr/photos.rb, line 120
def not_geotagged(args = {})
  PhotoList.new(@flickr, 'flickr.photos.getWithoutGeoData', args)
end
not_in_set(args = {}) click to toggle source

Gets a list of the calling user's photos that are not included in any sets. This method requires authentication with read permission.

See flickr.com/services/api/flickr.photos.getNotInSet.html for details.

# File lib/net/flickr/photos.rb, line 129
def not_in_set(args = {})
  PhotoList.new(@flickr, 'flickr.photos.getNotInSet', args)
end
recent(args = {}) click to toggle source

Gets a list of the latest public photos uploaded to Flickr.

See flickr.com/services/api/flickr.photos.getRecent.html for details.

# File lib/net/flickr/photos.rb, line 137
def recent(args = {})
  PhotoList.new(@flickr, 'flickr.photos.getRecent', args)
end
recently_updated(min_date, args = {}) click to toggle source

Gets a list of the calling user's photos that have been created or modified since the specified min_date. This method requires authentication with read permission.

min_date may be either an instance of Time or an integer representing a Unix timestamp.

See flickr.com/services/api/flickr.photos.recentlyUpdated.html for details.

# File lib/net/flickr/photos.rb, line 150
def recently_updated(min_date, args = {})
  args[:min_date] = min_date.to_i
  PhotoList.new(@flickr, 'flickr.photos.recentlyUpdated', args)
end
search(args = {}) click to toggle source

Gets a list of photos matching the specified criteria. Only photos visible to the calling user will be returned. To return private or semi-private photos, the caller must be authenticated with read permission and have permission to view the photos. Unauthenticated calls will return only public photos.

See flickr.com/services/api/flickr.photos.search.html for details.

Note: Flickr doesn't allow parameterless searches, so be sure to specify at least one search parameter.

# File lib/net/flickr/photos.rb, line 165
def search(args = {})
  PhotoList.new(@flickr, 'flickr.photos.search', args)
end
untagged(args = {}) click to toggle source

Gets a list of the calling user's photos that have no tags. This method requires authentication with read permission.

See flickr.com/services/api/flickr.photos.getUntagged.html for details.

# File lib/net/flickr/photos.rb, line 174
def untagged(args = {})
  PhotoList.new(@flickr, 'flickr.photos.getUntagged', args)
end
user(user_id, args = {}) click to toggle source

Gets a list of public photos for the specified user_id.

See flickr.com/services/api/flickr.people.getPublicPhotos.html for details.

# File lib/net/flickr/photos.rb, line 182
def user(user_id, args = {})
  args[:user_id] = user_id
  PhotoList.new(@flickr, 'flickr.people.getPublicPhotos', args)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.