Class: Flickr::PhotoSet
- Inherits:
-
Array
- Object
- Array
- Flickr::PhotoSet
- Defined in:
- lib/flickr/base.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#id ⇒ Object
Returns the value of attribute id.
-
#owner ⇒ Object
Returns the value of attribute owner.
-
#photo_count ⇒ Object
Returns the value of attribute photo_count.
-
#primary_id ⇒ Object
Returns the value of attribute primary_id.
-
#secret ⇒ Object
Returns the value of attribute secret.
-
#server ⇒ Object
Returns the value of attribute server.
-
#title ⇒ Object
Returns the value of attribute title.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
- #<<(photo, raw = false) ⇒ Object
- #fetch(extras = nil) ⇒ Object (also: #photos)
-
#initialize(id, flickr) ⇒ PhotoSet
constructor
A new instance of PhotoSet.
- #primary ⇒ Object
Constructor Details
#initialize(id, flickr) ⇒ PhotoSet
Returns a new instance of PhotoSet.
696 697 698 699 |
# File 'lib/flickr/base.rb', line 696 def initialize(id,flickr) @id = id @flickr = flickr end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
693 694 695 |
# File 'lib/flickr/base.rb', line 693 def description @description end |
#id ⇒ Object
Returns the value of attribute id.
693 694 695 |
# File 'lib/flickr/base.rb', line 693 def id @id end |
#owner ⇒ Object
Returns the value of attribute owner.
693 694 695 |
# File 'lib/flickr/base.rb', line 693 def owner @owner end |
#photo_count ⇒ Object
Returns the value of attribute photo_count.
693 694 695 |
# File 'lib/flickr/base.rb', line 693 def photo_count @photo_count end |
#primary_id ⇒ Object
Returns the value of attribute primary_id.
693 694 695 |
# File 'lib/flickr/base.rb', line 693 def primary_id @primary_id end |
#secret ⇒ Object
Returns the value of attribute secret.
693 694 695 |
# File 'lib/flickr/base.rb', line 693 def secret @secret end |
#server ⇒ Object
Returns the value of attribute server.
693 694 695 |
# File 'lib/flickr/base.rb', line 693 def server @server end |
#title ⇒ Object
Returns the value of attribute title.
693 694 695 |
# File 'lib/flickr/base.rb', line 693 def title @title end |
#url ⇒ Object
Returns the value of attribute url.
693 694 695 |
# File 'lib/flickr/base.rb', line 693 def url @url end |
Class Method Details
.from_xml(xml, flickr = nil) ⇒ Object
715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 |
# File 'lib/flickr/base.rb', line 715 def self.from_xml(xml,flickr=nil) att = xml.attributes psid = att['id'] set = flickr.photoset_cache_lookup(psid) if flickr set ||= Flickr::PhotoSet.new(psid,flickr) set.secret = att['secret'] set.owner = att['owner'] set.url = att['url'] set.server = att['server'].to_i set.primary_id = att['primary'].to_i set.photo_count = att['photos'].to_i set.title = xml.elements['title'].text if xml.elements['title'] set.description = xml.elements['description'].text if xml.elements['description'] if xml.elements['photo'] set.clear xml.elements.each('photo') do |el| set.<<(Flickr::Photo.from_xml(el,flickr),true) end end flickr.photoset_cache_store(set) if flickr return set end |
Instance Method Details
#<<(photo, raw = false) ⇒ Object
701 702 703 704 |
# File 'lib/flickr/base.rb', line 701 def <<(photo,raw=false) raw ? super(photo) : @flickr.photosets.addPhoto(self,photo) return self end |
#fetch(extras = nil) ⇒ Object Also known as: photos
706 707 708 709 710 711 |
# File 'lib/flickr/base.rb', line 706 def fetch(extras=nil) return self if @fetched set = @flickr.photosets.getPhotos(self,extras) @fetched = true return set end |
#primary ⇒ Object
747 |
# File 'lib/flickr/base.rb', line 747 def primary() @primary ||= @flickr.photos.getInfo(@primary_id) end |