flickrie 0.5.2 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. data/.gitignore +0 -1
  2. data/CHANGELOG.md +10 -0
  3. data/Gemfile +3 -2
  4. data/Rakefile +7 -2
  5. data/flickrie.gemspec +3 -0
  6. data/lib/flickrie/api_methods.rb +5 -0
  7. data/lib/flickrie/client.rb +17 -4
  8. data/lib/flickrie/location.rb +23 -50
  9. data/lib/flickrie/media/exif.rb +4 -0
  10. data/lib/flickrie/media/tag.rb +4 -0
  11. data/lib/flickrie/media/ticket.rb +4 -0
  12. data/lib/flickrie/media/visibility.rb +10 -6
  13. data/lib/flickrie/media.rb +7 -70
  14. data/lib/flickrie/media_count.rb +4 -0
  15. data/lib/flickrie/oauth.rb +5 -3
  16. data/lib/flickrie/set.rb +5 -21
  17. data/lib/flickrie/upload_client.rb +4 -2
  18. data/lib/flickrie/user.rb +4 -1
  19. data/lib/flickrie/version.rb +1 -1
  20. data/lib/flickrie/video.rb +0 -13
  21. data/test/error_test.rb +20 -0
  22. data/test/instance_test.rb +13 -14
  23. data/test/license_test.rb +7 -13
  24. data/test/location_test.rb +11 -2
  25. data/test/media_count_test.rb +20 -12
  26. data/test/media_test.rb +319 -311
  27. data/test/oauth_test.rb +17 -18
  28. data/test/photo_test.rb +78 -60
  29. data/test/set_test.rb +72 -63
  30. data/test/{test.rb → test_helper.rb} +7 -0
  31. data/test/user_test.rb +43 -34
  32. data/test/vcr_cassettes/error/code.yml +1165 -0
  33. data/test/vcr_cassettes/instance/calling_api_methods.yml +182 -0
  34. data/test/vcr_cassettes/license/get_licenses.yml +73 -0
  35. data/test/vcr_cassettes/location/square_brackets.yml +85 -0
  36. data/test/vcr_cassettes/media/delete.yml +1380 -0
  37. data/test/vcr_cassettes/media/from_contacts.yml +155 -0
  38. data/test/vcr_cassettes/media/from_set.yml +276 -0
  39. data/test/vcr_cassettes/media/from_user.yml +275 -0
  40. data/test/vcr_cassettes/media/get_context.yml +73 -0
  41. data/test/vcr_cassettes/media/get_info.yml +167 -0
  42. data/test/vcr_cassettes/media/remove_tag.yml +264 -0
  43. data/test/vcr_cassettes/media/replace.yml +2252 -0
  44. data/test/vcr_cassettes/media/search.yml +275 -0
  45. data/test/vcr_cassettes/media/tags.yml +346 -0
  46. data/test/vcr_cassettes/media_count/get.yml +135 -0
  47. data/test/vcr_cassettes/media_count/square_brackets.yml +69 -0
  48. data/test/vcr_cassettes/oauth/tokens.yml +400 -0
  49. data/test/vcr_cassettes/photo/asynchronous_upload.yml +1693 -0
  50. data/test/vcr_cassettes/photo/from_set.yml +273 -0
  51. data/test/vcr_cassettes/photo/from_user.yml +275 -0
  52. data/test/vcr_cassettes/photo/get_exif.yml +239 -0
  53. data/test/vcr_cassettes/photo/get_sizes.yml +147 -0
  54. data/test/vcr_cassettes/photo/other_api_calls.yml +506 -0
  55. data/test/vcr_cassettes/photo/search.yml +271 -0
  56. data/test/vcr_cassettes/photo/square_brackets.yml +85 -0
  57. data/test/vcr_cassettes/photo/upload.yml +1229 -0
  58. data/test/vcr_cassettes/set/from_user.yml +477 -0
  59. data/test/vcr_cassettes/set/get_info.yml +951 -0
  60. data/test/vcr_cassettes/set/square_brackets.yml +73 -0
  61. data/test/vcr_cassettes/user/find_by_email_or_username.yml +135 -0
  62. data/test/vcr_cassettes/user/get_info.yml +151 -0
  63. data/test/vcr_cassettes/user/square_brackets.yml +77 -0
  64. data/test/vcr_cassettes/video/get_exif.yml +135 -0
  65. data/test/vcr_cassettes/video/get_info.yml +86 -0
  66. data/test/vcr_cassettes/video/get_sizes.yml +151 -0
  67. data/test/vcr_cassettes/video/other_api_calls.yml +643 -0
  68. data/test/vcr_cassettes/video/square_brackets.yml +86 -0
  69. data/test/vcr_cassettes/video/upload.yml +308 -0
  70. data/test/video_test.rb +66 -53
  71. 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
- licenses = Flickrie.get_licenses
9
+ VCR.use_cassette 'license/get_licenses' do
10
+ licenses = Flickrie.get_licenses
18
11
 
19
- licenses.each do |license|
20
- assert_includes ('0'..'8'), license.id
21
- assert_instance_of String, license.name
22
- assert_instance_of String, license.url
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
@@ -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
@@ -1,17 +1,25 @@
1
- require 'test'
2
-
3
1
  class MediaCountTest < Test::Unit::TestCase
4
- def test_get_media_count
5
- dates = [DateTime.parse("1st March 2012"), DateTime.parse("5th May 2012")].map(&:to_time)
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
- count = Flickrie.get_media_counts(:taken_dates => dates.join(',')).first
8
- assert_instance_of Fixnum, count.value
9
- assert_equal dates.first, count.date_range.begin
10
- assert_equal dates.last, count.date_range.end
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
- count = Flickrie.get_media_counts(:dates => dates.map(&:to_i).join(',')).first
13
- assert_instance_of Fixnum, count.value
14
- assert_equal dates.first, count.date_range.begin
15
- assert_equal dates.last, count.date_range.end
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