Class: Myflickr::Set

Inherits:
Struct
  • Object
show all
Defined in:
lib/myflickr/set.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#descriptionObject

Returns the value of attribute description

Returns:

  • (Object)

    the current value of description



2
3
4
# File 'lib/myflickr/set.rb', line 2

def description
  @description
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



2
3
4
# File 'lib/myflickr/set.rb', line 2

def id
  @id
end

#photo_countObject

Returns the value of attribute photo_count

Returns:

  • (Object)

    the current value of photo_count



2
3
4
# File 'lib/myflickr/set.rb', line 2

def photo_count
  @photo_count
end

#titleObject

Returns the value of attribute title

Returns:

  • (Object)

    the current value of title



2
3
4
# File 'lib/myflickr/set.rb', line 2

def title
  @title
end

Class Method Details

.find(id) ⇒ Object

Get information regarding set by searching with the set’s ID



9
10
11
# File 'lib/myflickr/set.rb', line 9

def self.find id
  parse(Query.api_call('flickr.photosets.getInfo', "photoset_id=#{id}"))[0]
end

.listObject

Get a list of available photosets



4
5
6
# File 'lib/myflickr/set.rb', line 4

def self.list
  parse(Query.api_call('flickr.photosets.getList'))
end

Instance Method Details

#photosObject

Get the photos within a set Queries: > photosets.getPhotos (1 call) > Photo.find ID (n calls)



17
18
19
20
21
# File 'lib/myflickr/set.rb', line 17

def photos
  (Query.api_call('flickr.photosets.getPhotos', "photoset_id=#{id}")/:photo).parallel_map(MAX_THREADS) do |photo|
    Photo.find photo[:id]
  end
end

#tagsObject

Return a list of tags for the set (This is rough as guts as far as queries go)



24
25
26
27
28
29
30
31
32
# File 'lib/myflickr/set.rb', line 24

def tags
  tags = []
  photos.each do |photo|
    photo.tags.each do |tag|
      tags << tag[:value]
    end
  end
  tags.uniq
end