Class: FlickrOfflineGallery::Photoset
- Inherits:
-
Object
- Object
- FlickrOfflineGallery::Photoset
- Includes:
- VerbosePuts
- Defined in:
- lib/flickr_offline_gallery/photoset.rb
Instance Method Summary collapse
- #index_page_filename ⇒ Object
-
#initialize(photoset_id, args = {}) ⇒ Photoset
constructor
A new instance of Photoset.
- #photos ⇒ Object
- #slug ⇒ Object
- #title ⇒ Object
- #username ⇒ Object
Methods included from VerbosePuts
Constructor Details
#initialize(photoset_id, args = {}) ⇒ Photoset
Returns a new instance of Photoset.
6 7 8 9 10 |
# File 'lib/flickr_offline_gallery/photoset.rb', line 6 def initialize(photoset_id, args = {}) @photoset_id = photoset_id @output_base_path = args[:output_path] || "." eager_load end |
Instance Method Details
#index_page_filename ⇒ Object
41 42 43 |
# File 'lib/flickr_offline_gallery/photoset.rb', line 41 def index_page_filename path_manager.index_page end |
#photos ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/flickr_offline_gallery/photoset.rb', line 24 def photos raise "photoset has more than 500 images and I'm too lazy to handle that right now" if info.pages > 1 return @photos if @photos verbose_puts "Initializing photoset... " total_photos = info.photo.size @photos = [] info.photo.each do |raw_response| photo = Photo.new(raw_response, :photoset_id => @photoset_id, :path_manager => path_manager) @photos << photo verbose_puts %(Fetched (#{@photos.size}/#{total_photos}) "#{photo.title}" (#{photo.id})) end verbose_puts "Finished initializing photoset!" @photos end |
#slug ⇒ Object
20 21 22 |
# File 'lib/flickr_offline_gallery/photoset.rb', line 20 def slug title.downcase.tr_s("^a-z0-9", "-") end |
#title ⇒ Object
16 17 18 |
# File 'lib/flickr_offline_gallery/photoset.rb', line 16 def title info.title end |
#username ⇒ Object
12 13 14 |
# File 'lib/flickr_offline_gallery/photoset.rb', line 12 def username info.ownername end |