flickrie 0.6.1 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. data/.gitignore +1 -0
  2. data/CHANGELOG.md +22 -0
  3. data/Gemfile +0 -6
  4. data/README.md +15 -1
  5. data/Rakefile +8 -13
  6. data/api_methods.md +1 -1
  7. data/flickrie.gemspec +2 -3
  8. data/lib/flickrie/api_methods.rb +17 -0
  9. data/lib/flickrie/client.rb +21 -5
  10. data/lib/flickrie/instance.rb +7 -2
  11. data/lib/flickrie/license.rb +2 -0
  12. data/lib/flickrie/location.rb +10 -8
  13. data/lib/flickrie/media/exif.rb +3 -1
  14. data/lib/flickrie/media/tag.rb +3 -3
  15. data/lib/flickrie/media/visibility.rb +6 -4
  16. data/lib/flickrie/media.rb +69 -84
  17. data/lib/flickrie/media_count.rb +3 -5
  18. data/lib/flickrie/photo.rb +55 -54
  19. data/lib/flickrie/set.rb +31 -25
  20. data/lib/flickrie/ticket.rb +4 -8
  21. data/lib/flickrie/upload_client.rb +7 -2
  22. data/lib/flickrie/user.rb +33 -34
  23. data/lib/flickrie/version.rb +1 -1
  24. data/lib/flickrie/video.rb +13 -12
  25. data/spec/api_methods_spec.rb +43 -0
  26. data/spec/error_spec.rb +32 -0
  27. data/{test → spec/files}/photo.jpg +0 -0
  28. data/{test → spec/files}/video.mov +0 -0
  29. data/spec/instance_spec.rb +22 -0
  30. data/spec/license_spec.rb +15 -0
  31. data/spec/location_spec.rb +11 -0
  32. data/spec/media_count_spec.rb +18 -0
  33. data/spec/media_spec.rb +271 -0
  34. data/spec/oauth_spec.rb +22 -0
  35. data/spec/photo_spec.rb +137 -0
  36. data/spec/set_spec.rb +68 -0
  37. data/spec/spec_helper.rb +68 -0
  38. data/spec/user_spec.rb +56 -0
  39. data/spec/video_spec.rb +54 -0
  40. metadata +47 -132
  41. data/test/error_test.rb +0 -20
  42. data/test/instance_test.rb +0 -20
  43. data/test/license_test.rb +0 -19
  44. data/test/location_test.rb +0 -29
  45. data/test/media_count_test.rb +0 -25
  46. data/test/media_test.rb +0 -432
  47. data/test/oauth_test.rb +0 -25
  48. data/test/photo_test.rb +0 -212
  49. data/test/set_test.rb +0 -92
  50. data/test/test_helper.rb +0 -14
  51. data/test/user_test.rb +0 -70
  52. data/test/vcr_cassettes/error/code.yml +0 -1165
  53. data/test/vcr_cassettes/instance/calling_api_methods.yml +0 -182
  54. data/test/vcr_cassettes/license/get_licenses.yml +0 -73
  55. data/test/vcr_cassettes/location/square_brackets.yml +0 -85
  56. data/test/vcr_cassettes/media/delete.yml +0 -1380
  57. data/test/vcr_cassettes/media/from_contacts.yml +0 -155
  58. data/test/vcr_cassettes/media/from_set.yml +0 -276
  59. data/test/vcr_cassettes/media/from_user.yml +0 -275
  60. data/test/vcr_cassettes/media/get_context.yml +0 -73
  61. data/test/vcr_cassettes/media/get_info.yml +0 -167
  62. data/test/vcr_cassettes/media/remove_tag.yml +0 -264
  63. data/test/vcr_cassettes/media/replace.yml +0 -2252
  64. data/test/vcr_cassettes/media/search.yml +0 -275
  65. data/test/vcr_cassettes/media/tags.yml +0 -346
  66. data/test/vcr_cassettes/media_count/get.yml +0 -135
  67. data/test/vcr_cassettes/media_count/square_brackets.yml +0 -69
  68. data/test/vcr_cassettes/oauth/tokens.yml +0 -400
  69. data/test/vcr_cassettes/photo/asynchronous_upload.yml +0 -1693
  70. data/test/vcr_cassettes/photo/from_set.yml +0 -273
  71. data/test/vcr_cassettes/photo/from_user.yml +0 -275
  72. data/test/vcr_cassettes/photo/get_exif.yml +0 -239
  73. data/test/vcr_cassettes/photo/get_sizes.yml +0 -147
  74. data/test/vcr_cassettes/photo/other_api_calls.yml +0 -506
  75. data/test/vcr_cassettes/photo/search.yml +0 -271
  76. data/test/vcr_cassettes/photo/square_brackets.yml +0 -85
  77. data/test/vcr_cassettes/photo/upload.yml +0 -1229
  78. data/test/vcr_cassettes/set/from_user.yml +0 -477
  79. data/test/vcr_cassettes/set/get_info.yml +0 -951
  80. data/test/vcr_cassettes/set/square_brackets.yml +0 -73
  81. data/test/vcr_cassettes/user/find_by_email_or_username.yml +0 -135
  82. data/test/vcr_cassettes/user/get_info.yml +0 -151
  83. data/test/vcr_cassettes/user/square_brackets.yml +0 -77
  84. data/test/vcr_cassettes/video/get_exif.yml +0 -135
  85. data/test/vcr_cassettes/video/get_info.yml +0 -86
  86. data/test/vcr_cassettes/video/get_sizes.yml +0 -151
  87. data/test/vcr_cassettes/video/other_api_calls.yml +0 -643
  88. data/test/vcr_cassettes/video/square_brackets.yml +0 -86
  89. data/test/vcr_cassettes/video/upload.yml +0 -308
  90. data/test/video_test.rb +0 -118
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flickrie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.7.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-09 00:00:00.000000000 Z
12
+ date: 2012-05-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday_middleware
16
- requirement: &70207108480240 !ruby/object:Gem::Requirement
16
+ requirement: &70307679696400 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70207108480240
24
+ version_requirements: *70307679696400
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: simple_oauth
27
- requirement: &70207108479120 !ruby/object:Gem::Requirement
27
+ requirement: &70307679694200 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0.1'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70207108479120
35
+ version_requirements: *70307679694200
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: multi_xml
38
- requirement: &70207108476020 !ruby/object:Gem::Requirement
38
+ requirement: &70307679690400 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,43 +43,32 @@ dependencies:
43
43
  version: '0.4'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70207108476020
