Sha256: dce8d3d45ad558a34a3e7584a541005f820babc54e54fd58d83ee6def1732397

Contents?: true

Size: 1.01 KB

Versions: 16

Compression:

Stored size: 1.01 KB

Contents

class Flickr::Photosets < Flickr::Base
  def initialize(flickr)
    @flickr = flickr
  end
  
  # Get the authorized user's contact list.
  # 
  def get_list(options={})
    rsp = @flickr.send_request('flickr.photosets.getList', options)
    collect_photosets(rsp)
  end
    
  protected  
    def collect_photosets(rsp)
      photosets = []
      return photosets unless rsp
      if rsp.photosets.photoset
        rsp.photosets.photoset.each do |photoset|
          attributes = create_attributes(photoset)
          photosets << Photoset.new(@flickr, attributes)
        end
      end
      return photosets
    end
  
    def create_attributes(photoset)
      # comment by : smeevil
      #
      # for some reason it was needed to call to_s on photoset.title and photoset.description
      # without this it will not set the value correctly
      {
        :id => photoset[:id], 
        :num_photos => photoset[:photos],
        :title => photoset.title.to_s,
        :description => photoset.description.to_s
       }
    end
  
end

Version data entries

16 entries across 16 versions & 6 rubygems

Version Path
rmm5t-flickr_fu-0.3.1 lib/flickr/photosets.rb
rschenk-flickr_fu-0.3.2 lib/flickr/photosets.rb
fotonauts-flickr_fu-0.3.4 lib/flickr/photosets.rb
fotonauts-flickr_fu-0.3.3 lib/flickr/photosets.rb
fotonauts-flickr_fu-0.3.2 lib/flickr/photosets.rb
tomk32-flickr_fu-0.3.4.1 lib/flickr/photosets.rb
tomk32-flickr_fu-0.3.3 lib/flickr/photosets.rb
tomk32-flickr_fu-0.3.2 lib/flickr/photosets.rb
tomk32-flickr_fu-0.3.1 lib/flickr/photosets.rb
robsharp-flickr_fu-0.3.0 lib/flickr/photosets.rb
flickr_fu-0.3.0 lib/flickr/photosets.rb
tomk32-flickr_fu-0.3.0 lib/flickr/photosets.rb
rmm5t-flickr_fu-0.3.5 lib/flickr/photosets.rb
rmm5t-flickr_fu-0.3.4 lib/flickr/photosets.rb
rmm5t-flickr_fu-0.3.3 lib/flickr/photosets.rb
rmm5t-flickr_fu-0.3.2 lib/flickr/photosets.rb