objectiveflickr 0.9.3 → 0.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +10 -0
- data/lib/objectiveflickr/flickr_invocation.rb +2 -1
- data/lib/objectiveflickr/version.rb +1 -1
- data/test/objectiveflickr_test.rb +13 -5
- metadata +2 -2
data/History.txt
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
2007-01-08 (0.9.4):
|
2
|
+
* Fixed a serious defect where API parameters, such as search text,
|
3
|
+
must be URL-escaped. There's a catch if you tried previously to use
|
4
|
+
CGI.escape to work around, though: Flickr's API signature string must
|
5
|
+
not be *escaped* before the string is MD5-checksummed.
|
6
|
+
|
7
|
+
Now everything should work fine. Pass a few CJKV or HTML entity
|
8
|
+
characters to see how it goes!
|
9
|
+
|
10
|
+
|
1
11
|
2007-01-04 (0.9.3):
|
2
12
|
* These methods from FlickrPhoto are deprecated:
|
3
13
|
|
@@ -11,6 +11,7 @@ require 'rubygems'
|
|
11
11
|
require 'net/http'
|
12
12
|
require 'jcode'
|
13
13
|
require 'digest/md5'
|
14
|
+
require 'cgi'
|
14
15
|
|
15
16
|
$KCODE = 'UTF8'
|
16
17
|
|
@@ -117,7 +118,7 @@ class FlickrInvocation
|
|
117
118
|
p["api_sig"] = api_sig(sigp)
|
118
119
|
end
|
119
120
|
|
120
|
-
p.keys.each { |k| url += "&#{k.to_s}=#{p[k]}" }
|
121
|
+
p.keys.each { |k| url += "&#{k.to_s}=#{CGI.escape(p[k].to_s)}" }
|
121
122
|
url
|
122
123
|
end
|
123
124
|
|
@@ -3,7 +3,10 @@ require 'yaml'
|
|
3
3
|
|
4
4
|
class ObjectiveFlickrTest < Test::Unit::TestCase
|
5
5
|
|
6
|
+
TEST_API_KEY = 'bf67a649fffb210651334a09b92df02e'
|
7
|
+
|
6
8
|
def setup
|
9
|
+
@f = FlickrInvocation.new(TEST_API_KEY)
|
7
10
|
end
|
8
11
|
|
9
12
|
def test_truth
|
@@ -12,12 +15,18 @@ class ObjectiveFlickrTest < Test::Unit::TestCase
|
|
12
15
|
|
13
16
|
# we use a unit test API key for this purpose
|
14
17
|
def test_echo
|
15
|
-
|
16
|
-
r = f.call("flickr.test.echo")
|
18
|
+
r = @f.call("flickr.test.echo")
|
17
19
|
assert(r.ok?, "response should be ok")
|
18
20
|
assert_equal(r["method"]["_content"], "flickr.test.echo", "method name should echo")
|
19
21
|
end
|
20
22
|
|
23
|
+
def test_echo_escaped_characters
|
24
|
+
r = @f.call("flickr.test.echo", :text=>"漢字 @ < > lorem ipsum")
|
25
|
+
assert(r.ok?, "response should be ok")
|
26
|
+
assert_equal(r["text"]["_content"], "漢字 @ < > lorem ipsum", "CJKV, HTML entities and other characters should be properly URL-escaped")
|
27
|
+
end
|
28
|
+
|
29
|
+
|
21
30
|
def test_default_settings
|
22
31
|
FlickrInvocation.default_api_key 'bf67a649fffb210651334a09b92df02e'
|
23
32
|
f = FlickrInvocation.new
|
@@ -41,10 +50,9 @@ class ObjectiveFlickrTest < Test::Unit::TestCase
|
|
41
50
|
end
|
42
51
|
|
43
52
|
def test_deprecated_photo_helpers
|
44
|
-
f = FlickrInvocation.new
|
45
53
|
params = {:server=>1234, :id=>5678, :secret=>90, :farm=>321}
|
46
|
-
assert_equal(f.photo_url(params), "http://farm321.static.flickr.com/1234/5678_90.jpg", "URL helper failed")
|
47
|
-
uid = f.photo_div_id(params)
|
54
|
+
assert_equal(@f.photo_url(params), "http://farm321.static.flickr.com/1234/5678_90.jpg", "URL helper failed")
|
55
|
+
uid = @f.photo_div_id(params)
|
48
56
|
assert_equal(uid, "photo-1234-5678-90-321--jpg", "UID failed")
|
49
57
|
end
|
50
58
|
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: objectiveflickr
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.9.
|
7
|
-
date: 2007-01-
|
6
|
+
version: 0.9.4
|
7
|
+
date: 2007-01-09 00:00:00 +08:00
|
8
8
|
summary: objectiveflickr is a minimalistic Flickr API library that uses REST-style calls and receives JSON response blocks, resulting in very concise code. Named so in order to echo another Flickr library of mine, under the same name, developed for Objective-C.
|
9
9
|
require_paths:
|
10
10
|
- lib
|