Class: Flickr::PhotoPool
- Inherits:
-
Array
- Object
- Array
- Flickr::PhotoPool
- Defined in:
- lib/flickr/base.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#page ⇒ Object
Returns the value of attribute page.
-
#pages ⇒ Object
Returns the value of attribute pages.
-
#perpage ⇒ Object
Returns the value of attribute perpage.
-
#title ⇒ Object
Returns the value of attribute title.
-
#total ⇒ Object
Returns the value of attribute total.
Class Method Summary collapse
Instance Method Summary collapse
- #<<(photo, raw = false) ⇒ Object
- #fetch(extras = nil) ⇒ Object
-
#initialize(id, flickr) ⇒ PhotoPool
constructor
A new instance of PhotoPool.
Constructor Details
permalink #initialize(id, flickr) ⇒ PhotoPool
Returns a new instance of PhotoPool.
755 756 757 758 |
# File 'lib/flickr/base.rb', line 755 def initialize(id,flickr) @id = id @flickr = flickr end |
Instance Attribute Details
permalink #id ⇒ Object
Returns the value of attribute id.
753 754 755 |
# File 'lib/flickr/base.rb', line 753 def id @id end |
permalink #page ⇒ Object
Returns the value of attribute page.
753 754 755 |
# File 'lib/flickr/base.rb', line 753 def page @page end |
permalink #pages ⇒ Object
Returns the value of attribute pages.
753 754 755 |
# File 'lib/flickr/base.rb', line 753 def pages @pages end |
permalink #perpage ⇒ Object
Returns the value of attribute perpage.
753 754 755 |
# File 'lib/flickr/base.rb', line 753 def perpage @perpage end |
permalink #title ⇒ Object
Returns the value of attribute title.
753 754 755 |
# File 'lib/flickr/base.rb', line 753 def title @title end |
permalink #total ⇒ Object
Returns the value of attribute total.
753 754 755 |
# File 'lib/flickr/base.rb', line 753 def total @total end |
Class Method Details
permalink .from_xml(xml, flickr = nil) ⇒ Object
[View source]
772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 |
# File 'lib/flickr/base.rb', line 772 def self.from_xml(xml,flickr=nil) att = xml.attributes ppid = att['id'] pool = flickr.photopool_cache_lookup(ppid) pool ||= Flickr::PhotoPool.new(ppid,flickr) pool.page = att['page'].to_i if att['page'] pool.pages = att['pages'].to_i if att['pages'] pool.perpage = att['perpage'].to_i if att['perpage'] pool.total = att['total'].to_i if att['total'] if xml.elements['photo'] # I'd like to clear the pool, but I can't because I don't know if I'm # parsing the full set or just a single "page". # pool.clear xml.elements.each('photo') do |el| pool.<<(Flickr::Photo.from_xml(el,flickr),true) end end flickr.photopool_cache_store(pool) if flickr return pool end |
Instance Method Details
permalink #<<(photo, raw = false) ⇒ Object
[View source]
760 761 762 763 |
# File 'lib/flickr/base.rb', line 760 def <<(photo,raw=false) raw ? super(photo) : @flickr.photosets.addPhoto(self,photo) return self end |
permalink #fetch(extras = nil) ⇒ Object
[View source]
765 766 767 768 769 770 |
# File 'lib/flickr/base.rb', line 765 def fetch(extras=nil) return self if @fetched pool = @flickr.groups.pools.getPhotos(self,nil,extras,500) @fetched = true return pool end |