commonthread-flickr_fu 0.2.2 → 0.3.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.
Files changed (53) hide show
  1. data/.gitignore +13 -0
  2. data/Rakefile +40 -8
  3. data/VERSION.yml +4 -0
  4. data/flickr_fu.gemspec +114 -33
  5. data/lib/flickr/base.rb +49 -22
  6. data/lib/flickr/contact.rb +16 -0
  7. data/lib/flickr/contacts.rb +55 -0
  8. data/lib/flickr/geo.rb +42 -0
  9. data/lib/flickr/location.rb +15 -0
  10. data/lib/flickr/photo.rb +23 -0
  11. data/lib/flickr/photos.rb +6 -1
  12. data/lib/flickr/photoset.rb +36 -0
  13. data/lib/flickr/photosets.rb +36 -0
  14. data/lib/flickr/urls.rb +44 -0
  15. data/lib/flickr_fu.rb +23 -1
  16. data/spec/fixtures/flickr/contacts/get_list-fail-99.xml +4 -0
  17. data/spec/fixtures/flickr/contacts/get_public_list-0.xml +7 -0
  18. data/spec/fixtures/flickr/photos/geo/get_location-0.xml +11 -0
  19. data/spec/fixtures/flickr/photos/geo/get_location-fail-2.xml +4 -0
  20. data/spec/fixtures/flickr/photos/get_info-0.xml +41 -0
  21. data/spec/fixtures/flickr/photos/get_info-1.xml +19 -0
  22. data/spec/fixtures/flickr/photos/get_sizes-0.xml +10 -0
  23. data/spec/fixtures/flickr/photos/get_sizes-1.xml +8 -0
  24. data/spec/fixtures/flickr/photos/licenses/get_info.xml +12 -0
  25. data/spec/fixtures/flickr/photosets/get_list-0.xml +13 -0
  26. data/spec/fixtures/flickr/photosets/get_photos-0.xml +7 -0
  27. data/spec/fixtures/flickr/test/echo-0.xml +5 -0
  28. data/spec/fixtures/flickr/test/null-fail-99.xml +4 -0
  29. data/spec/fixtures/flickr/urls/get_group-0.xml +4 -0
  30. data/spec/fixtures/flickr/urls/get_group-fail-1.xml +4 -0
  31. data/spec/fixtures/flickr/urls/get_user_photos-0.xml +4 -0
  32. data/spec/fixtures/flickr/urls/get_user_photos-fail-1.xml +4 -0
  33. data/spec/fixtures/flickr/urls/get_user_photos-fail-2.xml +4 -0
  34. data/spec/fixtures/flickr/urls/get_user_profile-0.xml +4 -0
  35. data/spec/fixtures/flickr/urls/get_user_profile-fail-1.xml +4 -0
  36. data/spec/fixtures/flickr/urls/get_user_profile-fail-2.xml +4 -0
  37. data/spec/fixtures/flickr/urls/lookup_group-0.xml +6 -0
  38. data/spec/fixtures/flickr/urls/lookup_group-fail-1.xml +4 -0
  39. data/spec/fixtures/flickr/urls/lookup_user-0.xml +6 -0
  40. data/spec/fixtures/flickr/videos/get_info-0.xml +31 -0
  41. data/spec/fixtures/flickr/videos/get_sizes-0.xml +13 -0
  42. data/spec/flickr/base_spec.rb +97 -0
  43. data/spec/flickr/contacts_spec.rb +47 -0
  44. data/spec/flickr/errors_spec.rb +21 -0
  45. data/spec/flickr/geo_spec.rb +20 -0
  46. data/spec/flickr/photo_spec.rb +123 -0
  47. data/spec/flickr/photos_spec.rb +50 -0
  48. data/spec/flickr/photosets_spec.rb +49 -0
  49. data/spec/flickr/test_spec.rb +34 -0
  50. data/spec/flickr/urls_spec.rb +99 -0
  51. data/spec/spec.opts +4 -0
  52. data/spec/spec_helper.rb +20 -0
  53. metadata +65 -7
@@ -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
@@ -0,0 +1,4 @@
1
+ --colour
2
+ --format progress
3
+ --loadby mtime
4
+ --reverse
@@ -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
metadata CHANGED
@@ -1,19 +1,21 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: commonthread-flickr_fu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Wyrosdick
8
+ - Maciej Bilas
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
12
 
12
- date: 2008-12-30 00:00:00 -08:00
13
+ date: 2009-05-19 00:00:00 -07:00
13
14
  default_executable:
14
15
  dependencies:
15
16
  - !ruby/object:Gem::Dependency
16
17
  name: mime-types
18
+ type: :runtime
17
19
  version_requirement:
18
20
  version_requirements: !ruby/object:Gem::Requirement
19
21
  requirements:
@@ -23,6 +25,7 @@ dependencies:
23
25
  version:
24
26
  - !ruby/object:Gem::Dependency
25
27
  name: xml-magic
28
+ type: :runtime
26
29
  version_requirement:
27
30
  version_requirements: !ruby/object:Gem::Requirement
28
31
  requirements:
@@ -39,28 +42,74 @@ extensions: []
39
42
  extra_rdoc_files:
40
43
  - README
41
44
  files:
42
- - README
45
+ - .gitignore
43
46
  - LICENSE
47
+ - README
44
48
  - Rakefile
49
+ - VERSION.yml
45
50
  - flickr_fu.gemspec
46
51
  - lib/flickr/auth.rb
47
52
  - lib/flickr/base.rb
48
53
  - lib/flickr/comment.rb
54
+ - lib/flickr/contact.rb
55
+ - lib/flickr/contacts.rb
49
56
  - lib/flickr/errors.rb
57
+ - lib/flickr/geo.rb
50
58
  - lib/flickr/license.rb
59
+ - lib/flickr/location.rb
51
60
  - lib/flickr/note.rb
52
61
  - lib/flickr/people.rb
53
62
  - lib/flickr/person.rb
54
63
  - lib/flickr/photo.rb
55
64
  - lib/flickr/photo_response.rb
56
65
  - lib/flickr/photos.rb
66
+ - lib/flickr/photoset.rb
67
+ - lib/flickr/photosets.rb
57
68
  - lib/flickr/size.rb
58
69
  - lib/flickr/status.rb
59
70
  - lib/flickr/test.rb
60
71
  - lib/flickr/token.rb
61
72
  - lib/flickr/uploader.rb
73
+ - lib/flickr/urls.rb
62
74
  - lib/flickr_fu.rb
63
- has_rdoc: true
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: false
64
113
  homepage: http://github.com/commonthread/flickr_fu
65
114
  post_install_message:
66
115
  rdoc_options:
@@ -85,7 +134,16 @@ requirements: []
85
134
  rubyforge_project:
86
135
  rubygems_version: 1.2.0
87
136
  signing_key:
88
- specification_version: 2
137
+ specification_version: 3
89
138
  summary: Provides a ruby interface to flickr via the REST api
90
- test_files: []
91
-
139
+ test_files:
140
+ - spec/spec_helper.rb
141
+ - spec/flickr/test_spec.rb
142
+ - spec/flickr/geo_spec.rb
143
+ - spec/flickr/contacts_spec.rb
144
+ - spec/flickr/urls_spec.rb
145
+ - spec/flickr/errors_spec.rb
146
+ - spec/flickr/base_spec.rb
147
+ - spec/flickr/photo_spec.rb
148
+ - spec/flickr/photosets_spec.rb
149
+ - spec/flickr/photos_spec.rb