Class: Flickr::PhotoList

Inherits:
Array
  • Object
show all
Defined in:
lib/flickr/base.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(page, pages, perpage, total) ⇒ PhotoList

Returns a new instance of PhotoList.



530
531
532
533
534
535
# File 'lib/flickr/base.rb', line 530

def initialize(page,pages,perpage,total)
	@page = page
	@pages = pages
	@perpage = perpage
	@total = total
end

Instance Attribute Details

#pageObject (readonly)

Returns the value of attribute page.



528
529
530
# File 'lib/flickr/base.rb', line 528

def page
  @page
end

#pagesObject (readonly)

Returns the value of attribute pages.



528
529
530
# File 'lib/flickr/base.rb', line 528

def pages
  @pages
end

#perpageObject (readonly)

Returns the value of attribute perpage.



528
529
530
# File 'lib/flickr/base.rb', line 528

def perpage
  @perpage
end

#totalObject (readonly)

Returns the value of attribute total.



528
529
530
# File 'lib/flickr/base.rb', line 528

def total
  @total
end

Class Method Details

.from_xml(xml, flickr = self) ⇒ Object



537
538
539
540
541
542
543
544
545
# File 'lib/flickr/base.rb', line 537

def self.from_xml(xml,flickr=self)
	att = xml.root.attributes
	list = Flickr::PhotoList.new(att['page'].to_i,att['pages'].to_i,
		att['perpage'].to_i,att['total'].to_i)
	xml.elements['/photos'].each_element do |e|
		list << Flickr::Photo.from_xml(e,flickr)
	end
	return list
end