46
+ version_requirements: *70307679690400
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: activesupport
49
- requirement: &70207108475000 !ruby/object:Gem::Requirement
49
+ requirement: &70307679685540 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '3'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70207108475000
57
+ version_requirements: *70307679685540
58
58
  - !ruby/object:Gem::Dependency
59
- name: turn
60
- requirement: &70207108473020 !ruby/object:Gem::Requirement
59
+ name: rspec
60
+ requirement: &70307679677700 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
64
64
  - !ruby/object:Gem::Version
65
- version: '0'
65
+ version: '2'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70207108473020
68
+ version_requirements: *70307679677700
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: vcr
71
- requirement: &70207108571500 !ruby/object:Gem::Requirement
72
- none: false
73
- requirements:
74
- - - ! '>='
75
- - !ruby/object:Gem::Version
76
- version: '0'
77
- type: :development
78
- prerelease: false
79
- version_requirements: *70207108571500
80
- - !ruby/object:Gem::Dependency
81
- name: webmock
82
- requirement: &70207108570600 !ruby/object:Gem::Requirement
71
+ requirement: &70307679504440 !ruby/object:Gem::Requirement
83
72
  none: false
84
73
  requirements:
85
74
  - - ! '>='
@@ -87,7 +76,7 @@ dependencies:
87
76
  version: '0'
88
77
  type: :development
89
78
  prerelease: false
90
- version_requirements: *70207108570600
79
+ version_requirements: *70307679504440
91
80
  description: This gem is a nice wrapper for the Flickr API with an intuitive interface.
92
81
  email: janko.marohnic@gmail.com
93
82
  executables: []
@@ -122,58 +111,21 @@ files:
122
111
  - lib/flickrie/user.rb
123
112
  - lib/flickrie/version.rb
124
113
  - lib/flickrie/video.rb
