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.



514
515
516
517
518
519
# File 'lib/flickr/base.rb', line 514

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.



512
513
514
# File 'lib/flickr/base.rb', line 512

def page
  @page
end

#pagesObject (readonly)

Returns the value of attribute pages.



512
513
514
# File 'lib/flickr/base.rb', line 512

def pages
  @pages
end

#perpageObject (readonly)

Returns the value of attribute perpage.



512
513
514
# File 'lib/flickr/base.rb', line 512

def perpage
  @perpage
end

#totalObject (readonly)

Returns the value of attribute total.



512
513
514
# File 'lib/flickr/base.rb', line 512

def total
  @total
end

Class Method Details

.from_xml(xml, flickr = self) ⇒ Object



521
522
523
524
525
526
527
528
529
# File 'lib/flickr/base.rb', line 521

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