Class: Fleakr::Objects::Collection

Inherits:
Object
  • Object
show all
Includes:
Support::Object
Defined in:
lib/fleakr/objects/collection.rb

Overview

Collection

Attributes

id

The ID for this photoset

title

The title of this photoset

description

The description of this set

count

Count of photos in this set

Associations

photos

The collection of photos for this set. See Fleakr::Objects::Photo

comments

All comments associated with this set. See Fleakr::Objects::Comment

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Support::Object

included

Constructor Details

#initialize(document = nil) ⇒ Collection

Returns a new instance of Collection.



28
29
30
31
32
33
34
35
# File 'lib/fleakr/objects/collection.rb', line 28

def initialize(document=nil)
  self.class.attributes.each do |attribute|
    value = attribute.value_from(document)
    self.send("#{attribute.name}=".to_sym, value) unless value.nil?
  end
  self.sets = document.search("//set").map{|s| Fleakr::Objects::Set.new(s)} || []
  self.collections = recurse_collections(document.search("//collection"))
end

Instance Attribute Details

#collectionsObject

flickr_attribute :count, :from => ‘@photos’



24
25
26
# File 'lib/fleakr/objects/collection.rb', line 24

def collections
  @collections
end

#setsObject

flickr_attribute :count, :from => ‘@photos’



24
25
26
# File 'lib/fleakr/objects/collection.rb', line 24

def sets
  @sets
end