Class: Myflickr::Set
- Inherits:
-
Struct
- Object
- Struct
- Myflickr::Set
- Defined in:
- lib/myflickr/set.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#id ⇒ Object
Returns the value of attribute id.
-
#photo_count ⇒ Object
Returns the value of attribute photo_count.
-
#title ⇒ Object
Returns the value of attribute title.
Class Method Summary collapse
-
.find(id) ⇒ Object
Get information regarding set by searching with the set’s ID.
-
.list ⇒ Object
Get a list of available photosets.
Instance Method Summary collapse
-
#machine_tags ⇒ Object
Return a list of machine_tags for the set (This is rough as guts as far as queries go) Queries: > photosets.getPhotos (1 call) > Photo.find ID (n calls).
-
#photos ⇒ Object
Get the photos within a set Queries: > photosets.getPhotos (1 call) > Photo.find ID (n calls).
-
#similar ⇒ Object
Search for photos that may tags that the current set collectivly owns from its photos’ tags.
-
#tags ⇒ Object
Return a list of tags for the set (This is rough as guts as far as queries go) Queries: > photosets.getPhotos (1 call) > Photo.find ID (n calls).
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description
2 3 4 |
# File 'lib/myflickr/set.rb', line 2 def description @description end |
#id ⇒ Object
Returns the value of attribute id
2 3 4 |
# File 'lib/myflickr/set.rb', line 2 def id @id end |
#photo_count ⇒ Object
Returns the value of attribute photo_count
2 3 4 |
# File 'lib/myflickr/set.rb', line 2 def photo_count @photo_count end |
#title ⇒ Object
Returns the value of attribute title
2 3 4 |
# File 'lib/myflickr/set.rb', line 2 def title @title end |
Class Method Details
Instance Method Details
#machine_tags ⇒ Object
Return a list of machine_tags for the set (This is rough as guts as far as queries go) Queries: > photosets.getPhotos (1 call) > Photo.find ID (n calls)
41 42 43 44 45 46 47 48 49 |
# File 'lib/myflickr/set.rb', line 41 def = [] photos.each do |photo| photo..each do |tag| << tag end end .uniq end |
#photos ⇒ Object
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).map do |photo| Photo.find photo[:id] end end |
#similar ⇒ Object
Search for photos that may tags that the current set collectivly owns from its photos’ tags. Then search for those photos within sets, return an array of sets or an empty array
53 54 55 56 57 58 59 |
# File 'lib/myflickr/set.rb', line 53 def similar sets = [] Set.list.each do |set| sets << set unless (self. & set.).empty? or set == self end sets.uniq end |
#tags ⇒ Object
Return a list of tags for the set (This is rough as guts as far as queries go) Queries: > photosets.getPhotos (1 call) > Photo.find ID (n calls)
27 28 29 30 31 32 33 34 35 |
# File 'lib/myflickr/set.rb', line 27 def = [] photos.each do |photo| photo..each do |tag| << tag[:value] end end .uniq end |