tomk32-flickr_fu 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +13 -0
- data/LICENSE +22 -0
- data/README +182 -0
- data/Rakefile +73 -0
- data/VERSION.yml +4 -0
- data/lib/flickr/auth.rb +76 -0
- data/lib/flickr/base.rb +151 -0
- data/lib/flickr/comment.rb +16 -0
- data/lib/flickr/contact.rb +16 -0
- data/lib/flickr/contacts.rb +55 -0
- data/lib/flickr/errors.rb +20 -0
- data/lib/flickr/geo.rb +42 -0
- data/lib/flickr/license.rb +24 -0
- data/lib/flickr/location.rb +15 -0
- data/lib/flickr/note.rb +16 -0
- data/lib/flickr/people.rb +54 -0
- data/lib/flickr/person.rb +82 -0
- data/lib/flickr/photo.rb +333 -0
- data/lib/flickr/photo_response.rb +37 -0
- data/lib/flickr/photos.rb +277 -0
- data/lib/flickr/photoset.rb +37 -0
- data/lib/flickr/photosets.rb +39 -0
- data/lib/flickr/size.rb +16 -0
- data/lib/flickr/status.rb +19 -0
- data/lib/flickr/test.rb +31 -0
- data/lib/flickr/token.rb +22 -0
- data/lib/flickr/uploader.rb +162 -0
- data/lib/flickr/urls.rb +44 -0
- data/lib/flickr_fu.rb +51 -0
- data/spec/fixtures/flickr/contacts/get_list-fail-99.xml +4 -0
- data/spec/fixtures/flickr/contacts/get_public_list-0.xml +7 -0
- data/spec/fixtures/flickr/photos/geo/get_location-0.xml +11 -0
- data/spec/fixtures/flickr/photos/geo/get_location-fail-2.xml +4 -0
- data/spec/fixtures/flickr/photos/get_info-0.xml +41 -0
- data/spec/fixtures/flickr/photos/get_info-1.xml +19 -0
- data/spec/fixtures/flickr/photos/get_sizes-0.xml +10 -0
- data/spec/fixtures/flickr/photos/get_sizes-1.xml +8 -0
- data/spec/fixtures/flickr/photos/licenses/get_info.xml +12 -0
- data/spec/fixtures/flickr/photosets/get_list-0.xml +13 -0
- data/spec/fixtures/flickr/photosets/get_photos-0.xml +7 -0
- data/spec/fixtures/flickr/test/echo-0.xml +5 -0
- data/spec/fixtures/flickr/test/null-fail-99.xml +4 -0
- data/spec/fixtures/flickr/urls/get_group-0.xml +4 -0
- data/spec/fixtures/flickr/urls/get_group-fail-1.xml +4 -0
- data/spec/fixtures/flickr/urls/get_user_photos-0.xml +4 -0
- data/spec/fixtures/flickr/urls/get_user_photos-fail-1.xml +4 -0
- data/spec/fixtures/flickr/urls/get_user_photos-fail-2.xml +4 -0
- data/spec/fixtures/flickr/urls/get_user_profile-0.xml +4 -0
- data/spec/fixtures/flickr/urls/get_user_profile-fail-1.xml +4 -0
- data/spec/fixtures/flickr/urls/get_user_profile-fail-2.xml +4 -0
- data/spec/fixtures/flickr/urls/lookup_group-0.xml +6 -0
- data/spec/fixtures/flickr/urls/lookup_group-fail-1.xml +4 -0
- data/spec/fixtures/flickr/urls/lookup_user-0.xml +6 -0
- data/spec/fixtures/flickr/videos/get_info-0.xml +31 -0
- data/spec/fixtures/flickr/videos/get_sizes-0.xml +13 -0
- data/spec/flickr/base_spec.rb +97 -0
- data/spec/flickr/contacts_spec.rb +47 -0
- data/spec/flickr/errors_spec.rb +21 -0
- data/spec/flickr/geo_spec.rb +20 -0
- data/spec/flickr/photo_spec.rb +140 -0
- data/spec/flickr/photos_spec.rb +50 -0
- data/spec/flickr/photosets_spec.rb +49 -0
- data/spec/flickr/test_spec.rb +34 -0
- data/spec/flickr/urls_spec.rb +99 -0
- data/spec/spec.opts +4 -0
- data/spec/spec_helper.rb +20 -0
- data/tomk32-flickr_fu.gemspec +121 -0
- metadata +151 -0
@@ -0,0 +1,140 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
module PhotoSpecHelper
|
4
|
+
def valid_photo_attributes
|
5
|
+
{
|
6
|
+
:id => 2984637736,
|
7
|
+
:owner => "80755658@N00",
|
8
|
+
:secret => "9e5762e027",
|
9
|
+
:server => 3180,
|
10
|
+
:farm => 4,
|
11
|
+
:title => "Demolition of Hotel Rzeszów",
|
12
|
+
:is_public => 1,
|
13
|
+
:is_friend => 0,
|
14
|
+
:is_family => 0
|
15
|
+
}
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe Flickr::Photos::Photo do
|
20
|
+
|
21
|
+
include PhotoSpecHelper
|
22
|
+
|
23
|
+
before :all do
|
24
|
+
@info_xml = File.read(File.dirname(__FILE__) + "/../fixtures/flickr/photos/get_info-0.xml")
|
25
|
+
@sizes_xml = File.read(File.dirname(__FILE__) + "/../fixtures/flickr/photos/get_sizes-0.xml")
|
26
|
+
end
|
27
|
+
|
28
|
+
before :each do
|
29
|
+
@flickr = SpecHelper.flickr
|
30
|
+
#@flickr.stub!(:request_over_http).and_return(info_xml)
|
31
|
+
@photo = Flickr::Photos::Photo.new(@flickr, valid_photo_attributes)
|
32
|
+
end
|
33
|
+
|
34
|
+
describe ".description" do
|
35
|
+
it "should return the description" do
|
36
|
+
@flickr.should_receive(:request_over_http).and_return(@info_xml)
|
37
|
+
@photo.description.should ==
|
38
|
+
"The last picture from a quite old event. The demolition of the best known hotel in Rzeszów called Hotel Rzeszów."
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe ".photo_size" do
|
43
|
+
it "should return the appropriate Flickr::Photos::Size instance when requested by symbol" do
|
44
|
+
@photo.photo_size(:square).class.should == Flickr::Photos::Size
|
45
|
+
@photo.photo_size(:square).label.should == "Square"
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should return the appropriate Flickr::Photos::Size instance when requested by string" do
|
49
|
+
@photo.photo_size('square').class.should == Flickr::Photos::Size
|
50
|
+
@photo.photo_size('square').label.should == "Square"
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should return the :medium Flickr::Photos::Size instance invalidly requested" do
|
54
|
+
@photo.photo_size(:doubleplusbig).class.should == Flickr::Photos::Size
|
55
|
+
@photo.photo_size(:doubleplusbig).label.should == "Medium"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe ".image_url" do
|
60
|
+
it "should return all standard sizes (thumbnail, square, small, medium and large) when requested" do
|
61
|
+
@photo.image_url(:square).should == "http://farm4.static.flickr.com/3180/2984637736_9e5762e027_s.jpg"
|
62
|
+
@photo.image_url(:thumbnail).should == "http://farm4.static.flickr.com/3180/2984637736_9e5762e027_t.jpg"
|
63
|
+
@photo.image_url(:small).should == "http://farm4.static.flickr.com/3180/2984637736_9e5762e027_m.jpg"
|
64
|
+
@photo.image_url(:medium).should == "http://farm4.static.flickr.com/3180/2984637736_9e5762e027.jpg"
|
65
|
+
@photo.image_url(:large).should == "http://farm4.static.flickr.com/3180/2984637736_9e5762e027_b.jpg"
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should return the same image even if you pass a string as an argument" do
|
69
|
+
@photo.image_url("square").should == @photo.image_url(:square)
|
70
|
+
@photo.image_url("large").should == @photo.image_url(:large)
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should not call getSizes if not requested the url of the original image" do
|
74
|
+
@flickr.should_not_receive(:request_over_http)
|
75
|
+
@photo.image_url :square
|
76
|
+
@photo.image_url :thumbnail
|
77
|
+
@photo.image_url :small
|
78
|
+
@photo.image_url :medium
|
79
|
+
@photo.image_url :large
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should call getSizes if requested the url of the original image" do
|
83
|
+
@flickr.should_receive(:request_over_http).and_return(@sizes_xml)
|
84
|
+
@photo.image_url :original
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should return nil if original image url not available" do
|
88
|
+
@flickr.should_receive(:request_over_http).and_return(@sizes_xml)
|
89
|
+
@photo.image_url(:original).should == nil
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
describe ".video_url" do
|
94
|
+
it "should return nil, since it's not a video" do
|
95
|
+
@flickr.should_receive(:request_over_http).and_return(@sizes_xml)
|
96
|
+
@photo.video_url.should == nil
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
describe ".location" do
|
101
|
+
it "should return the picture location as specified in flickr.photos.geo.getLocation" do
|
102
|
+
location_xml = File.read(File.dirname(__FILE__) + "/../fixtures/flickr/photos/geo/get_location-0.xml")
|
103
|
+
@flickr.should_receive(:request_over_http).twice.and_return(location_xml)
|
104
|
+
expected_loc = @flickr.photos.geo.get_location(@photo.id)
|
105
|
+
acctual_loc = @photo.location
|
106
|
+
# Checking by latitude and longitude is enough for us
|
107
|
+
acctual_loc.latitude.should == expected_loc.latitude
|
108
|
+
acctual_loc.longitude.should == expected_loc.longitude
|
109
|
+
end
|
110
|
+
|
111
|
+
it "should return nil if picture is not geo-tagged" do
|
112
|
+
no_location_xml = File.read(File.dirname(__FILE__) + "/../fixtures/flickr/photos/geo/get_location-fail-2.xml")
|
113
|
+
@flickr.should_receive(:request_over_http).and_return(no_location_xml)
|
114
|
+
@photo.location.should be_nil
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
describe Flickr::Photos::Photo, "but it's really a video" do
|
119
|
+
|
120
|
+
include PhotoSpecHelper
|
121
|
+
|
122
|
+
before :all do
|
123
|
+
@info_xml = File.read(File.dirname(__FILE__) + "/../fixtures/flickr/videos/get_info-0.xml")
|
124
|
+
@sizes_xml = File.read(File.dirname(__FILE__) + "/../fixtures/flickr/videos/get_sizes-0.xml")
|
125
|
+
end
|
126
|
+
|
127
|
+
before :each do
|
128
|
+
@flickr = SpecHelper.flickr
|
129
|
+
#@flickr.stub!(:request_over_http).and_return(info_xml)
|
130
|
+
@photo = Flickr::Photos::Photo.new(@flickr, valid_photo_attributes)
|
131
|
+
end
|
132
|
+
|
133
|
+
describe ".video_url" do
|
134
|
+
it "should return something sane" do
|
135
|
+
@flickr.should_receive(:request_over_http).and_return(@sizes_xml)
|
136
|
+
@photo.video_url.should == "http://www.flickr.com/apps/video/stewart.swf?v=63881&photo_id=2729556270&photo_secret=eee23fb14a"
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe Flickr::Photos do
|
4
|
+
|
5
|
+
before :each do
|
6
|
+
@flickr = SpecHelper.flickr
|
7
|
+
end
|
8
|
+
|
9
|
+
describe ".licenses" do
|
10
|
+
before :all do
|
11
|
+
@licenses_xml = File.read(File.dirname(__FILE__) + "/../fixtures/flickr/photos/licenses/get_info.xml")
|
12
|
+
@valid_licenses = {
|
13
|
+
0 => Flickr::Photos::License.new(:id => 0, :name => "All Rights Reserved", :url => ""),
|
14
|
+
4 => Flickr::Photos::License.new(:id => 4, :name => "Attribution License", :url => "http://creativecommons.org/licenses/by/2.0/"),
|
15
|
+
6 => Flickr::Photos::License.new(:id => 6, :name => "Attribution-NoDerivs License", :url => "http://creativecommons.org/licenses/by-nd/2.0/"),
|
16
|
+
3 => Flickr::Photos::License.new(:id => 3, :name => "Attribution-NonCommercial-NoDerivs License", :url => "http://creativecommons.org/licenses/by-nc-nd/2.0/"),
|
17
|
+
2 => Flickr::Photos::License.new(:id => 2, :name => "Attribution-NonCommercial License", :url => "http://creativecommons.org/licenses/by-nc/2.0/"),
|
18
|
+
1 => Flickr::Photos::License.new(:id => 1, :name => "Attribution-NonCommercial-ShareAlike License", :url => "http://creativecommons.org/licenses/by-nc-sa/2.0/"),
|
19
|
+
5 => Flickr::Photos::License.new(:id => 5, :name => "Attribution-ShareAlike License", :url => "http://creativecommons.org/licenses/by-sa/2.0/")
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should return all valid licenses" do
|
24
|
+
@flickr.should_receive(:request_over_http).and_return(@licenses_xml)
|
25
|
+
@flickr.photos.licenses.should == @valid_licenses
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should not not call Flickr API more than once" do
|
29
|
+
@flickr.should_receive(:request_over_http).once.and_return(@licenses_xml)
|
30
|
+
@flickr.photos.licenses
|
31
|
+
@flickr.photos.licenses
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe ".find_by_id" do
|
36
|
+
it "should return a photo when a valid id is given" do
|
37
|
+
photo_id = 2984637736
|
38
|
+
#photo_upload_date = 1225297614
|
39
|
+
info_xml = File.read(File.dirname(__FILE__) + "/../fixtures/flickr/photos/get_info-0.xml")
|
40
|
+
@flickr.should_receive(:request_over_http).and_return(info_xml)
|
41
|
+
|
42
|
+
photo = @flickr.photos.find_by_id(photo_id)
|
43
|
+
photo.id.should == photo_id
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should raise an error when no id is given"
|
47
|
+
|
48
|
+
it "should raise an error when the photo does not exist"
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe Flickr::Photosets do
|
4
|
+
before :all do
|
5
|
+
@get_list_xml = File.read(File.dirname(__FILE__) +
|
6
|
+
"/../fixtures/flickr/photosets/get_list-0.xml")
|
7
|
+
@get_photos_xml = File.read(File.dirname(__FILE__) +
|
8
|
+
"/../fixtures/flickr/photosets/get_photos-0.xml")
|
9
|
+
end
|
10
|
+
|
11
|
+
before :each do
|
12
|
+
@flickr = SpecHelper.flickr
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
describe ".get_list" do
|
17
|
+
it "should call flickr.photosets.getList" do
|
18
|
+
@flickr.should_receive(:send_request).with("flickr.photosets.getList", {})
|
19
|
+
@flickr.photosets.get_list
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should return an array of photoset objects" do
|
23
|
+
@flickr.stub!(:request_over_http).and_return(@get_list_xml)
|
24
|
+
photosets = @flickr.photosets.get_list
|
25
|
+
|
26
|
+
photosets[0].should be_an_instance_of(Flickr::Photosets::Photoset)
|
27
|
+
photosets[0].title.should == 'Test'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe ".get_photos" do
|
32
|
+
before :each do
|
33
|
+
@photoset = Flickr::Photosets::Photoset.new(@flickr,{:id=>4})
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should call flickr.photosets.getPhotos" do
|
37
|
+
@flickr.should_receive(:send_request).with("flickr.photosets.getPhotos",{:photoset_id=>4})
|
38
|
+
@photoset.get_photos
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should return an array of photo objects" do
|
42
|
+
@flickr.stub!(:request_over_http).and_return(@get_photos_xml)
|
43
|
+
photos = @photoset.get_photos
|
44
|
+
|
45
|
+
photos.should_not be_nil
|
46
|
+
photos[0].should be_an_instance_of(Flickr::Photos::Photo)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe Flickr::Test do
|
4
|
+
|
5
|
+
# Before all should be sufficient here. If not it should be safe to change it to
|
6
|
+
# before :each
|
7
|
+
before :all do
|
8
|
+
@flickr = SpecHelper.flickr
|
9
|
+
end
|
10
|
+
|
11
|
+
describe ".echo" do
|
12
|
+
it "should return all parameters back in the response" do
|
13
|
+
xml = File.read(File.dirname(__FILE__) + "/../fixtures/flickr/test/echo-0.xml")
|
14
|
+
@flickr.should_receive(:request_over_http).and_return(xml)
|
15
|
+
actual = @flickr.test.echo("foo" => "bar")
|
16
|
+
actual.strip_api_params!
|
17
|
+
actual.should == {:method => "flickr.test.echo", "foo" => "bar"}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# FIXME Hm... we should have a better way of testing if a user is authenticated or not after all
|
22
|
+
describe ".null" do
|
23
|
+
it "should fail if not authenticated with read permissions" do
|
24
|
+
xml = File.read(File.dirname(__FILE__) + "/../fixtures/flickr/test/null-fail-99.xml")
|
25
|
+
@flickr.should_receive(:request_over_http).and_return(xml)
|
26
|
+
lambda { @flickr.test.null }.should raise_error(Flickr::Error, /^99:/)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should return true unless there is an error" do
|
30
|
+
@flickr.should_receive(:request_over_http).and_return("")
|
31
|
+
@flickr.test.null.should == true
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe Flickr::Urls do
|
4
|
+
before :all do
|
5
|
+
@flickr = SpecHelper.flickr
|
6
|
+
end
|
7
|
+
|
8
|
+
|
9
|
+
describe ".get_group" do
|
10
|
+
it "should return the url to a group's page if the group_id is valid" do
|
11
|
+
xml = File.read(File.dirname(__FILE__) + "/../fixtures/flickr/urls/get_group-0.xml")
|
12
|
+
@flickr.should_receive(:request_over_http).and_return(xml)
|
13
|
+
@flickr.urls.get_group("34427469792@N01").should == "http://www.flickr.com/groups/central/"
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should raise an error if the group_id is not valid (Group not found error raised)" do
|
17
|
+
xml = File.read(File.dirname(__FILE__) + "/../fixtures/flickr/urls/get_group-fail-1.xml")
|
18
|
+
@flickr.should_receive(:request_over_http).and_return(xml)
|
19
|
+
lambda { @flickr.urls.get_group("foo") }.should raise_error(Flickr::Error, /^1:/)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe ".get_user_photos" do
|
24
|
+
it "should return the url to a user's photos if the user_id is valid" do
|
25
|
+
xml = File.read(File.dirname(__FILE__) + "/../fixtures/flickr/urls/get_user_photos-0.xml")
|
26
|
+
@flickr.should_receive(:request_over_http).and_return(xml)
|
27
|
+
@flickr.urls.get_user_photos("80755658@N00").should == "http://www.flickr.com/photos/lvizard/"
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should raise an error if the user_id is not valid (User not found error raised)" do
|
31
|
+
xml = File.read(File.dirname(__FILE__) + "/../fixtures/flickr/urls/get_user_photos-fail-1.xml")
|
32
|
+
@flickr.should_receive(:request_over_http).and_return(xml)
|
33
|
+
lambda { @flickr.urls.get_user_photos("foo") }.should raise_error(Flickr::Error, /^1:/)
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should raise an error if the user_id is not specified (No user specified error raised)" do
|
37
|
+
xml = File.read(File.dirname(__FILE__) + "/../fixtures/flickr/urls/get_user_photos-fail-2.xml")
|
38
|
+
@flickr.should_receive(:request_over_http).and_return(xml)
|
39
|
+
lambda { @flickr.urls.get_user_photos(nil) }.should raise_error(Flickr::Error, /^2:/)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe ".get_user_profile" do
|
44
|
+
it "should return the url to a user's profile if the user_id is valid" do
|
45
|
+
xml = File.read(File.dirname(__FILE__) + "/../fixtures/flickr/urls/get_user_profile-0.xml")
|
46
|
+
@flickr.should_receive(:request_over_http).and_return(xml)
|
47
|
+
@flickr.urls.get_user_profile("80755658@N00").should == "http://www.flickr.com/people/lvizard/"
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should raise an error if the user_id is not valid (User not found error raised)" do
|
51
|
+
xml = File.read(File.dirname(__FILE__) + "/../fixtures/flickr/urls/get_user_profile-fail-1.xml")
|
52
|
+
@flickr.should_receive(:request_over_http).and_return(xml)
|
53
|
+
lambda { @flickr.urls.get_user_profile("foo") }.should raise_error(Flickr::Error, /^1:/)
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should raise an error if the user_id is not specified (No user specified error raised)" do
|
57
|
+
xml = File.read(File.dirname(__FILE__) + "/../fixtures/flickr/urls/get_user_profile-fail-2.xml")
|
58
|
+
@flickr.should_receive(:request_over_http).and_return(xml)
|
59
|
+
lambda { @flickr.urls.get_user_profile(nil) }.should raise_error(Flickr::Error, /^2:/)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe ".lookup_group" do
|
64
|
+
it "should return a group NSID, given the url to a group's page"
|
65
|
+
|
66
|
+
it "should return a group NSID, given the url to a group's photo pool"
|
67
|
+
|
68
|
+
it "should raise an error if the group_id is not valid (Group not found error raised)"
|
69
|
+
end
|
70
|
+
|
71
|
+
describe ".lookup_user" do
|
72
|
+
it "should return a user NSID, given the url to a user's photos"
|
73
|
+
|
74
|
+
it "should return a user NSID, given the url to a user's profile"
|
75
|
+
|
76
|
+
it "should raise an error if the user_id is not valid (User not found error raised)"
|
77
|
+
|
78
|
+
it "should raise an error if the user_id is not specified (No user specified error raised)"
|
79
|
+
|
80
|
+
describe "valid return value" do
|
81
|
+
before :all do
|
82
|
+
@valid_lookup_user_xml = File.read(File.dirname(__FILE__) + "/../fixtures/flickr/urls/lookup_user-0.xml")
|
83
|
+
end
|
84
|
+
|
85
|
+
|
86
|
+
it "should be kind of a String" do
|
87
|
+
@flickr.should_receive(:request_over_http).and_return(@valid_lookup_user_xml)
|
88
|
+
@flickr.urls.lookup_user("htp://www.flickr.com/photos/lvizard").should be_kind_of String
|
89
|
+
end
|
90
|
+
|
91
|
+
it "should have a username attribute containing the user's name" do
|
92
|
+
xml = File.read(File.dirname(__FILE__) + "/../fixtures/flickr/urls/lookup_user-0.xml")
|
93
|
+
@flickr.should_receive(:request_over_http).and_return(@valid_lookup_user_xml)
|
94
|
+
@flickr.urls.lookup_user("htp://www.flickr.com/photos/lvizard").username.should == "Maciej Biłas"
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
end
|
data/spec/spec.opts
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
gem 'rspec'
|
3
|
+
require 'spec'
|
4
|
+
|
5
|
+
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
6
|
+
require 'flickr_fu'
|
7
|
+
|
8
|
+
class SpecHelper
|
9
|
+
def self.flickr
|
10
|
+
Flickr.new(:key => "2f7bf3aceba0ca2f11f9ad46e7552459", :secret => "17b59864beb29370")
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class Hash
|
15
|
+
def strip_api_params!
|
16
|
+
delete :api_sig
|
17
|
+
delete :api_key
|
18
|
+
delete :api_token
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,121 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{tomk32-flickr_fu}
|
8
|
+
s.version = "0.3.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Ben Wyrosdick", "Maciej Bilas"]
|
12
|
+
s.date = %q{2009-11-08}
|
13
|
+
s.description = %q{Provides a ruby interface to flickr via the REST api}
|
14
|
+
s.email = %q{ben@commonthread.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"README"
|
17
|
+
]
|
18
|
+
s.files = [
|
19
|
+
".gitignore",
|
20
|
+
"LICENSE",
|
21
|
+
"README",
|
22
|
+
"Rakefile",
|
23
|
+
"VERSION.yml",
|
24
|
+
"tomk32-flickr_fu.gemspec",
|
25
|
+
"lib/flickr/auth.rb",
|
26
|
+
"lib/flickr/base.rb",
|
27
|
+
"lib/flickr/comment.rb",
|
28
|
+
"lib/flickr/contact.rb",
|
29
|
+
"lib/flickr/contacts.rb",
|
30
|
+
"lib/flickr/errors.rb",
|
31
|
+
"lib/flickr/geo.rb",
|
32
|
+
"lib/flickr/license.rb",
|
33
|
+
"lib/flickr/location.rb",
|
34
|
+
"lib/flickr/note.rb",
|
35
|
+
"lib/flickr/people.rb",
|
36
|
+
"lib/flickr/person.rb",
|
37
|
+
"lib/flickr/photo.rb",
|
38
|
+
"lib/flickr/photo_response.rb",
|
39
|
+
"lib/flickr/photos.rb",
|
40
|
+
"lib/flickr/photoset.rb",
|
41
|
+
"lib/flickr/photosets.rb",
|
42
|
+
"lib/flickr/size.rb",
|
43
|
+
"lib/flickr/status.rb",
|
44
|
+
"lib/flickr/test.rb",
|
45
|
+
"lib/flickr/token.rb",
|
46
|
+
"lib/flickr/uploader.rb",
|
47
|
+
"lib/flickr/urls.rb",
|
48
|
+
"lib/flickr_fu.rb",
|
49
|
+
"spec/fixtures/flickr/contacts/get_list-fail-99.xml",
|
50
|
+
"spec/fixtures/flickr/contacts/get_public_list-0.xml",
|
51
|
+
"spec/fixtures/flickr/photos/geo/get_location-0.xml",
|
52
|
+
"spec/fixtures/flickr/photos/geo/get_location-fail-2.xml",
|
53
|
+
"spec/fixtures/flickr/photos/get_info-0.xml",
|
54
|
+
"spec/fixtures/flickr/photos/get_info-1.xml",
|
55
|
+
"spec/fixtures/flickr/photos/get_sizes-0.xml",
|
56
|
+
"spec/fixtures/flickr/photos/get_sizes-1.xml",
|
57
|
+
"spec/fixtures/flickr/photos/licenses/get_info.xml",
|
58
|
+
"spec/fixtures/flickr/photosets/get_list-0.xml",
|
59
|
+
"spec/fixtures/flickr/photosets/get_photos-0.xml",
|
60
|
+
"spec/fixtures/flickr/test/echo-0.xml",
|
61
|
+
"spec/fixtures/flickr/test/null-fail-99.xml",
|
62
|
+
"spec/fixtures/flickr/urls/get_group-0.xml",
|
63
|
+
"spec/fixtures/flickr/urls/get_group-fail-1.xml",
|
64
|
+
"spec/fixtures/flickr/urls/get_user_photos-0.xml",
|
65
|
+
"spec/fixtures/flickr/urls/get_user_photos-fail-1.xml",
|
66
|
+
"spec/fixtures/flickr/urls/get_user_photos-fail-2.xml",
|
67
|
+
"spec/fixtures/flickr/urls/get_user_profile-0.xml",
|
68
|
+
"spec/fixtures/flickr/urls/get_user_profile-fail-1.xml",
|
69
|
+
"spec/fixtures/flickr/urls/get_user_profile-fail-2.xml",
|
70
|
+
"spec/fixtures/flickr/urls/lookup_group-0.xml",
|
71
|
+
"spec/fixtures/flickr/urls/lookup_group-fail-1.xml",
|
72
|
+
"spec/fixtures/flickr/urls/lookup_user-0.xml",
|
73
|
+
"spec/fixtures/flickr/videos/get_info-0.xml",
|
74
|
+
"spec/fixtures/flickr/videos/get_sizes-0.xml",
|
75
|
+
"spec/flickr/base_spec.rb",
|
76
|
+
"spec/flickr/contacts_spec.rb",
|
77
|
+
"spec/flickr/errors_spec.rb",
|
78
|
+
"spec/flickr/geo_spec.rb",
|
79
|
+
"spec/flickr/photo_spec.rb",
|
80
|
+
"spec/flickr/photos_spec.rb",
|
81
|
+
"spec/flickr/photosets_spec.rb",
|
82
|
+
"spec/flickr/test_spec.rb",
|
83
|
+
"spec/flickr/urls_spec.rb",
|
84
|
+
"spec/spec.opts",
|
85
|
+
"spec/spec_helper.rb"
|
86
|
+
]
|
87
|
+
s.homepage = %q{http://github.com/commonthread/flickr_fu}
|
88
|
+
s.rdoc_options = ["--main", "README"]
|
89
|
+
s.require_paths = ["lib"]
|
90
|
+
s.rubygems_version = %q{1.3.5}
|
91
|
+
s.summary = %q{Provides a ruby interface to flickr via the REST api}
|
92
|
+
s.test_files = [
|
93
|
+
"spec/flickr/base_spec.rb",
|
94
|
+
"spec/flickr/contacts_spec.rb",
|
95
|
+
"spec/flickr/errors_spec.rb",
|
96
|
+
"spec/flickr/geo_spec.rb",
|
97
|
+
"spec/flickr/photo_spec.rb",
|
98
|
+
"spec/flickr/photos_spec.rb",
|
99
|
+
"spec/flickr/photosets_spec.rb",
|
100
|
+
"spec/flickr/test_spec.rb",
|
101
|
+
"spec/flickr/urls_spec.rb",
|
102
|
+
"spec/spec_helper.rb"
|
103
|
+
]
|
104
|
+
|
105
|
+
if s.respond_to? :specification_version then
|
106
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
107
|
+
s.specification_version = 3
|
108
|
+
|
109
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
110
|
+
s.add_runtime_dependency(%q<mime-types>, ["> 0.0.0"])
|
111
|
+
s.add_runtime_dependency(%q<xml-magic>, ["> 0.0.0"])
|
112
|
+
else
|
113
|
+
s.add_dependency(%q<mime-types>, ["> 0.0.0"])
|
114
|
+
s.add_dependency(%q<xml-magic>, ["> 0.0.0"])
|
115
|
+
end
|
116
|
+
else
|
117
|
+
s.add_dependency(%q<mime-types>, ["> 0.0.0"])
|
118
|
+
s.add_dependency(%q<xml-magic>, ["> 0.0.0"])
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
metadata
ADDED
@@ -0,0 +1,151 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tomk32-flickr_fu
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ben Wyrosdick
|
8
|
+
- Maciej Bilas
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2009-11-08 00:00:00 +01:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: mime-types
|
18
|
+
type: :runtime
|
19
|
+
version_requirement:
|
20
|
+
version_requirements: !ruby/object:Gem::Requirement
|
21
|
+
requirements:
|
22
|
+
- - ">"
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 0.0.0
|
25
|
+
version:
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: xml-magic
|
28
|
+
type: :runtime
|
29
|
+
version_requirement:
|
30
|
+
version_requirements: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 0.0.0
|
35
|
+
version:
|
36
|
+
description: Provides a ruby interface to flickr via the REST api
|
37
|
+
email: ben@commonthread.com
|
38
|
+
executables: []
|
39
|
+
|
40
|
+
extensions: []
|
41
|
+
|
42
|
+
extra_rdoc_files:
|
43
|
+
- README
|
44
|
+
files:
|
45
|
+
- .gitignore
|
46
|
+
- LICENSE
|
47
|
+
- README
|
48
|
+
- Rakefile
|
49
|
+
- VERSION.yml
|
50
|
+
- tomk32-flickr_fu.gemspec
|
51
|
+
- lib/flickr/auth.rb
|
52
|
+
- lib/flickr/base.rb
|
53
|
+
- lib/flickr/comment.rb
|
54
|
+
- lib/flickr/contact.rb
|
55
|
+
- lib/flickr/contacts.rb
|
56
|
+
- lib/flickr/errors.rb
|
57
|
+
- lib/flickr/geo.rb
|
58
|
+
- lib/flickr/license.rb
|
59
|
+
- lib/flickr/location.rb
|
60
|
+
- lib/flickr/note.rb
|
61
|
+
- lib/flickr/people.rb
|
62
|
+
- lib/flickr/person.rb
|
63
|
+
- lib/flickr/photo.rb
|
64
|
+
- lib/flickr/photo_response.rb
|
65
|
+
- lib/flickr/photos.rb
|
66
|
+
- lib/flickr/photoset.rb
|
67
|
+
- lib/flickr/photosets.rb
|
68
|
+
- lib/flickr/size.rb
|
69
|
+
- lib/flickr/status.rb
|
70
|
+
- lib/flickr/test.rb
|
71
|
+
- lib/flickr/token.rb
|
72
|
+
- lib/flickr/uploader.rb
|
73
|
+
- lib/flickr/urls.rb
|
74
|
+
- lib/flickr_fu.rb
|
75
|
+
- spec/fixtures/flickr/contacts/get_list-fail-99.xml
|
76
|
+
- spec/fixtures/flickr/contacts/get_public_list-0.xml
|
77
|
+
- spec/fixtures/flickr/photos/geo/get_location-0.xml
|
78
|
+
- spec/fixtures/flickr/photos/geo/get_location-fail-2.xml
|
79
|
+
- spec/fixtures/flickr/photos/get_info-0.xml
|
80
|
+
- spec/fixtures/flickr/photos/get_info-1.xml
|
81
|
+
- spec/fixtures/flickr/photos/get_sizes-0.xml
|
82
|
+
- spec/fixtures/flickr/photos/get_sizes-1.xml
|
83
|
+
- spec/fixtures/flickr/photos/licenses/get_info.xml
|
84
|
+
- spec/fixtures/flickr/photosets/get_list-0.xml
|
85
|
+
- spec/fixtures/flickr/photosets/get_photos-0.xml
|
86
|
+
- spec/fixtures/flickr/test/echo-0.xml
|
87
|
+
- spec/fixtures/flickr/test/null-fail-99.xml
|
88
|
+
- spec/fixtures/flickr/urls/get_group-0.xml
|
89
|
+
- spec/fixtures/flickr/urls/get_group-fail-1.xml
|
90
|
+
- spec/fixtures/flickr/urls/get_user_photos-0.xml
|
91
|
+
- spec/fixtures/flickr/urls/get_user_photos-fail-1.xml
|
92
|
+
- spec/fixtures/flickr/urls/get_user_photos-fail-2.xml
|
93
|
+
- spec/fixtures/flickr/urls/get_user_profile-0.xml
|
94
|
+
- spec/fixtures/flickr/urls/get_user_profile-fail-1.xml
|
95
|
+
- spec/fixtures/flickr/urls/get_user_profile-fail-2.xml
|
96
|
+
- spec/fixtures/flickr/urls/lookup_group-0.xml
|
97
|
+
- spec/fixtures/flickr/urls/lookup_group-fail-1.xml
|
98
|
+
- spec/fixtures/flickr/urls/lookup_user-0.xml
|
99
|
+
- spec/fixtures/flickr/videos/get_info-0.xml
|
100
|
+
- spec/fixtures/flickr/videos/get_sizes-0.xml
|
101
|
+
- spec/flickr/base_spec.rb
|
102
|
+
- spec/flickr/contacts_spec.rb
|
103
|
+
- spec/flickr/errors_spec.rb
|
104
|
+
- spec/flickr/geo_spec.rb
|
105
|
+
- spec/flickr/photo_spec.rb
|
106
|
+
- spec/flickr/photos_spec.rb
|
107
|
+
- spec/flickr/photosets_spec.rb
|
108
|
+
- spec/flickr/test_spec.rb
|
109
|
+
- spec/flickr/urls_spec.rb
|
110
|
+
- spec/spec.opts
|
111
|
+
- spec/spec_helper.rb
|
112
|
+
has_rdoc: true
|
113
|
+
homepage: http://github.com/commonthread/flickr_fu
|
114
|
+
licenses: []
|
115
|
+
|
116
|
+
post_install_message:
|
117
|
+
rdoc_options:
|
118
|
+
- --main
|
119
|
+
- README
|
120
|
+
require_paths:
|
121
|
+
- lib
|
122
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: "0"
|
127
|
+
version:
|
128
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: "0"
|
133
|
+
version:
|
134
|
+
requirements: []
|
135
|
+
|
136
|
+
rubyforge_project:
|
137
|
+
rubygems_version: 1.3.5
|
138
|
+
signing_key:
|
139
|
+
specification_version: 3
|
140
|
+
summary: Provides a ruby interface to flickr via the REST api
|
141
|
+
test_files:
|
142
|
+
- spec/flickr/base_spec.rb
|
143
|
+
- spec/flickr/contacts_spec.rb
|
144
|
+
- spec/flickr/errors_spec.rb
|
145
|
+
- spec/flickr/geo_spec.rb
|
146
|
+
- spec/flickr/photo_spec.rb
|
147
|
+
- spec/flickr/photos_spec.rb
|
148
|
+
- spec/flickr/photosets_spec.rb
|
149
|
+
- spec/flickr/test_spec.rb
|
150
|
+
- spec/flickr/urls_spec.rb
|
151
|
+
- spec/spec_helper.rb
|