Inconsistent return values from getPhotos methods
Closed this issue · 3 comments
Flickr.people.getPhotos returns a Flickraw.ResponseList
Flickr.photosets.getPhotos returns a Flickraw.Response -- in exactly the same format as above.
Is this intentional? It's messing up our code a bit, since we were calling .to_a on the ResponseList but then if we get try to photos from a set, it has no .to_a method.
Cc @pozorvlak
Here are the responses for each api call:
flickr.photosets.getPhotos
<photoset id="4" primary="2483" page="1" perpage="500" pages="1" total="2">
<photo id="2484" secret="123456" server="1" title="my photo" isprimary="0" />
<photo id="2483" secret="123456" server="1" title="flickr rocks" isprimary="1" />
</photoset>
flickr.people.getPhotos
<photos page="2" pages="89" perpage="10" total="881">
<photo id="2636" owner="47058503995@N01"
secret="a123456" server="2" title="test_04"
ispublic="1" isfriend="0" isfamily="0" />
<photo id="2635" owner="47058503995@N01"
secret="b123456" server="2" title="test_03"
ispublic="0" isfriend="1" isfamily="1" />
<photo id="2633" owner="47058503995@N01"
secret="c123456" server="2" title="test_01"
ispublic="1" isfriend="0" isfamily="0" />
<photo id="2610" owner="12037949754@N01"
secret="d123456" server="2" title="00_tall"
ispublic="1" isfriend="0" isfamily="0" />
</photos>
In flickr.people.getPhotos
case flickraw guesses that the response is a list of photo because the tag is photos (with an s). So it translates to a Flickraw.ResponseList. But the original accessor is still there and you can call .photo
on this object to get a coherent behavior with flickr.photosets.getPhotos
.
For example:
flickr.people.getPhotos(:user_id => "me").photo
and
flickr.photosets.getPhotos(:photoset_id => "some photoset").photo
Thanks, this helped us sort out our code a bit. It might be helpful to document the return values of these (and maybe other?) methods. Would you accept a pull request with those doc changes?
I would appreciate any patch for the documentation.