flickr 2.0.0 → 2.1.0
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.
- checksums.yaml +4 -4
- data/.gitignore +11 -0
- data/CHANGELOG.md +21 -0
- data/Gemfile +2 -0
- data/README.md +233 -0
- data/examples/sinatra.rb +4 -4
- data/flickr.gemspec +33 -0
- data/flickr_rdoc.rb +7 -7
- data/lib/flickr/response.rb +5 -3
- data/lib/flickr/version.rb +1 -1
- data/lib/flickr.rb +21 -19
- data/rakefile +19 -6
- metadata +77 -17
- data/README.rdoc +0 -185
- data/test/test.rb +0 -471
- data/test/test_cache.rb +0 -45
- data/test/test_request.rb +0 -36
- data/test/test_response.rb +0 -30
- data/test/test_upload.rb +0 -41
data/test/test_request.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
lib = File.dirname(__FILE__)
|
4
|
-
$:.unshift lib unless $:.include?(lib)
|
5
|
-
|
6
|
-
require 'test/unit'
|
7
|
-
|
8
|
-
class TestRequest < Test::Unit::TestCase
|
9
|
-
|
10
|
-
def setup
|
11
|
-
@flickr = ::Flickr.new
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_flickr_api_is_accessible_via_methods
|
15
|
-
Flickr.new.send :build_classes, ['flickr.fully.legal']
|
16
|
-
|
17
|
-
assert_equal true, @flickr.methods.include?(:fully)
|
18
|
-
assert_equal true, @flickr.fully.methods.include?(:legal)
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_invalid_endpoint_definition
|
22
|
-
e = assert_raises(RuntimeError) do
|
23
|
-
Flickr.new.send :build_classes, ['not_flickr.something.method']
|
24
|
-
end
|
25
|
-
assert_equal "Invalid namespace", e.message
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_invalid_keys_are_skipped
|
29
|
-
assert_nothing_raised {
|
30
|
-
Flickr.new.send :build_classes, ["flickr.hacked; end; raise 'Pwned'; def x"]
|
31
|
-
}
|
32
|
-
|
33
|
-
assert_equal false, @flickr.methods.include?(:hacked)
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
data/test/test_response.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
lib = File.dirname(__FILE__)
|
4
|
-
$:.unshift lib unless $:.include?(lib)
|
5
|
-
|
6
|
-
require 'test/unit'
|
7
|
-
|
8
|
-
class TestResponse < Test::Unit::TestCase
|
9
|
-
|
10
|
-
def test_response_keys_are_turned_into_methods
|
11
|
-
subject = Flickr::Response.new({ 'le_gal' => 'ok', }, nil)
|
12
|
-
|
13
|
-
assert_equal true, subject.methods.include?(:le_gal)
|
14
|
-
assert_equal 'ok', subject.le_gal
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_invalid_keys_are_skipped
|
18
|
-
response_hash = {
|
19
|
-
'illegal; end; raise "Pwned"; def x' => 'skipped'
|
20
|
-
}
|
21
|
-
|
22
|
-
assert_nothing_raised {
|
23
|
-
Flickr::Response.new(response_hash, nil)
|
24
|
-
}
|
25
|
-
|
26
|
-
subject = Flickr::Response.new(response_hash, nil)
|
27
|
-
assert_equal false, subject.methods.include?(:illegal)
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
data/test/test_upload.rb
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
lib = File.dirname(__FILE__)
|
4
|
-
$:.unshift lib unless $:.include?(lib)
|
5
|
-
|
6
|
-
require 'test/unit'
|
7
|
-
|
8
|
-
class TestUpload < Test::Unit::TestCase
|
9
|
-
|
10
|
-
def setup
|
11
|
-
@flickr = ::Flickr.new
|
12
|
-
|
13
|
-
@flickr.access_token = ENV['FLICKR_ACCESS_TOKEN']
|
14
|
-
@flickr.access_secret = ENV['FLICKR_ACCESS_SECRET']
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_upload
|
18
|
-
u = info = nil
|
19
|
-
path = File.dirname(__FILE__) + '/image testée.jpg'
|
20
|
-
title = "Titre de l'image testée"
|
21
|
-
description = "Ceci est la description de l'image testée"
|
22
|
-
|
23
|
-
assert File.exist? path
|
24
|
-
|
25
|
-
assert_nothing_raised do
|
26
|
-
u = @flickr.upload_photo path,
|
27
|
-
:title => title,
|
28
|
-
:description => description
|
29
|
-
end
|
30
|
-
|
31
|
-
assert_nothing_raised do
|
32
|
-
info = @flickr.photos.getInfo :photo_id => u.to_s
|
33
|
-
end
|
34
|
-
|
35
|
-
assert_equal title, info.title
|
36
|
-
assert_equal description, info.description
|
37
|
-
|
38
|
-
assert_nothing_raised {@flickr.photos.delete :photo_id => u.to_s}
|
39
|
-
end
|
40
|
-
|
41
|
-
end
|