myflickr 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,8 +1,12 @@
1
- == 0.0.1 2007-12-15
2
-
3
- * Initial release
1
+ == 0.0.2 2007-12-19
4
2
 
3
+ * Added tags collection for sets (Collects unique tags from the images inside the set)
4
+
5
5
  == 0.0.2 2007-12-19
6
6
 
7
7
  * Specs written, classes revised
8
- * All 'works'
8
+ * All 'works'
9
+
10
+ == 0.0.1 2007-12-15
11
+
12
+ * Initial release
data/lib/myflickr/set.rb CHANGED
@@ -1,7 +1,5 @@
1
1
  module Myflickr
2
2
  class Set < Struct.new :id, :photo_count, :title, :description
3
- attr_reader :photos
4
-
5
3
  # Get a list of available photosets
6
4
  def self.list
7
5
  parse(Query.api_call('flickr.photosets.getList'))
@@ -22,8 +20,19 @@ module Myflickr
22
20
  end
23
21
  end
24
22
 
23
+ # Return a list of tags for the set (This is rough as guts as far as queries go)
24
+ def tags
25
+ tags = []
26
+ photos.each do |photo|
27
+ photo.tags.each do |tag|
28
+ tags << tag
29
+ end
30
+ end
31
+ tags
32
+ end
33
+
25
34
  private
26
- def self.parse(collection) #:nodoc:
35
+ def self.parse(collection)
27
36
  photosets = (collection/:photoset)
28
37
  photosets.empty? ? [] : photosets.parallel_map(MAX_THREADS) do |set|
29
38
  Set.new(set[:id], set[:photos], (set/:title).inner_text, (set/:description).inner_text)
@@ -2,7 +2,7 @@ module Myflickr
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- TINY = 2
5
+ TINY = 3
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/spec/set_spec.rb CHANGED
@@ -37,4 +37,17 @@ describe Set, "class" do
37
37
  photos.should be_an_instance_of(Array)
38
38
  photos.first.should be_an_instance_of(Photo)
39
39
  end
40
+
41
+ it "should collect tags for the photos in the set" do
42
+ myset = Set.find "72157603414539843"
43
+ tags = myset.tags
44
+ tags.should be_an_instance_of(Array)
45
+ tags.first.should be_an_instance_of(Tag)
46
+ end
47
+
48
+ it "should collect unique tags" do
49
+ myset = Set.find "72157603414539843"
50
+ tags = myset.tags
51
+ tags.uniq.should eql tags
52
+ end
40
53
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: myflickr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ""
6
6
  authors:
7
7
  - Ben Schwarz