flickrie 0.5.2 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +0 -1
- data/CHANGELOG.md +10 -0
- data/Gemfile +3 -2
- data/Rakefile +7 -2
- data/flickrie.gemspec +3 -0
- data/lib/flickrie/api_methods.rb +5 -0
- data/lib/flickrie/client.rb +17 -4
- data/lib/flickrie/location.rb +23 -50
- data/lib/flickrie/media/exif.rb +4 -0
- data/lib/flickrie/media/tag.rb +4 -0
- data/lib/flickrie/media/ticket.rb +4 -0
- data/lib/flickrie/media/visibility.rb +10 -6
- data/lib/flickrie/media.rb +7 -70
- data/lib/flickrie/media_count.rb +4 -0
- data/lib/flickrie/oauth.rb +5 -3
- data/lib/flickrie/set.rb +5 -21
- data/lib/flickrie/upload_client.rb +4 -2
- data/lib/flickrie/user.rb +4 -1
- data/lib/flickrie/version.rb +1 -1
- data/lib/flickrie/video.rb +0 -13
- data/test/error_test.rb +20 -0
- data/test/instance_test.rb +13 -14
- data/test/license_test.rb +7 -13
- data/test/location_test.rb +11 -2
- data/test/media_count_test.rb +20 -12
- data/test/media_test.rb +319 -311
- data/test/oauth_test.rb +17 -18
- data/test/photo_test.rb +78 -60
- data/test/set_test.rb +72 -63
- data/test/{test.rb → test_helper.rb} +7 -0
- data/test/user_test.rb +43 -34
- data/test/vcr_cassettes/error/code.yml +1165 -0
- data/test/vcr_cassettes/instance/calling_api_methods.yml +182 -0
- data/test/vcr_cassettes/license/get_licenses.yml +73 -0
- data/test/vcr_cassettes/location/square_brackets.yml +85 -0
- data/test/vcr_cassettes/media/delete.yml +1380 -0
- data/test/vcr_cassettes/media/from_contacts.yml +155 -0
- data/test/vcr_cassettes/media/from_set.yml +276 -0
- data/test/vcr_cassettes/media/from_user.yml +275 -0
- data/test/vcr_cassettes/media/get_context.yml +73 -0
- data/test/vcr_cassettes/media/get_info.yml +167 -0
- data/test/vcr_cassettes/media/remove_tag.yml +264 -0
- data/test/vcr_cassettes/media/replace.yml +2252 -0
- data/test/vcr_cassettes/media/search.yml +275 -0
- data/test/vcr_cassettes/media/tags.yml +346 -0
- data/test/vcr_cassettes/media_count/get.yml +135 -0
- data/test/vcr_cassettes/media_count/square_brackets.yml +69 -0
- data/test/vcr_cassettes/oauth/tokens.yml +400 -0
- data/test/vcr_cassettes/photo/asynchronous_upload.yml +1693 -0
- data/test/vcr_cassettes/photo/from_set.yml +273 -0
- data/test/vcr_cassettes/photo/from_user.yml +275 -0
- data/test/vcr_cassettes/photo/get_exif.yml +239 -0
- data/test/vcr_cassettes/photo/get_sizes.yml +147 -0
- data/test/vcr_cassettes/photo/other_api_calls.yml +506 -0
- data/test/vcr_cassettes/photo/search.yml +271 -0
- data/test/vcr_cassettes/photo/square_brackets.yml +85 -0
- data/test/vcr_cassettes/photo/upload.yml +1229 -0
- data/test/vcr_cassettes/set/from_user.yml +477 -0
- data/test/vcr_cassettes/set/get_info.yml +951 -0
- data/test/vcr_cassettes/set/square_brackets.yml +73 -0
- data/test/vcr_cassettes/user/find_by_email_or_username.yml +135 -0
- data/test/vcr_cassettes/user/get_info.yml +151 -0
- data/test/vcr_cassettes/user/square_brackets.yml +77 -0
- data/test/vcr_cassettes/video/get_exif.yml +135 -0
- data/test/vcr_cassettes/video/get_info.yml +86 -0
- data/test/vcr_cassettes/video/get_sizes.yml +151 -0
- data/test/vcr_cassettes/video/other_api_calls.yml +643 -0
- data/test/vcr_cassettes/video/square_brackets.yml +86 -0
- data/test/vcr_cassettes/video/upload.yml +308 -0
- data/test/video_test.rb +66 -53
- metadata +123 -12
data/test/license_test.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'test'
|
2
|
-
|
3
1
|
Flickrie::License.instance_eval do
|
4
2
|
def public_response_array
|
5
3
|
response_array
|
@@ -7,19 +5,15 @@ Flickrie::License.instance_eval do
|
|
7
5
|
end
|
8
6
|
|
9
7
|
class LicenseTest < Test::Unit::TestCase
|
10
|
-
def test_licenses_staying_the_same
|
11
|
-
licenses_array = Flickrie.client.get_licenses.body['licenses']['license']
|
12
|
-
assert_equal licenses_array.sort_by { |hash| hash['id'] },
|
13
|
-
Flickrie::License.public_response_array
|
14
|
-
end
|
15
|
-
|
16
8
|
def test_get_licenses
|
17
|
-
|
9
|
+
VCR.use_cassette 'license/get_licenses' do
|
10
|
+
licenses = Flickrie.get_licenses
|
18
11
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
12
|
+
licenses.each do |license|
|
13
|
+
assert_includes ('0'..'8'), license.id
|
14
|
+
assert_instance_of String, license.name
|
15
|
+
assert_instance_of String, license.url
|
16
|
+
end
|
23
17
|
end
|
24
18
|
end
|
25
19
|
end
|
data/test/location_test.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
-
require 'test'
|
2
|
-
|
3
1
|
class LocationTest < Test::Unit::TestCase
|
2
|
+
def setup
|
3
|
+
@media_id = 6946979188
|
4
|
+
end
|
5
|
+
|
4
6
|
def test_attributes_returning_nil
|
5
7
|
location = Flickrie::Location.new
|
6
8
|
|
@@ -17,4 +19,11 @@ class LocationTest < Test::Unit::TestCase
|
|
17
19
|
assert_nil location.region
|
18
20
|
assert_nil location.country
|
19
21
|
end
|
22
|
+
|
23
|
+
def test_square_brackets
|
24
|
+
VCR.use_cassette 'location/square_brackets' do
|
25
|
+
media = Flickrie.get_media_info(@media_id)
|
26
|
+
assert_equal media.location['woeid'], media.location.woeid
|
27
|
+
end
|
28
|
+
end
|
20
29
|
end
|
data/test/media_count_test.rb
CHANGED
@@ -1,17 +1,25 @@
|
|
1
|
-
require 'test'
|
2
|
-
|
3
1
|
class MediaCountTest < Test::Unit::TestCase
|
4
|
-
def
|
5
|
-
|
2
|
+
def test_get
|
3
|
+
VCR.use_cassette 'media_count/get' do
|
4
|
+
dates = [DateTime.parse("1st March 2012"), DateTime.parse("5th May 2012")].map(&:to_time)
|
5
|
+
|
6
|
+
count = Flickrie.get_media_counts(:taken_dates => dates.join(',')).first
|
7
|
+
assert_instance_of Fixnum, count.value
|
8
|
+
assert_equal dates.first, count.date_range.begin
|
9
|
+
assert_equal dates.last, count.date_range.end
|
6
10
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
+
count = Flickrie.get_media_counts(:dates => dates.map(&:to_i).join(',')).first
|
12
|
+
assert_instance_of Fixnum, count.value
|
13
|
+
assert_equal dates.first, count.date_range.begin
|
14
|
+
assert_equal dates.last, count.date_range.end
|
15
|
+
end
|
16
|
+
end
|
11
17
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
18
|
+
def test_square_brackets
|
19
|
+
VCR.use_cassette 'media_count/square_brackets' do
|
20
|
+
dates = [DateTime.parse("1st March 2012"), DateTime.parse("5th May 2012")].map(&:to_time)
|
21
|
+
count = Flickrie.get_media_counts(:taken_dates => dates.join(',')).first
|
22
|
+
assert_equal '1', count['count']
|
23
|
+
end
|
16
24
|
end
|
17
25
|
end
|