Sha256: 34792eb0c77f5ddd01432305f1184c6967f76ac2571f151c7b8dc49e596c29d6

Contents?: true

Size: 895 Bytes

Versions: 2

Compression:

Stored size: 895 Bytes

Contents

class Flickr::Photosets::Photoset
  attr_accessor :id,:num_photos,:title,:description
  
  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
  
  protected
    def collect_photos(rsp)
      photos = []
      return photos unless rsp
      if rsp.photoset.photo
        rsp.photoset.photo.each do |photo|
          attributes = create_attributes(photo)
          photos << Flickr::Photos::Photo.new(@flickr,attributes)
        end
      end
      return photos
    end
    
    def create_attributes(photo)
      {:id => photo[:id],
       :secret => photo[:secret], 
       :server => photo[:server], 
       :title => photo[:title]}
    end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
commonthread-flickr_fu-0.3.0 lib/flickr/photoset.rb
maciej-flickr_fu-0.3.0 lib/flickr/photoset.rb