Class: Flickr::PhotoSet

Inherits:
Object
  • Object
show all
Includes:
Proxy
Defined in:
lib/simple-flickr/photo_set.rb

Overview

Represents a Flickr Photo Set.

Instance Attribute Summary

Attributes included from Proxy

#attributes

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Proxy

#id, included, #method_missing

Constructor Details

#initialize(xml, client) ⇒ PhotoSet

:nodoc:



7
8
9
10
11
# File 'lib/simple-flickr/photo_set.rb', line 7

def initialize( xml, client ) # :nodoc:
  super( xml, client )
  @attributes[ 'title' ] = xml.at('title').inner_text 
  @attributes[ 'description' ] = xml.at('description').inner_text 
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Flickr::Proxy

Class Method Details

.find(photoset_id, client) ⇒ Object

Find a single photo using the Flickr photo ID and a Flickr::Client

Parameters

:photoset_id<String>

The flickr photoset id (should be a ~10-digit integer)

:client<Flickr::Client>

The flickr client object to use



38
39
40
# File 'lib/simple-flickr/photo_set.rb', line 38

def self.find( photoset_id, client )
  PhotoSet.new( client.request('photosets.getInfo', :photoset_id => photoset_id).at('photoset'), client )
end

Instance Method Details

#personObject

Get the person associated with this photoset

Returns

Flickr::Person: The associated person object



29
30
31
# File 'lib/simple-flickr/photo_set.rb', line 29

def person
  Person.find_by_id( owner, @client )
end

#photos(options = {}) ⇒ Object

Return the most recent photos for this photoset.

Arguments

:options<Hash>

This is a hash of options that will be passed to flickr. For more details

on what you can pass, please check out www.flickr.com/services/api/flickr.photosets.getPhotos.html

Returns

[Flickr::Photo]

An array of Flickr::Photo objects.



21
22
23
# File 'lib/simple-flickr/photo_set.rb', line 21

def photos( options = {} )
  Photo.api_query( 'photosets.getPhotos', @client, options.merge(:photoset_id => id) )
end