Class: Flickr::Photosets::Photoset

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(flickr, attributes) ⇒ Photoset

Returns a new instance of Photoset.



4
5
6
7
8
9
# File 'lib/flickr/photoset.rb', line 4

def initialize(flickr, attributes)
  @flickr = flickr
  attributes.each do |k,v|
    send("#{k}=", v)
  end
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



2
3
4
# File 'lib/flickr/photoset.rb', line 2

def description
  @description
end

#farmObject

Returns the value of attribute farm.



2
3
4
# File 'lib/flickr/photoset.rb', line 2

def farm
  @farm
end

#idObject

Returns the value of attribute id.



2
3
4
# File 'lib/flickr/photoset.rb', line 2

def id
  @id
end

#num_photosObject

Returns the value of attribute num_photos.



2
3
4
# File 'lib/flickr/photoset.rb', line 2

def num_photos
  @num_photos
end

#primaryObject

Returns the value of attribute primary.



2
3
4
# File 'lib/flickr/photoset.rb', line 2

def primary
  @primary
end

#secretObject

Returns the value of attribute secret.



2
3
4
# File 'lib/flickr/photoset.rb', line 2

def secret
  @secret
end

#serverObject

Returns the value of attribute server.



2
3
4
# File 'lib/flickr/photoset.rb', line 2

def server
  @server
end

#titleObject

Returns the value of attribute title.



2
3
4
# File 'lib/flickr/photoset.rb', line 2

def title
  @title
end

Instance Method Details

#get_photos(options = {}) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/flickr/photoset.rb', line 11

def get_photos(options={})
  options.merge!({:photoset_id=>id})
  rsp = @flickr.send_request('flickr.photosets.getPhotos', options)
  returning Flickr::Photos::PhotoResponse.new(:page => rsp.photoset[:page].to_i,
                              :pages => rsp.photoset[:pages].to_i,
                              :per_page => rsp.photoset[:perpage].to_i,
                              :total => rsp.photoset[:total].to_i,
                              :photos => [],
                              :api => self,
                              :method => 'get_photos',
                              :options => options) do |photos|
    if rsp.photoset.photo
      rsp.photoset.photo.each do |photo|
        attributes = create_attributes(photo)
        photos << Flickr::Photos::Photo.new(@flickr,attributes)
      end
    end
  end
end

#thumbnail_urlObject



31
32
33
# File 'lib/flickr/photoset.rb', line 31

def thumbnail_url
  return "http://farm#{farm}.static.flickr.com/#{server}/#{primary}_#{secret}_s.jpg"
end