Sha256: 4c0c4b6c33d1fa7093cba689325c3016c9e48625792e9ab700b8e584173f491c
Contents?: true
Size: 1.04 KB
Versions: 1
Compression:
Stored size: 1.04 KB
Contents
class Flickr::Photosets::Photoset attr_accessor :id,:num_photos,:title,:description,:primary_photo_id def initialize(flickr, attributes) @flickr = flickr attributes.each do |k,v| send("#{k}=", v) end end def get_photos(options={}) options = options.merge(:photoset_id=>id) rsp = @flickr.send_request('flickr.photosets.getPhotos', options) collect_photos(rsp) end def add_photo(photo_id) rsp = @flickr.send_request('flickr.photosets.addPhoto', {:photo_id=>photo_id, :photoset_id => id}) end protected def collect_photos(rsp) photos = [] return photos unless rsp rsp.photos.xpath("photo").each do |photo| attributes = create_attributes(photo) photos << Flickr::Photos::Photo.new(@flickr,attributes) end if rsp.photos.at_xpath("photo") return photos end def create_attributes(photo) {:id => photo[:id], :secret => photo[:secret], :server => photo[:server], :farm => photo[:farm], :title => photo[:title]} end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fotonauts-flickr_fu-0.3.13 | lib/flickr/photoset.rb |