125
- - test/error_test.rb
126
- - test/instance_test.rb
127
- - test/license_test.rb
128
- - test/location_test.rb
129
- - test/media_count_test.rb
130
- - test/media_test.rb
131
- - test/oauth_test.rb
132
- - test/photo.jpg
133
- - test/photo_test.rb
134
- - test/set_test.rb
135
- - test/test_helper.rb
136
- - test/user_test.rb
137
- - test/vcr_cassettes/error/code.yml
138
- - test/vcr_cassettes/instance/calling_api_methods.yml
139
- - test/vcr_cassettes/license/get_licenses.yml
140
- - test/vcr_cassettes/location/square_brackets.yml
141
- - test/vcr_cassettes/media/delete.yml
142
- - test/vcr_cassettes/media/from_contacts.yml
143
- - test/vcr_cassettes/media/from_set.yml
144
- - test/vcr_cassettes/media/from_user.yml
145
- - test/vcr_cassettes/media/get_context.yml
146
- - test/vcr_cassettes/media/get_info.yml
147
- - test/vcr_cassettes/media/remove_tag.yml
148
- - test/vcr_cassettes/media/replace.yml
149
- - test/vcr_cassettes/media/search.yml
150
- - test/vcr_cassettes/media/tags.yml
151
- - test/vcr_cassettes/media_count/get.yml
152
- - test/vcr_cassettes/media_count/square_brackets.yml
153
- - test/vcr_cassettes/oauth/tokens.yml
154
- - test/vcr_cassettes/photo/asynchronous_upload.yml
155
- - test/vcr_cassettes/photo/from_set.yml
156
- - test/vcr_cassettes/photo/from_user.yml
157
- - test/vcr_cassettes/photo/get_exif.yml
158
- - test/vcr_cassettes/photo/get_sizes.yml
159
- - test/vcr_cassettes/photo/other_api_calls.yml
160
- - test/vcr_cassettes/photo/search.yml
161
- - test/vcr_cassettes/photo/square_brackets.yml
162
- - test/vcr_cassettes/photo/upload.yml
163
- - test/vcr_cassettes/set/from_user.yml
164
- - test/vcr_cassettes/set/get_info.yml
165
- - test/vcr_cassettes/set/square_brackets.yml
166
- - test/vcr_cassettes/user/find_by_email_or_username.yml
167
- - test/vcr_cassettes/user/get_info.yml
168
- - test/vcr_cassettes/user/square_brackets.yml
169
- - test/vcr_cassettes/video/get_exif.yml
170
- - test/vcr_cassettes/video/get_info.yml
171
- - test/vcr_cassettes/video/get_sizes.yml
172
- - test/vcr_cassettes/video/other_api_calls.yml
173
- - test/vcr_cassettes/video/square_brackets.yml
174
- - test/vcr_cassettes/video/upload.yml
175
- - test/video.mov
176
- - test/video_test.rb
114
+ - spec/api_methods_spec.rb
115
+ - spec/error_spec.rb
116
+ - spec/files/photo.jpg
117
+ - spec/files/video.mov
118
+ - spec/instance_spec.rb
119
+ - spec/license_spec.rb
120
+ - spec/location_spec.rb
121
+ - spec/media_count_spec.rb
122
+ - spec/media_spec.rb
123
+ - spec/oauth_spec.rb
124
+ - spec/photo_spec.rb
125
+ - spec/set_spec.rb
126
+ - spec/spec_helper.rb
127
+ - spec/user_spec.rb
128
+ - spec/video_spec.rb
177
129
  homepage: https://github.com/janko-m/flickrie
178
130
  licenses:
179
131
  - MIT
@@ -203,56 +155,19 @@ summary: The reason why I did this gem is because the other ones either weren't
203
155
  call wasn't processed almost at all. It doesn't seem too bad at first, but after
204
156
  a while you realize it's not pretty. So I wanted to make it pretty :)
205
157
  test_files:
