flickraw 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/flickraw.rb +4 -3
- data/test/test.rb +13 -0
- metadata +2 -2
data/lib/flickraw.rb
CHANGED
@@ -26,7 +26,7 @@ require 'yaml'
|
|
26
26
|
require 'cgi'
|
27
27
|
|
28
28
|
module FlickRaw
|
29
|
-
VERSION='0.4.
|
29
|
+
VERSION='0.4.4'
|
30
30
|
|
31
31
|
FLICKR_HOST='api.flickr.com'.freeze
|
32
32
|
|
@@ -201,8 +201,9 @@ module FlickRaw
|
|
201
201
|
full_args = {:api_key => FlickRaw.api_key, :format => 'json', :nojsoncallback => 1}
|
202
202
|
full_args[:method] = req if req
|
203
203
|
full_args[:auth_token] = @token if @token
|
204
|
-
args.each {|k, v| full_args[k.to_sym] =
|
204
|
+
args.each {|k, v| full_args[k.to_sym] = v.to_s }
|
205
205
|
full_args[:api_sig] = FlickRaw.api_sig(full_args) if FlickRaw.shared_secret
|
206
|
+
args.each {|k, v| full_args[k.to_sym] = CGI.escape(v.to_s) }
|
206
207
|
full_args
|
207
208
|
end
|
208
209
|
|
@@ -243,4 +244,4 @@ end
|
|
243
244
|
#
|
244
245
|
# recent_photos = flickr.photos.getRecent
|
245
246
|
# puts recent_photos[0].title
|
246
|
-
def flickr;
|
247
|
+
def flickr; $flickr ||= FlickRaw::Flickr.new end
|
data/test/test.rb
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
require 'test/unit'
|
2
2
|
require 'lib/flickraw'
|
3
3
|
|
4
|
+
# utf8 hack
|
5
|
+
def u(str)
|
6
|
+
str.gsub(/\\+u([0-9a-fA-F]{4,4})/u){["#$1".hex ].pack('U*')}
|
7
|
+
end
|
8
|
+
|
4
9
|
class Basic < Test::Unit::TestCase
|
5
10
|
def test_known
|
6
11
|
known_methods = ["flickr.activity.userComments", "flickr.activity.userPhotos", "flickr.auth.checkToken", "flickr.auth.getFrob", "flickr.auth.getFullToken", "flickr.auth.getToken", "flickr.blogs.getList", "flickr.blogs.postPhoto", "flickr.contacts.getList", "flickr.contacts.getPublicList", "flickr.favorites.add", "flickr.favorites.getList", "flickr.favorites.getPublicList", "flickr.favorites.remove", "flickr.groups.browse", "flickr.groups.getInfo", "flickr.groups.pools.add", "flickr.groups.pools.getContext", "flickr.groups.pools.getGroups", "flickr.groups.pools.getPhotos", "flickr.groups.pools.remove", "flickr.groups.search", "flickr.interestingness.getList", "flickr.people.findByEmail", "flickr.people.findByUsername", "flickr.people.getInfo", "flickr.people.getPublicGroups", "flickr.people.getPublicPhotos", "flickr.people.getUploadStatus", "flickr.photos.addTags", "flickr.photos.comments.addComment", "flickr.photos.comments.deleteComment", "flickr.photos.comments.editComment", "flickr.photos.comments.getList", "flickr.photos.delete", "flickr.photos.geo.getLocation", "flickr.photos.geo.getPerms", "flickr.photos.geo.removeLocation", "flickr.photos.geo.setLocation", "flickr.photos.geo.setPerms", "flickr.photos.getAllContexts", "flickr.photos.getContactsPhotos", "flickr.photos.getContactsPublicPhotos", "flickr.photos.getContext", "flickr.photos.getCounts", "flickr.photos.getExif", "flickr.photos.getFavorites", "flickr.photos.getInfo", "flickr.photos.getNotInSet", "flickr.photos.getPerms", "flickr.photos.getRecent", "flickr.photos.getSizes", "flickr.photos.getUntagged", "flickr.photos.getWithGeoData", "flickr.photos.getWithoutGeoData", "flickr.photos.licenses.getInfo", "flickr.photos.licenses.setLicense", "flickr.photos.notes.add", "flickr.photos.notes.delete", "flickr.photos.notes.edit", "flickr.photos.recentlyUpdated", "flickr.photos.removeTag", "flickr.photos.search", "flickr.photos.setDates", "flickr.photos.setMeta", "flickr.photos.setPerms", "flickr.photos.setTags", "flickr.photos.transform.rotate", "flickr.photos.upload.checkTickets", "flickr.photosets.addPhoto", "flickr.photosets.comments.addComment", "flickr.photosets.comments.deleteComment", "flickr.photosets.comments.editComment", "flickr.photosets.comments.getList", "flickr.photosets.create", "flickr.photosets.delete", "flickr.photosets.editMeta", "flickr.photosets.editPhotos", "flickr.photosets.getContext", "flickr.photosets.getInfo", "flickr.photosets.getList", "flickr.photosets.getPhotos", "flickr.photosets.orderSets", "flickr.photosets.removePhoto", "flickr.reflection.getMethodInfo", "flickr.reflection.getMethods", "flickr.tags.getHotList", "flickr.tags.getListPhoto", "flickr.tags.getListUser", "flickr.tags.getListUserPopular", "flickr.tags.getListUserRaw", "flickr.tags.getRelated", "flickr.test.echo", "flickr.test.login", "flickr.test.null", "flickr.urls.getGroup", "flickr.urls.getUserPhotos", "flickr.urls.getUserProfile", "flickr.urls.lookupGroup", "flickr.urls.lookupUser"]
|
@@ -50,5 +55,13 @@ class Basic < Test::Unit::TestCase
|
|
50
55
|
result_set = flickr.photos.search :text => "family vacation"
|
51
56
|
}
|
52
57
|
assert_operator result_set.total.to_i, :>=, 0
|
58
|
+
|
59
|
+
# Unicode tests
|
60
|
+
echo = nil
|
61
|
+
utf8_text = "Hélène François, €uro"
|
62
|
+
assert_nothing_raised {
|
63
|
+
echo = flickr.test.echo :utf8_text => utf8_text
|
64
|
+
}
|
65
|
+
assert_equal u(echo.utf8_text), utf8_text
|
53
66
|
end
|
54
67
|
end
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: flickraw
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.4.
|
7
|
-
date: 2007-
|
6
|
+
version: 0.4.4
|
7
|
+
date: 2007-09-17 00:00:00 +02:00
|
8
8
|
summary: Flickr library with a syntax close to the syntax described on http://www.flickr.com/services/api
|
9
9
|
require_paths:
|
10
10
|
- lib
|