<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,8 @@
+== 1.0.8 2009-01-25
+* 2 minor enhancements
+ * Refactored initialization of PhotoCollection so can be instantiated from response returned by photosets.getPhotos
+ * Added photosets.getPhotos. Returns PhotoCollection
+
 == 1.0.7 2008-11-26
 * 1 major enhancement
  * When a collection of photos is fetched (e.g. by Flickr#search), a PhotoCollection object is now returned, a type of array, which allows easy access to the pagination information returned by Flickr (e.g. total items, pages, etc). Previously this info was lost</diff>
      <filename>History.txt</filename>
    </modified>
    <modified>
      <diff>@@ -24,7 +24,7 @@ user.contacts                                 # ...their contacts...
 user.favorites                                # ...favorite photos...
 user.photosets                                # ...their photo sets...
 user.tags                                     # ...their tags...
-user.popular_tags							  # ...and their popular tags
+user.popular_tags							  							# ...and their popular tags
 recentphotos = flickr.photos                  # get the 100 most recent public photos
 photo = recentphotos.first                    # or very most recent one
 photo.url                                     # see its URL,</diff>
      <filename>README.txt</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 Gem::Specification.new do |s|
   s.name = %q{flickr}
-  s.version = &quot;1.0.6&quot;
+  s.version = &quot;1.0.8&quot;
 
   s.required_rubygems_version = Gem::Requirement.new(&quot;&gt;= 0&quot;) if s.respond_to? :required_rubygems_version=
   s.authors = [&quot;Scott Raymond, Patrick Plattes&quot;]</diff>
      <filename>flickr.gemspec</filename>
    </modified>
    <modified>
      <diff>@@ -227,10 +227,14 @@ class Flickr
     attr_reader :page, :pages, :perpage, :total
     
     # builds a PhotoCollection from given params, such as those returned from 
-    # photos.search API call
+    # photos.search API call. Note all the info is contained in the value of 
+    # the first (and only) key-value pair of the response. The key will vary 
+    # depending on the original object the photos are related to (e.g 'photos',
+    # 'photoset', etc)
     def initialize(photos_api_response={}, api_key=nil)
-      [ &quot;page&quot;, &quot;pages&quot;, &quot;perpage&quot;, &quot;total&quot; ].each { |i| instance_variable_set(&quot;@#{i}&quot;, photos_api_response[&quot;photos&quot;][i])} 
-      collection = photos_api_response['photos']['photo'] || []
+      photos = photos_api_response.values.first 
+      [ &quot;page&quot;, &quot;pages&quot;, &quot;perpage&quot;, &quot;total&quot; ].each { |i| instance_variable_set(&quot;@#{i}&quot;, photos[i])} 
+      collection = photos['photo'] || []
       collection = [collection] if collection.is_a? Hash
       collection.each { |photo| self &lt;&lt; Photo.new(photo.delete('id'), api_key, photo) }
     end
@@ -699,11 +703,7 @@ class Flickr
     end
     
     def getPhotos
-      photosetPhotos = @client.request('photosets.getPhotos', {'photoset_id' =&gt; @id})
-      
-      collection = []
-      photosetPhotos['photoset']['photo'].each { |photo| collection &lt;&lt; Photo.new(photo, @api_key) }
-      collection
+      photosetPhotos = @client.photos_request('photosets.getPhotos', {'photoset_id' =&gt; @id})
     end
 
   end</diff>
      <filename>lib/flickr.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,17 +1,10 @@
-#require 'rubygems'
+require 'rubygems'
 require 'flickr'
 require 'test/unit'
-#require 'mocha'
+require 'mocha'
 
 class TestFlickr &lt; Test::Unit::TestCase
 
-  def test_get_list_of_photos_from_specified_photoset
-    flickr = Flickr.new('5a3f78d9a0f34169777dbb3ff266ba06')
-    testPhotoset = flickr.photoset('72157611041801782')
-    
-    assert_not_nil testPhotoset.getPhotos
-  end
-
   # Flickr client tests
   # 
   # instantiation tests
@@ -850,17 +843,28 @@ class TestFlickr &lt; Test::Unit::TestCase
   #   assert_nil photo['key2']
   # end
   
-  # ##### PHOTOSETS
-  #  
-  #  #def setup
-  #  #  super
-  #  #  @photoset = @f.photosets_create('title'=&gt;@title, 'primary_photo_id'=&gt;@photo_id)
-  #  #  @photoset_id = @photoset['photoset']['id']
-  #  #end
-  #  #def teardown
-  #  #  @f.photosets_delete('photoset_id'=&gt;@photoset_id)
-  #  #end
-  # 
+  ## PHOTOSETS
+  
+  def test_should_initialize_photoset_from_id
+    photoset = Flickr::Photoset.new(&quot;foo123&quot;)
+    assert_equal &quot;foo123&quot;, photoset.id
+  end
+  
+  def test_should_initialize_photoset_from_id_and_api_key
+    photoset = Flickr::Photoset.new(&quot;foo123&quot;, &quot;some_api_key&quot;)
+    assert_equal &quot;some_api_key&quot;, photoset.instance_variable_get(:@api_key)
+  end
+  
+  def test_should_get_photos_for_specified_photoset
+    Flickr.any_instance.expects(:request).with('photosets.getPhotos', {'photoset_id' =&gt; 'some_id'}).returns(dummy_photoset_photos_response)
+    photoset = Flickr::Photoset.new(&quot;some_id&quot;, &quot;some_api_key&quot;)
+    
+    assert_kind_of Flickr::PhotoCollection, photos = photoset.getPhotos
+    assert_equal 2, photos.size
+    assert_kind_of Flickr::Photo, photos.first
+  end
+
+   
   #  def test_photosets_editMeta
   #    assert_equal @f.photosets_editMeta('photoset_id'=&gt;@photoset_id, 'title'=&gt;@title)['stat'], 'ok'
   #  end
@@ -1025,6 +1029,20 @@ class TestFlickr &lt; Test::Unit::TestCase
            &quot;eighteenplus&quot; =&gt; &quot;0&quot; } } }
   end
   
+  def dummy_photoset_photos_response
+    { &quot;photoset&quot; =&gt; 
+      { &quot;photo&quot; =&gt; 
+        [{ &quot;id&quot; =&gt; &quot;foo123&quot;, 
+           &quot;key1&quot; =&gt; &quot;value1&quot;, 
+           &quot;key2&quot; =&gt; &quot;value2&quot; },
+         { &quot;id&quot; =&gt; &quot;bar456&quot;, 
+           &quot;key3&quot; =&gt; &quot;value3&quot;}],
+        &quot;page&quot;=&gt;&quot;3&quot;, 
+        &quot;pages&quot;=&gt;&quot;5&quot;, 
+        &quot;perpage&quot;=&gt;&quot;10&quot;,
+        &quot;total&quot;=&gt;&quot;42&quot; } }
+  end
+  
   def successful_xml_response
     &lt;&lt;-EOF
       &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;</diff>
      <filename>test/test_flickr.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>d75e11ed7943180b504e6e6fd6d9b547a89ea7bb</id>
    </parent>
  </parents>
  <author>
    <name>Chris Taggart</name>
    <email>chris@windowsxponmac.home</email>
  </author>
  <url>http://github.com/ctagg/flickr/commit/915949f35c732a6e555df48f2c049babcd2ad0a0</url>
  <id>915949f35c732a6e555df48f2c049babcd2ad0a0</id>
  <committed-date>2009-01-25T06:37:53-08:00</committed-date>
  <authored-date>2009-01-25T06:37:53-08:00</authored-date>
  <message>* Added photosets.getPhotos. Returns PhotoCollection.
* Refactored PhotoCollection intialization
* Updated gem version</message>
  <tree>0f1adb212afd157978bc98e06da04565b4c02bc6</tree>
  <committer>
    <name>Chris Taggart</name>
    <email>chris@windowsxponmac.home</email>
  </committer>
</commit>