206
- - test/error_test.rb
207
- - test/instance_test.rb
208
- - test/license_test.rb
209
- - test/location_test.rb
210
- - test/media_count_test.rb
211
- - test/media_test.rb
212
- - test/oauth_test.rb
213
- - test/photo.jpg
214
- - test/photo_test.rb
215
- - test/set_test.rb
216
- - test/test_helper.rb
217
- - test/user_test.rb
218
- - test/vcr_cassettes/error/code.yml
219
- - test/vcr_cassettes/instance/calling_api_methods.yml
220
- - test/vcr_cassettes/license/get_licenses.yml
221
- - test/vcr_cassettes/location/square_brackets.yml
222
- - test/vcr_cassettes/media/delete.yml
223
- - test/vcr_cassettes/media/from_contacts.yml
224
- - test/vcr_cassettes/media/from_set.yml
225
- - test/vcr_cassettes/media/from_user.yml
226
- - test/vcr_cassettes/media/get_context.yml
227
- - test/vcr_cassettes/media/get_info.yml
228
- - test/vcr_cassettes/media/remove_tag.yml
229
- - test/vcr_cassettes/media/replace.yml
230
- - test/vcr_cassettes/media/search.yml
231
- - test/vcr_cassettes/media/tags.yml
232
- - test/vcr_cassettes/media_count/get.yml
233
- - test/vcr_cassettes/media_count/square_brackets.yml
234
- - test/vcr_cassettes/oauth/tokens.yml
235
- - test/vcr_cassettes/photo/asynchronous_upload.yml
236
- - test/vcr_cassettes/photo/from_set.yml
237
- - test/vcr_cassettes/photo/from_user.yml
238
- - test/vcr_cassettes/photo/get_exif.yml
239
- - test/vcr_cassettes/photo/get_sizes.yml
240
- - test/vcr_cassettes/photo/other_api_calls.yml
241
- - test/vcr_cassettes/photo/search.yml
242
- - test/vcr_cassettes/photo/square_brackets.yml
243
- - test/vcr_cassettes/photo/upload.yml
244
- - test/vcr_cassettes/set/from_user.yml
245
- - test/vcr_cassettes/set/get_info.yml
246
- - test/vcr_cassettes/set/square_brackets.yml
247
- - test/vcr_cassettes/user/find_by_email_or_username.yml
248
- - test/vcr_cassettes/user/get_info.yml
249
- - test/vcr_cassettes/user/square_brackets.yml
250
- - test/vcr_cassettes/video/get_exif.yml
251
- - test/vcr_cassettes/video/get_info.yml
252
- - test/vcr_cassettes/video/get_sizes.yml
253
- - test/vcr_cassettes/video/other_api_calls.yml
254
- - test/vcr_cassettes/video/square_brackets.yml
255
- - test/vcr_cassettes/video/upload.yml
256
- - test/video.mov
257
- - test/video_test.rb
158
+ - spec/api_methods_spec.rb
159
+ - spec/error_spec.rb
160
+ - spec/files/photo.jpg
161
+ - spec/files/video.mov
162
+ - spec/instance_spec.rb
163
+ - spec/license_spec.rb
164
+ - spec/location_spec.rb
165
+ - spec/media_count_spec.rb
166
+ - spec/media_spec.rb
167
+ - spec/oauth_spec.rb
168
+ - spec/photo_spec.rb
169
+ - spec/set_spec.rb
170
+ - spec/spec_helper.rb
171
+ - spec/user_spec.rb
172
+ - spec/video_spec.rb
258
173
  has_rdoc:
data/test/error_test.rb DELETED
@@ -1,20 +0,0 @@
1
- class ErrorTest < Test::Unit::TestCase
2
- def test_code
3
- VCR.use_cassette 'error/code' do
4
- begin
5
- Flickrie.api_key = nil
6
- Flickrie.client.get_licenses
7
- rescue Flickrie::Error => error
8
- assert_equal 100, error.code
9
- end
10
-
11
- begin
12
- Flickrie.api_key = nil
13
- Flickrie.upload_client.upload \
14
- File.expand_path(File.join(File.dirname(__FILE__), 'photo.jpg'))
15
- rescue Flickrie::Error => error
16
- assert_equal 100, error.code
17
- end
18
- end
19
- end
20
- end
@@ -1,20 +0,0 @@
1
- class InstanceTest < Test::Unit::TestCase
2
- def test_calling_api_methods
3
- VCR.use_cassette 'instance/calling_api_methods' do
4
- Flickrie.access_token = nil
5
- Flickrie.access_secret = nil
6
-
7
- flickr = Flickrie::Instance.new \
8
- ENV['FLICKR_ACCESS_TOKEN'], ENV['FLICKR_ACCESS_SECRET']
9
-
10
- photo_id = 6946979188
11
- flickr.add_photo_tags(photo_id, "janko")
12
- photo = flickr.get_photo_info(photo_id)
13
-
14
- tag = photo.tags.find { |tag| tag.content == "janko" }
15
- assert_not_nil tag
16
-
17
- flickr.remove_photo_tag tag.id
18
- end
19
- end
20
- end
data/test/license_test.rb DELETED
@@ -1,19 +0,0 @@
1
- Flickrie::License.instance_eval do
2
- def public_response_array
3
- response_array
4
- end
5
- end
6
-
7
- class LicenseTest < Test::Unit::TestCase
8
- def test_get_licenses
9
- VCR.use_cassette 'license/get_licenses' do
10
- licenses = Flickrie.get_licenses
11
-
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
17
- end
18
- end
19
- end
@@ -1,29 +0,0 @@
1
- class LocationTest < Test::Unit::TestCase
2
- def setup
3
- @media_id = 6946979188
4
- end
5
-
6
- def test_attributes_returning_nil
7
- location = Flickrie::Location.new
8
-
9
- assert_nil location.latitude
10
- assert_nil location.longitude
11
- assert_nil location.accuracy
12
- assert_nil location.context
13
- assert_nil location.place_id
14
- assert_nil location.woeid
15
-
16
- assert_nil location.neighbourhood
17
- assert_nil location.locality
18
- assert_nil location.county
19
- assert_nil location.region
20
- assert_nil location.country
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
29
- end
@@ -1,25 +0,0 @@
1
- class MediaCountTest < Test::Unit::TestCase
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
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
17
-
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
24
- end
25
- end