flickrie 0.6.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/CHANGELOG.md +22 -0
- data/Gemfile +0 -6
- data/README.md +15 -1
- data/Rakefile +8 -13
- data/api_methods.md +1 -1
- data/flickrie.gemspec +2 -3
- data/lib/flickrie/api_methods.rb +17 -0
- data/lib/flickrie/client.rb +21 -5
- data/lib/flickrie/instance.rb +7 -2
- data/lib/flickrie/license.rb +2 -0
- data/lib/flickrie/location.rb +10 -8
- data/lib/flickrie/media/exif.rb +3 -1
- data/lib/flickrie/media/tag.rb +3 -3
- data/lib/flickrie/media/visibility.rb +6 -4
- data/lib/flickrie/media.rb +69 -84
- data/lib/flickrie/media_count.rb +3 -5
- data/lib/flickrie/photo.rb +55 -54
- data/lib/flickrie/set.rb +31 -25
- data/lib/flickrie/ticket.rb +4 -8
- data/lib/flickrie/upload_client.rb +7 -2
- data/lib/flickrie/user.rb +33 -34
- data/lib/flickrie/version.rb +1 -1
- data/lib/flickrie/video.rb +13 -12
- data/spec/api_methods_spec.rb +43 -0
- data/spec/error_spec.rb +32 -0
- data/{test → spec/files}/photo.jpg +0 -0
- data/{test → spec/files}/video.mov +0 -0
- data/spec/instance_spec.rb +22 -0
- data/spec/license_spec.rb +15 -0
- data/spec/location_spec.rb +11 -0
- data/spec/media_count_spec.rb +18 -0
- data/spec/media_spec.rb +271 -0
- data/spec/oauth_spec.rb +22 -0
- data/spec/photo_spec.rb +137 -0
- data/spec/set_spec.rb +68 -0
- data/spec/spec_helper.rb +68 -0
- data/spec/user_spec.rb +56 -0
- data/spec/video_spec.rb +54 -0
- metadata +47 -132
- data/test/error_test.rb +0 -20
- data/test/instance_test.rb +0 -20
- data/test/license_test.rb +0 -19
- data/test/location_test.rb +0 -29
- data/test/media_count_test.rb +0 -25
- data/test/media_test.rb +0 -432
- data/test/oauth_test.rb +0 -25
- data/test/photo_test.rb +0 -212
- data/test/set_test.rb +0 -92
- data/test/test_helper.rb +0 -14
- data/test/user_test.rb +0 -70
- data/test/vcr_cassettes/error/code.yml +0 -1165
- data/test/vcr_cassettes/instance/calling_api_methods.yml +0 -182
- data/test/vcr_cassettes/license/get_licenses.yml +0 -73
- data/test/vcr_cassettes/location/square_brackets.yml +0 -85
- data/test/vcr_cassettes/media/delete.yml +0 -1380
- data/test/vcr_cassettes/media/from_contacts.yml +0 -155
- data/test/vcr_cassettes/media/from_set.yml +0 -276
- data/test/vcr_cassettes/media/from_user.yml +0 -275
- data/test/vcr_cassettes/media/get_context.yml +0 -73
- data/test/vcr_cassettes/media/get_info.yml +0 -167
- data/test/vcr_cassettes/media/remove_tag.yml +0 -264
- data/test/vcr_cassettes/media/replace.yml +0 -2252
- data/test/vcr_cassettes/media/search.yml +0 -275
- data/test/vcr_cassettes/media/tags.yml +0 -346
- data/test/vcr_cassettes/media_count/get.yml +0 -135
- data/test/vcr_cassettes/media_count/square_brackets.yml +0 -69
- data/test/vcr_cassettes/oauth/tokens.yml +0 -400
- data/test/vcr_cassettes/photo/asynchronous_upload.yml +0 -1693
- data/test/vcr_cassettes/photo/from_set.yml +0 -273
- data/test/vcr_cassettes/photo/from_user.yml +0 -275
- data/test/vcr_cassettes/photo/get_exif.yml +0 -239
- data/test/vcr_cassettes/photo/get_sizes.yml +0 -147
- data/test/vcr_cassettes/photo/other_api_calls.yml +0 -506
- data/test/vcr_cassettes/photo/search.yml +0 -271
- data/test/vcr_cassettes/photo/square_brackets.yml +0 -85
- data/test/vcr_cassettes/photo/upload.yml +0 -1229
- data/test/vcr_cassettes/set/from_user.yml +0 -477
- data/test/vcr_cassettes/set/get_info.yml +0 -951
- data/test/vcr_cassettes/set/square_brackets.yml +0 -73
- data/test/vcr_cassettes/user/find_by_email_or_username.yml +0 -135
- data/test/vcr_cassettes/user/get_info.yml +0 -151
- data/test/vcr_cassettes/user/square_brackets.yml +0 -77
- data/test/vcr_cassettes/video/get_exif.yml +0 -135
- data/test/vcr_cassettes/video/get_info.yml +0 -86
- data/test/vcr_cassettes/video/get_sizes.yml +0 -151
- data/test/vcr_cassettes/video/other_api_calls.yml +0 -643
- data/test/vcr_cassettes/video/square_brackets.yml +0 -86
- data/test/vcr_cassettes/video/upload.yml +0 -308
- data/test/video_test.rb +0 -118
data/test/set_test.rb
DELETED
@@ -1,92 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
Flickrie::Set.instance_eval do
|
4
|
-
def public_new(*args)
|
5
|
-
new(*args)
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
class SetTest < Test::Unit::TestCase
|
10
|
-
def setup
|
11
|
-
@set_id = 72157629851991663
|
12
|
-
@user_nsid = '67131352@N04'
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_square_brackets
|
16
|
-
VCR.use_cassette 'set/square_brackets' do
|
17
|
-
set = Flickrie.get_set_info(@set_id)
|
18
|
-
assert_equal @set_id, set['id'].to_i
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_get_info
|
23
|
-
VCR.use_cassette 'set/get_info' do
|
24
|
-
[Flickrie.get_set_info(@set_id),
|
25
|
-
Flickrie::Set.public_new('id' => @set_id.to_s).get_info].
|
26
|
-
each do |set|
|
27
|
-
assert_equal @set_id, set.id.to_i
|
28
|
-
assert_equal @user_nsid, set.owner.nsid
|
29
|
-
assert_equal '6946979188', set.primary_media_id
|
30
|
-
assert_equal '25bb44852b', set.secret
|
31
|
-
assert_equal '7049', set.server
|
32
|
-
assert_equal 8, set.farm
|
33
|
-
assert_equal 'Speleologija', set.title
|
34
|
-
assert_equal 'Slike sa škole speleologije Velebit.', set.description
|
35
|
-
|
36
|
-
assert_equal 98, set.media_count
|
37
|
-
assert_equal 97, set.photos_count
|
38
|
-
assert_equal 1, set.videos_count
|
39
|
-
assert_equal 0, set.comments_count
|
40
|
-
assert_equal 0, set.views_count
|
41
|
-
|
42
|
-
assert set.photos.all? { |photo| photo.is_a?(Flickrie::Photo) }
|
43
|
-
assert set.videos.all? { |video| video.is_a?(Flickrie::Video) }
|
44
|
-
assert set.media.find { |media| media.is_a?(Flickrie::Photo) }
|
45
|
-
assert set.media.find { |media| media.is_a?(Flickrie::Video) }
|
46
|
-
|
47
|
-
assert_equal true, set.can_comment?
|
48
|
-
|
49
|
-
assert_instance_of Time, set.created_at
|
50
|
-
assert_instance_of Time, set.updated_at
|
51
|
-
|
52
|
-
refute set.url.empty?
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
def test_from_user
|
58
|
-
VCR.use_cassette 'set/from_user' do
|
59
|
-
set = Flickrie.sets_from_user(@user_nsid).
|
60
|
-
find { |set| set.id.to_i == @set_id }
|
61
|
-
|
62
|
-
assert_equal @set_id, set.id.to_i
|
63
|
-
assert_equal @user_nsid, set.owner.nsid
|
64
|
-
assert_equal '6946979188', set.primary_media_id
|
65
|
-
assert_equal '25bb44852b', set.secret
|
66
|
-
assert_equal '7049', set.server
|
67
|
-
assert_equal 8, set.farm
|
68
|
-
assert_equal 'Speleologija', set.title
|
69
|
-
assert_equal 'Slike sa škole speleologije Velebit.', set.description
|
70
|
-
|
71
|
-
assert_equal 98, set.media_count
|
72
|
-
assert_equal 97, set.photos_count
|
73
|
-
assert_equal 1, set.videos_count
|
74
|
-
assert_equal 0, set.comments_count
|
75
|
-
assert_equal 0, set.views_count
|
76
|
-
|
77
|
-
assert set.photos.all? { |photo| photo.is_a?(Flickrie::Photo) }
|
78
|
-
assert set.videos.all? { |video| video.is_a?(Flickrie::Video) }
|
79
|
-
assert set.media.find { |media| media.is_a?(Flickrie::Photo) }
|
80
|
-
assert set.media.find { |media| media.is_a?(Flickrie::Video) }
|
81
|
-
|
82
|
-
assert_equal true, set.can_comment?
|
83
|
-
assert_equal false, set.needs_interstitial?
|
84
|
-
assert_equal true, set.visibility_can_see_set?
|
85
|
-
|
86
|
-
assert_instance_of Time, set.created_at
|
87
|
-
assert_instance_of Time, set.updated_at
|
88
|
-
|
89
|
-
refute set.url.empty?
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
data/test/test_helper.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
require 'flickrie'
|
3
|
-
|
4
|
-
Flickrie.api_key = ENV['FLICKR_API_KEY']
|
5
|
-
Flickrie.shared_secret = ENV['FLICKR_SHARED_SECRET']
|
6
|
-
Flickrie.access_token = ENV['FLICKR_ACCESS_TOKEN']
|
7
|
-
Flickrie.access_secret = ENV['FLICKR_ACCESS_SECRET']
|
8
|
-
|
9
|
-
require 'vcr'
|
10
|
-
|
11
|
-
VCR.configure do |c|
|
12
|
-
c.cassette_library_dir = 'test/vcr_cassettes'
|
13
|
-
c.hook_into :webmock
|
14
|
-
end
|
data/test/user_test.rb
DELETED
@@ -1,70 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
Flickrie::User.instance_eval do
|
4
|
-
def public_new(*args)
|
5
|
-
new(*args)
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
class UserTest < Test::Unit::TestCase
|
10
|
-
def setup
|
11
|
-
@user_nsid = '67131352@N04'
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_square_brackets
|
15
|
-
VCR.use_cassette 'user/square_brackets' do
|
16
|
-
user = Flickrie.get_user_info(@user_nsid)
|
17
|
-
assert_equal user['nsid'], user.nsid
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_get_info
|
22
|
-
VCR.use_cassette 'user/get_info' do
|
23
|
-
[Flickrie.get_user_info(@user_nsid),
|
24
|
-
Flickrie::User.public_new('nsid' => @user_nsid).get_info].
|
25
|
-
each do |user|
|
26
|
-
assert_equal @user_nsid, user.id
|
27
|
-
assert_equal @user_nsid, user.nsid
|
28
|
-
assert_equal 'Janko Marohnić', user.username
|
29
|
-
assert_equal 'Janko Marohnić', user.real_name
|
30
|
-
assert_equal 'Zagreb, Croatia', user.location
|
31
|
-
assert_equal 'Sarajevo, Skopje, Warsaw, Zagreb', user.time_zone['label']
|
32
|
-
assert_equal '+01:00', user.time_zone['offset']
|
33
|
-
assert_equal <<-DESCRIPTION.chomp.lstrip, user.description
|
34
|
-
I'm a programmer, and I'm gonna program a badass Ruby library for Flickr.
|
35
|
-
DESCRIPTION
|
36
|
-
|
37
|
-
refute user.profile_url.empty?
|
38
|
-
refute user.mobile_url.empty?
|
39
|
-
refute user.photos_url.empty?
|
40
|
-
|
41
|
-
assert_equal '5464', user.icon_server
|
42
|
-
assert_equal 6, user.icon_farm
|
43
|
-
refute user.buddy_icon_url.empty?
|
44
|
-
|
45
|
-
assert_equal false, user.pro?
|
46
|
-
|
47
|
-
assert_instance_of Time, user.first_taken
|
48
|
-
assert_instance_of Time, user.first_uploaded
|
49
|
-
|
50
|
-
assert_equal 98, user.media_count
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
def test_find_by_username_or_email
|
56
|
-
VCR.use_cassette 'user/find_by_email_or_username' do
|
57
|
-
user = Flickrie.find_user_by_username('Janko Marohnić')
|
58
|
-
|
59
|
-
assert_equal @user_nsid, user.id
|
60
|
-
assert_equal @user_nsid, user.nsid
|
61
|
-
assert_equal 'Janko Marohnić', user.username
|
62
|
-
|
63
|
-
user = Flickrie.find_user_by_email('janko.marohnic@gmail.com')
|
64
|
-
|
65
|
-
assert_equal @user_nsid, user.id
|
66
|
-
assert_equal @user_nsid, user.nsid
|
67
|
-
assert_equal 'Janko Marohnić', user.username
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|