flickrie 1.4.2 → 1.5.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.
@@ -0,0 +1,698 @@
1
+ module Flickrie
2
+ module ApiMethods
3
+ # Fetches photos and videos from the Flickr user with the given NSID.
4
+ #
5
+ # @param nsid [String]
6
+ # @return [Flickrie::Collection<Flickrie::Photo, Flickrie::Video>]
7
+ # @api_method [flickr.people.getPhotos](http://www.flickr.com/services/api/flickr.people.getPhotos.html)
8
+ #
9
+ # @note This method requires authentication with "read" permissions.
10
+ def media_from_user(nsid, params = {})
11
+ response = client.media_from_user(nsid, params)
12
+ Media.from_user(response.body['photos'])
13
+ end
14
+ # Fetches photos from the Flickr user with the given NSID.
15
+ #
16
+ # @param nsid [String]
17
+ # @return [Flickrie::Collection<Flickrie::Photo>]
18
+ # @api_method [flickr.people.getPhotos](http://www.flickr.com/services/api/flickr.people.getPhotos.html)
19
+ #
20
+ # @note This method requires authentication with "read" permissions.
21
+ def photos_from_user(nsid, params = {})
22
+ media_from_user(nsid, params).select { |media| media.is_a?(Photo) }
23
+ end
24
+ # Fetches videos from the Flickr user with the given NSID.
25
+ #
26
+ # @param nsid [String]
27
+ # @return [Flickrie::Collection<Flickrie::Video>]
28
+ # @api_method [flickr.people.getPhotos](http://www.flickr.com/services/api/flickr.people.getPhotos.html)
29
+ #
30
+ # @note This method requires authentication with "read" permissions.
31
+ def videos_from_user(nsid, params = {})
32
+ media_from_user(nsid, params).select { |media| media.is_a?(Video) }
33
+ end
34
+
35
+ # Fetches photos and videos containing a Flickr user with the given NSID.
36
+ #
37
+ # @param nsid [String]
38
+ # @return [Flickrie::Collection<Flickrie::Photo, Flickrie::Video>]
39
+ # @api_method [flickr.people.getPhotosOf](http://www.flickr.com/services/api/flickr.people.getPhotosOf.html)
40
+ def media_of_user(nsid, params = {})
41
+ response = client.media_of_user(nsid, params)
42
+ Media.of_user(response.body['photos'])
43
+ end
44
+ # Fetches photos containing a Flickr user with the given NSID.
45
+ #
46
+ # @param nsid [String]
47
+ # @return [Flickrie::Collection<Flickrie::Photo>]
48
+ # @api_method [flickr.people.getPhotosOf](http://www.flickr.com/services/api/flickr.people.getPhotosOf.html)
49
+ def photos_of_user(nsid, params = {})
50
+ media_of_user(nsid, params).select { |media| media.is_a?(Photo) }
51
+ end
52
+ # Fetches videos containing a Flickr user with the given NSID.
53
+ #
54
+ # @param nsid [String]
55
+ # @return [Flickrie::Collection<Flickrie::Video>]
56
+ # @api_method [flickr.people.getPhotosOf](http://www.flickr.com/services/api/flickr.people.getPhotosOf.html)
57
+ def videos_of_user(nsid, params = {})
58
+ media_of_user(nsid, params).select { |media| media.is_a?(Video) }
59
+ end
60
+
61
+ # Fetches public photos and videos from the Flickr user with the given
62
+ # NSID.
63
+ #
64
+ # @param nsid [String]
65
+ # @return [Flickrie::Collection<Flickrie::Photo, Flickrie::Video>]
66
+ # @api_method [flickr.people.getPublicPhotos](http://www.flickr.com/services/api/flickr.people.getPublicPhotos.html)
67
+ def public_media_from_user(nsid, params = {})
68
+ response = client.public_media_from_user(nsid, params)
69
+ Media.from_user(response.body['photos'])
70
+ end
71
+ # Fetches public photos from the Flickr user with the given NSID.
72
+ #
73
+ # @param nsid [String]
74
+ # @return [Flickrie::Collection<Flickrie::Photo>]
75
+ # @api_method [flickr.people.getPublicPhotos](http://www.flickr.com/services/api/flickr.people.getPublicPhotos.html)
76
+ def public_photos_from_user(nsid, params = {})
77
+ public_media_from_user(nsid, params).select { |media| media.is_a?(Photo) }
78
+ end
79
+ # Fetches public videos from the Flickr user with the given NSID.
80
+ #
81
+ # @param nsid [String]
82
+ # @return [Flickrie::Collection<Flickrie::Video>]
83
+ # @api_method [flickr.people.getPublicPhotos](http://www.flickr.com/services/api/flickr.people.getPublicPhotos.html)
84
+ def public_videos_from_user(nsid, params = {})
85
+ public_media_from_user(nsid, params).select { |media| media.is_a?(Video) }
86
+ end
87
+
88
+ # Add tags to the photo/video with the given ID.
89
+ #
90
+ # @param media_id [String, Fixnum]
91
+ # @param tags [String] A space delimited string with tags
92
+ # @return [nil]
93
+ # @api_method [flickr.photos.addTags](http://www.flickr.com/services/api/flickr.photos.addTags.html)
94
+ #
95
+ # @note This method requires authentication with "write" permissions.
96
+ def add_media_tags(media_id, tags, params = {})
97
+ client.add_media_tags(media_id, tags, params)
98
+ nil
99
+ end
100
+ alias add_photo_tags add_media_tags
101
+ alias add_video_tags add_media_tags
102
+
103
+ # Deletes the photo/video with the given ID.
104
+ #
105
+ # @param media_id [String, Fixnum]
106
+ # @return [nil]
107
+ # @api_method [flickr.photos.delete](http://www.flickr.com/services/api/flickr.photos.delete.html)
108
+ #
109
+ # @note This method requires authentication with "delete" permissions.
110
+ def delete_media(media_id, params = {})
111
+ client.delete_media(media_id, params)
112
+ nil
113
+ end
114
+ alias delete_photo delete_media
115
+ alias delete_video delete_media
116
+
117
+ # Fetches photos and videos from contacts of the user who authenticated.
118
+ #
119
+ # @param params [Hash] Options for this API method (see the link below under "Flickr API method")
120
+ # @return [Flickrie::Collection<Flickrie::Photo, Flickrie::Video>]
121
+ # @api_method [flickr.photos.getContactsPhotos](http://www.flickr.com/services/api/flickr.photos.getContactsPhotos.html)
122
+ #
123
+ # @note This method requires authentication with "read" permissions.
124
+ def media_from_contacts(params = {})
125
+ response = client.media_from_contacts(params)
126
+ Media.from_contacts(response.body['photos'])
127
+ end
128
+ # Fetches photos from contacts of the user who authenticated.
129
+ #
130
+ # @param params [Hash] Options for this API method (see the link below under "Flickr API method")
131
+ # @return [Flickrie::Collection<Flickrie::Photo>]
132
+ # @api_method [flickr.photos.getContactsPhotos](http://www.flickr.com/services/api/flickr.photos.getContactsPhotos.html)
133
+ #
134
+ # @note This method requires authentication with "read" permissions.
135
+ def photos_from_contacts(params = {})
136
+ media_from_contacts(params).select { |media| media.is_a?(Photo) }
137
+ end
138
+ # Fetches videos from contacts of the user who authenticated.
139
+ #
140
+ # @param params [Hash] Options for this API method (see the link below under "Flickr API method")
141
+ # @return [Flickrie::Collection<Flickrie::Video>]
142
+ # @api_method [flickr.photos.getContactsPhotos](http://www.flickr.com/services/api/flickr.photos.getContactsPhotos.html)
143
+ #
144
+ # @note This method requires authentication with "read" permissions.
145
+ def videos_from_contacts(params = {})
146
+ media_from_contacts(params).select { |media| media.is_a?(Video) }
147
+ end
148
+
149
+ # Fetches public photos and videos from contacts of the user with the
150
+ # given NSID.
151
+ #
152
+ # @param nsid [String]
153
+ # @param params [Hash] Options for this API method (see the link below under "Flickr API method")
154
+ # @return [Flickrie::Collection<Flickrie::Photo, Flickrie::Video>]
155
+ # @api_method [flickr.photos.getContactsPublicPhotos](http://www.flickr.com/services/api/flickr.photos.getContactsPublicPhotos.html)
156
+ def public_media_from_user_contacts(nsid, params = {})
157
+ response = client.public_media_from_user_contacts(nsid, params)
158
+ Media.from_contacts(response.body['photos'])
159
+ end
160
+ # Fetches public photos from contacts of the user with the
161
+ # given NSID.
162
+ #
163
+ # @param nsid [String]
164
+ # @param params [Hash] Options for this API method (see the link below under "Flickr API method")
165
+ # @return [Flickrie::Collection<Flickrie::Photo>]
166
+ # @api_method [flickr.photos.getContactsPublicPhotos](http://www.flickr.com/services/api/flickr.photos.getContactsPublicPhotos.html)
167
+ def public_photos_from_user_contacts(nsid, params = {})
168
+ public_media_from_user_contacts(nsid, params).
169
+ select { |media| media.is_a?(Photo) }
170
+ end
171
+ # Fetches public videos from contacts of the user with the
172
+ # given NSID.
173
+ #
174
+ # @param nsid [String]
175
+ # @param params [Hash] Options for this API method (see the link below under "Flickr API method")
176
+ # @return [Flickrie::Collection<Flickrie::Video>]
177
+ # @api_method [flickr.photos.getContactsPublicPhotos](http://www.flickr.com/services/api/flickr.photos.getContactsPublicPhotos.html)
178
+ def public_videos_from_user_contacts(nsid, params = {})
179
+ public_media_from_user_contacts(nsid, params).
180
+ select { |media| media.is_a?(Video) }
181
+ end
182
+
183
+ # Fetches context of the photo/video with the given ID. Example:
184
+ #
185
+ # context = Flickrie.get_photo_context(37124234)
186
+ # context.count # => 23
187
+ # context.previous # => #<Photo: id=2433240, ...>
188
+ # context.next # => #<Video: id=1282404, ...>
189
+ #
190
+ # @param media_id [String, Fixnum]
191
+ # @return [Struct]
192
+ # @api_method [flickr.photos.getContext](http://www.flickr.com/services/api/flickr.photos.getContext.html)
193
+ def get_media_context(media_id, params = {})
194
+ response = client.get_media_context(media_id, params)
195
+ Media.from_context(response.body)
196
+ end
197
+ alias get_photo_context get_media_context
198
+ alias get_video_context get_media_context
199
+
200
+ # Fetches numbers of photos and videos for given date ranges. Example:
201
+ #
202
+ # require 'date'
203
+ # dates = [DateTime.parse("3rd Jan 2011").to_time, DateTime.parse("11th Aug 2011").to_time]
204
+ # counts = Flickrie.get_media_counts(:taken_dates => dates.map(&:to_i).join(','))
205
+ #
206
+ # count = counts.first
207
+ # count.value # => 24
208
+ # count.date_range # => 2011-01-03 01:00:00 +0100..2011-08-11 02:00:00 +0200
209
+ # count.date_range.begin # => 2011-01-03 01:00:00 +0100
210
+ # count.from # => 2011-01-03 01:00:00 +0100
211
+ #
212
+ # @param params [Hash] Options for this API method (see the link below under "Flickr API method")
213
+ # @return [Flickrie::MediaCount]
214
+ # @api_method [flickr.photos.getCounts](http://www.flickr.com/services/api/flickr.photos.getCounts.html)
215
+ def get_media_counts(params = {})
216
+ response = client.get_media_counts \
217
+ MediaCount.ensure_utc(params)
218
+ response.body['photocounts']['photocount'].
219
+ map { |info| MediaCount.new(info, params) }
220
+ end
221
+ alias get_photos_counts get_media_counts
222
+ alias get_videos_counts get_media_counts
223
+
224
+ # Fetches the exif for the photo with the given ID. Example:
225
+ #
226
+ # photo = Flickrie.get_photo_exif(27234987)
227
+ # photo.exif.get('Model') # => 'Canon PowerShot G12'
228
+ #
229
+ # photo.exif.get('X-Resolution', :data => 'raw') # => '180'
230
+ # photo.exif.get('X-Resolution', :data => 'clean') # => '180 dpi'
231
+ # photo.exif.get('X-Resolution') # => '180 dpi'
232
+ #
233
+ # @param photo_id [String, Fixnum]
234
+ # @return [Flickrie::Photo]
235
+ # @api_method [flickr.photos.getExif](http://www.flickr.com/services/api/flickr.photos.getExif.html)
236
+ def get_photo_exif(photo_id, params = {})
237
+ response = client.get_media_exif(photo_id, params)
238
+ Photo.new(response.body['photo'])
239
+ end
240
+ # Fetches the exif for the video with the given ID. Example:
241
+ #
242
+ # video = Flickrie.get_video_exif(27234987)
243
+ # video.exif.get('Model') # => 'Canon PowerShot G12'
244
+ #
245
+ # video.exif.get('X-Resolution', :data => 'raw') # => '180'
246
+ # video.exif.get('X-Resolution', :data => 'clean') # => '180 dpi'
247
+ # video.exif.get('X-Resolution') # => '180 dpi'
248
+ #
249
+ # @param video_id [String, Fixnum]
250
+ # @return [Flickrie::Video]
251
+ # @api_method [flickr.photos.getExif](http://www.flickr.com/services/api/flickr.photos.getExif.html)
252
+ def get_video_exif(video_id, params = {})
253
+ response = client.get_media_exif(video_id, params)
254
+ Video.new(response.body['photo'])
255
+ end
256
+
257
+ # Fetches the list of users who favorited the photo with the given ID.
258
+ # Example:
259
+ #
260
+ # photo = Flickrie.get_photo_favorites(24810948)
261
+ # photo.favorites.first.username # => "John Smith"
262
+ #
263
+ # @param photo_id [String, Fixnum]
264
+ # @return [Flickrie::Photo]
265
+ # @api_method [flickr.photos.getFavorites](http://www.flickr.com/services/api/flickr.photos.getFavorites.html)
266
+ def get_photo_favorites(photo_id, params = {})
267
+ response = client.get_media_favorites(photo_id, params)
268
+ Photo.new(response.body['photo'])
269
+ end
270
+ # Fetches the list of users who favorited the video with the given ID.
271
+ # Example:
272
+ #
273
+ # video = Flickrie.get_video_favorites(24810948)
274
+ # video.favorites.first.username # => "John Smith"
275
+ #
276
+ # @param video_id [String, Fixnum]
277
+ # @return [Flickrie::Video]
278
+ # @api_method [flickr.photos.getFavorites](http://www.flickr.com/services/api/flickr.photos.getFavorites.html)
279
+ def get_video_favorites(video_id, params = {})
280
+ response = client.get_media_favorites(video_id, params)
281
+ Video.new(response.body['photo'])
282
+ end
283
+
284
+ # Fetches info of the photo/video with the given ID.
285
+ #
286
+ # @param media_id [String, Fixnum]
287
+ # @return [Flickrie::Photo, Flickrie::Video]
288
+ # @api_method [flickr.photos.getInfo](http://www.flickr.com/services/api/flickr.photos.getInfo.html)
289
+ def get_media_info(media_id, params = {})
290
+ response = client.get_media_info(media_id, params)
291
+ Media.from_info(response.body['photo'])
292
+ end
293
+ alias get_photo_info get_media_info
294
+ alias get_video_info get_media_info
295
+
296
+ # Fetches photos and videos from the authenticated user
297
+ # that are not in any set.
298
+ #
299
+ # @return [Flickrie::Collection<Flickrie::Photo, Flickrie::Video>]
300
+ # @api_method [flickr.photos.getNotInSet](http://www.flickr.com/services/api/flickr.photos.getNotInSet.html)
301
+ #
302
+ # @note This method requires authentication with "read" permissions.
303
+ def media_not_in_set(params = {})
304
+ response = client.media_not_in_set({:media => 'all'}.merge(params))
305
+ Media.from_not_in_set(response.body['photos'])
306
+ end
307
+ # Fetches photos from the authenticated user
308
+ # that are not in any set.
309
+ #
310
+ # @return [Flickrie::Collection<Flickrie::Photo>]
311
+ # @api_method [flickr.photos.getNotInSet](http://www.flickr.com/services/api/flickr.photos.getNotInSet.html)
312
+ #
313
+ # @note This method requires authentication with "read" permissions.
314
+ def photos_not_in_set(params = {})
315
+ media_not_in_set({:media => "photos"}.merge(params))
316
+ end
317
+ # Fetches videos from the authenticated user
318
+ # that are not in any set.
319
+ #
320
+ # @return [Flickrie::Collection<Flickrie::Video>]
321
+ # @api_method [flickr.photos.getNotInSet](http://www.flickr.com/services/api/flickr.photos.getNotInSet.html)
322
+ #
323
+ # @note This method requires authentication with "read" permissions.
324
+ def videos_not_in_set(params = {})
325
+ media_not_in_set({:media => "videos"}.merge(params))
326
+ end
327
+
328
+ # Gets permissions of a photo with the given ID.
329
+ #
330
+ # @return [Flickrie::Photo]
331
+ # @api_method [flickr.photos.getPerms](http://www.flickr.com/services/api/flickr.photos.getPerms.html)
332
+ #
333
+ # @note This method requires authentication with "read" permissions.
334
+ def get_photo_permissions(photo_id, params = {})
335
+ response = client.get_media_permissions(photo_id, params)
336
+ Photo.from_perms(response.body['perms'])
337
+ end
338
+ # Gets permissions of a video with the given ID.
339
+ #
340
+ # @return [Flickrie::Video]
341
+ # @api_method [flickr.photos.getPerms](http://www.flickr.com/services/api/flickr.photos.getPerms.html)
342
+ #
343
+ # @note This method requires authentication with "read" permissions.
344
+ def get_video_permissions(video_id, params = {})
345
+ response = client.get_media_permissions(video_id, params)
346
+ Video.from_perms(response.body['perms'])
347
+ end
348
+
349
+ # Fetches the latest photos and videos uploaded to Flickr.
350
+ #
351
+ # @return [Flickrie::Collection<Flickrie::Photo, Flickrie::Video>]
352
+ # @api_method [flickr.photos.getRecent](http://www.flickr.com/services/api/flickr.photos.getRecent.html)
353
+ def get_recent_media(params = {})
354
+ response = client.get_recent_media(params)
355
+ Media.from_recent(response.body['photos'])
356
+ end
357
+ # Fetches the latest photos uploaded to Flickr.
358
+ #
359
+ # @return [Flickrie::Collection<Flickrie::Photo>]
360
+ # @api_method [flickr.photos.getRecent](http://www.flickr.com/services/api/flickr.photos.getRecent.html)
361
+ def get_recent_photos(params = {})
362
+ get_recent_media(params).select { |media| media.is_a?(Photo) }
363
+ end
364
+ # Fetches the latest videos uploaded to Flickr.
365
+ #
366
+ # @return [Flickrie::Collection<Flickrie::Video>]
367
+ # @api_method [flickr.photos.getRecent](http://www.flickr.com/services/api/flickr.photos.getRecent.html)
368
+ def get_recent_videos(params = {})
369
+ get_recent_media(params).select { |media| media.is_a?(Video) }
370
+ end
371
+
372
+ # Fetches the sizes of the photo with the given ID. Example:
373
+ #
374
+ # photo = Flickrie.get_photo_sizes(242348)
375
+ # photo.medium!(500)
376
+ # photo.size # => "Medium 500"
377
+ # photo.source_url # => "http://farm8.staticflickr.com/7090/7093101501_9337f28800.jpg"
378
+ #
379
+ # @param photo_id [String, Fixnum]
380
+ # @return [Flickrie::Photo]
381
+ # @api_method [flickr.photos.getSizes](http://www.flickr.com/services/api/flickr.photos.getSizes.html)
382
+ def get_photo_sizes(photo_id, params = {})
383
+ response = client.get_media_sizes(photo_id, params)
384
+ Photo.from_sizes(response.body['sizes'].merge('id' => photo_id.to_s))
385
+ end
386
+ # Fetches the sizes of the video with the given ID. Example:
387
+ #
388
+ # video = Flickrie.get_video_sizes(438492)
389
+ # video.download_url # => "..."
390
+ #
391
+ # @param video_id [String, Fixnum]
392
+ # @return [Flickrie::Video]
393
+ # @api_method [flickr.photos.getSizes](http://www.flickr.com/services/api/flickr.photos.getSizes.html)
394
+ def get_video_sizes(video_id, params = {})
395
+ response = client.get_media_sizes(video_id, params)
396
+ Video.from_sizes(response.body['sizes'].merge('id' => video_id.to_s))
397
+ end
398
+
399
+ # Fetches photos and videos from the authenticated user that have no
400
+ # tags.
401
+ #
402
+ # @return [Flickrie::Collection<Flickrie::Photo, Flickrie::Video>]
403
+ # @api_method [flickr.photos.getUntagged](http://www.flickr.com/services/api/flickr.photos.getUntagged.html)
404
+ #
405
+ # @note This method requires authentication with "read" permissions.
406
+ def get_untagged_media(params = {})
407
+ response = client.get_untagged_media({:media => 'all'}.merge(params))
408
+ Media.from_untagged(response.body['photos'])
409
+ end
410
+ # Fetches photos from the authenticated user that have no tags.
411
+ #
412
+ # @return [Flickrie::Collection<Flickrie::Photo>]
413
+ # @api_method [flickr.photos.getUntagged](http://www.flickr.com/services/api/flickr.photos.getUntagged.html)
414
+ #
415
+ # @note This method requires authentication with "read" permissions.
416
+ def get_untagged_photos(params = {})
417
+ get_untagged_media({:media => 'photos'}.merge(params))
418
+ end
419
+ # Fetches videos from the authenticated user that have no tags.
420
+ #
421
+ # @return [Flickrie::Collection<Flickrie::Video>]
422
+ # @api_method [flickr.photos.getUntagged](http://www.flickr.com/services/api/flickr.photos.getUntagged.html)
423
+ #
424
+ # @note This method requires authentication with "read" permissions.
425
+ def get_untagged_videos(params = {})
426
+ get_untagged_media({:media => 'videos'}.merge(params))
427
+ end
428
+
429
+ # Fetches geo-tagged photos and videos from the authenticated user.
430
+ #
431
+ # @return [Flickrie:Collection<Flickrie:Photo, Flickrie::Video>]
432
+ # @api_method [flickr.photos.getWithGeoData](http://www.flickr.com/services/api/flickr.photos.getWithGeoData.html)
433
+ #
434
+ # @note This method requires authentication with "read" permissions.
435
+ def get_media_with_geo_data(params = {})
436
+ response = client.get_media_with_geo_data({:media => 'all'}.merge(params))
437
+ Media.from_geo_data(response.body['photos'])
438
+ end
439
+ # Fetches geo-tagged photos from the authenticated user.
440
+ #
441
+ # @return [Flickrie:Collection<Flickrie:Photo>]
442
+ # @api_method [flickr.photos.getWithGeoData](http://www.flickr.com/services/api/flickr.photos.getWithGeoData.html)
443
+ #
444
+ # @note This method requires authentication with "read" permissions.
445
+ def get_photos_with_geo_data(params = {})
446
+ get_media_with_geo_data({:media => 'photos'}.merge(params))
447
+ end
448
+ # Fetches geo-tagged videos from the authenticated user.
449
+ #
450
+ # @return [Flickrie:Collection<Flickrie::Video>]
451
+ # @api_method [flickr.photos.getWithGeoData](http://www.flickr.com/services/api/flickr.photos.getWithGeoData.html)
452
+ #
453
+ # @note This method requires authentication with "read" permissions.
454
+ def get_videos_with_geo_data(params = {})
455
+ get_media_with_geo_data({:media => 'videos'}.merge(params))
456
+ end
457
+
458
+ # Fetches photos and videos from the authenticated user that are not
459
+ # geo-tagged.
460
+ #
461
+ # @return [Flickrie:Collection<Flickrie:Photo, Flickrie::Video>]
462
+ # @api_method [flickr.photos.getWithoutGeoData](http://www.flickr.com/services/api/flickr.photos.getWithoutGeoData.html)
463
+ #
464
+ # @note This method requires authentication with "read" permissions.
465
+ def get_media_without_geo_data(params = {})
466
+ response = client.get_media_with_geo_data({:media => 'all'}.merge(params))
467
+ Media.from_geo_data(response.body['photos'])
468
+ end
469
+ # Fetches photos from the authenticated user that are not geo-tagged.
470
+ #
471
+ # @return [Flickrie:Collection<Flickrie:Photo>]
472
+ # @api_method [flickr.photos.getWithoutGeoData](http://www.flickr.com/services/api/flickr.photos.getWithoutGeoData.html)
473
+ #
474
+ # @note This method requires authentication with "read" permissions.
475
+ def get_photos_without_geo_data(params = {})
476
+ get_media_with_geo_data({:media => 'photos'}.merge(params))
477
+ end
478
+ # Fetches videos from the authenticated user that are not geo-tagged.
479
+ #
480
+ # @return [Flickrie:Collection<Flickrie::Video>]
481
+ # @api_method [flickr.photos.getWithoutGeoData](http://www.flickr.com/services/api/flickr.photos.getWithoutGeoData.html)
482
+ #
483
+ # @note This method requires authentication with "read" permissions.
484
+ def get_videos_without_geo_data(params = {})
485
+ get_media_with_geo_data({:media => 'videos'}.merge(params))
486
+ end
487
+
488
+ # Fetches photos and videos from the authenticated user that have
489
+ # recently been updated.
490
+ #
491
+ # @return [Flickrie::Collection<Flickrie::Photo, Flickrie::Video>]
492
+ # @api_method [flickr.photos.recentlyUpdated](http://www.flickr.com/services/api/flickr.photos.recentlyUpdated.html)
493
+ #
494
+ # @note This method requires authentication with "read" permissions.
495
+ def recently_updated_media(params = {})
496
+ response = client.recently_updated_media(params)
497
+ Media.from_recently_updated(response.body['photos'])
498
+ end
499
+ # Fetches photos from the authenticated user that have recently been updated.
500
+ #
501
+ # @return [Flickrie::Collection<Flickrie::Photo>]
502
+ # @api_method [flickr.photos.recentlyUpdated](http://www.flickr.com/services/api/flickr.photos.recentlyUpdated.html)
503
+ #
504
+ # @note This method requires authentication with "read" permissions.
505
+ def recently_updated_photos(params = {})
506
+ recently_updated_media(params).select { |media| media.is_a?(Photo) }
507
+ end
508
+ # Fetches videos from the authenticated user that have recently been updated.
509
+ #
510
+ # @return [Flickrie::Collection<Flickrie::Video>]
511
+ # @api_method [flickr.photos.recentlyUpdated](http://www.flickr.com/services/api/flickr.photos.recentlyUpdated.html)
512
+ #
513
+ # @note This method requires authentication with "read" permissions.
514
+ def recently_updated_videos(params = {})
515
+ recently_updated_media(params).select { |media| media.is_a?(Video) }
516
+ end
517
+
518
+ # Remove the tag with the given ID
519
+ #
520
+ # @param tag_id [String]
521
+ # @return [nil]
522
+ # @api_method [flickr.photos.removeTag](http://www.flickr.com/services/api/flickr.photos.removeTag.html)
523
+ #
524
+ # @note This method requires authentication with "write" permissions.
525
+ def remove_media_tag(tag_id, params = {})
526
+ client.remove_media_tag(tag_id, params)
527
+ nil
528
+ end
529
+ alias remove_photo_tag remove_media_tag
530
+ alias remove_video_tag remove_media_tag
531
+
532
+ # Fetches photos and videos matching a certain criteria.
533
+ #
534
+ # @param search_params [Hash] Options for searching (see the link below under "Flickr API method")
535
+ # @return [Flickrie::Collection<Flickrie::Photo, Flickrie::Video>]
536
+ # @api_method [flickr.photos.search](http://www.flickr.com/services/api/flickr.photos.search.html)
537
+ def search_media(params = {})
538
+ response = client.search_media({:media => 'all'}.merge(params))
539
+ Media.from_search(response.body['photos'])
540
+ end
541
+ # Fetches photos matching a certain criteria.
542
+ #
543
+ # @param search_params [Hash] Options for searching (see the link below under "Flickr API method")
544
+ # @return [Flickrie::Collection<Flickrie::Photo>]
545
+ # @api_method [flickr.photos.search](http://www.flickr.com/services/api/flickr.photos.search.html)
546
+ def search_photos(params = {})
547
+ search_media({:media => 'photos'}.merge(params))
548
+ end
549
+ # Fetches videos matching a certain criteria.
550
+ #
551
+ # @param search_params [Hash] Options for searching (see the link below under "Flickr API method")
552
+ # @return [Flickrie::Collection<Flickrie::Video>]
553
+ # @api_method [flickr.photos.search](http://www.flickr.com/services/api/flickr.photos.search.html)
554
+ def search_videos(params = {})
555
+ search_media({:media => 'videos'}.merge(params))
556
+ end
557
+
558
+ # Sets the content type of a photo/video.
559
+ #
560
+ # @param media_id [String, Fixnum]
561
+ # @param content_type [String, Fixnum]
562
+ # @return [nil]
563
+ # @api_method [flickr.photos.setContentType](http://www.flickr.com/services/api/flickr.photos.setContentType.html)
564
+ #
565
+ # @note This method requires authentication with "write" permissions.
566
+ def set_media_content_type(media_id, content_type, params = {})
567
+ client.set_media_content_type(media_id, content_type, params)
568
+ nil
569
+ end
570
+ alias set_photo_content_type set_media_content_type
571
+ alias set_video_content_type set_media_content_type
572
+
573
+ # Sets dates for a photo/video.
574
+ #
575
+ # @param media_id [String, Fixnum]
576
+ # @return [nil]
577
+ # @api_method [flickr.photos.setDates](http://www.flickr.com/services/api/flickr.photos.setDates.html)
578
+ #
579
+ # @note This method requires authentication with "write" permissions.
580
+ def set_media_dates(media_id, params = {})
581
+ client.set_media_dates(media_id, params)
582
+ nil
583
+ end
584
+ alias set_photo_dates set_media_dates
585
+ alias set_video_dates set_media_dates
586
+
587
+ # Sets meta information for a photo/video.
588
+ #
589
+ # @param media_id [String, Fixnum]
590
+ # @return [nil]
591
+ # @api_method [flickr.photos.setMeta](http://www.flickr.com/services/api/flickr.photos.setMeta.html)
592
+ #
593
+ # @note This method requires authentication with "write" permissions.
594
+ def set_media_meta(media_id, params = {})
595
+ client.set_media_meta(media_id, params)
596
+ nil
597
+ end
598
+ alias set_photo_meta set_media_meta
599
+ alias set_video_meta set_media_meta
600
+
601
+ # Sets permissions for a photo/video.
602
+ #
603
+ # @param media_id [String, Fixnum]
604
+ # @return [nil]
605
+ # @api_method [flickr.photos.setPerms](http://www.flickr.com/services/api/flickr.photos.setPerms.html)
606
+ #
607
+ # @note This method requires authentication with "write" permissions.
608
+ def set_media_permissions(media_id, params = {})
609
+ client.set_media_permissions(media_id, params)
610
+ nil
611
+ end
612
+ alias set_photo_permissions set_media_permissions
613
+ alias set_video_permissions set_media_permissions
614
+
615
+ # Sets the safety level of a photo/video.
616
+ #
617
+ # @param media_id [String, Fixnum]
618
+ # @return [nil]
619
+ # @api_method [flickr.photos.setSafetyLevel](http://www.flickr.com/services/api/flickr.photos.setSafetyLevel.html)
620
+ #
621
+ # @note This method requires authentication with "write" permissions.
622
+ def set_media_safety_level(media_id, params = {})
623
+ client.set_media_safety_level(media_id, params)
624
+ nil
625
+ end
626
+ alias set_photo_safety_level set_media_safety_level
627
+ alias set_video_safety_level set_media_safety_level
628
+
629
+ # Sets tags for a photo/video.
630
+ #
631
+ # @params media_id [String, Fixnum]
632
+ # @return [nil]
633
+ # @api_method [flickr.photos.setTags](http://www.flickr.com/services/api/flickr.photos.setTags.html)
634
+ #
635
+ # @note This method requires authentication with "write" permissions.
636
+ def set_media_tags(media_id, tags, params = {})
637
+ client.set_media_tags(media_id, tags, params)
638
+ nil
639
+ end
640
+ alias set_photo_tags set_media_tags
641
+ alias set_video_tags set_media_tags
642
+
643
+ # Sets the license of a photo/video.
644
+ #
645
+ # @return [nil]
646
+ # @api_method [flickr.photos.licenses.setLicense](http://www.flickr.com/services/api/flickr.photos.licenses.setLicense.html)
647
+ #
648
+ # @note This method requires authentication with "write" permissions.
649
+ def set_media_license(media_id, license_id, params = {})
650
+ client.set_media_license(media_id, license_id, params)
651
+ nil
652
+ end
653
+ alias set_photo_license set_media_license
654
+ alias set_video_license set_media_license
655
+
656
+ # Rotates a photo/video.
657
+ #
658
+ # @return [nil]
659
+ # @api_method [flickr.photos.transform.rotate](http://www.flickr.com/services/api/flickr.photos.transform.rotate.html)
660
+ #
661
+ # @note This method requires authentication with "write" permissions.
662
+ def rotate_media(media_id, degrees, params = {})
663
+ client.rotate_media(media_id, degrees, params)
664
+ nil
665
+ end
666
+ alias rotate_photo rotate_media
667
+ alias rotate_video rotate_media
668
+
669
+ # Fetches photos and videos from a set with the given ID.
670
+ #
671
+ # @param set_id [String]
672
+ # @param params [Hash] Options for this API method (see the link below under "Flickr API method")
673
+ # @return [Flickrie::Collection<Flickrie::Photo, Flickrie::Video>]
674
+ # @api_method [flickr.photosets.getPhotos](http://www.flickr.com/services/api/flickr.photosets.getPhotos.html)
675
+ def media_from_set(set_id, params = {})
676
+ response = client.media_from_set(set_id, {:media => 'all'}.merge(params))
677
+ Media.from_set(response.body['photoset'])
678
+ end
679
+ # Fetches photos from a set with the given ID.
680
+ #
681
+ # @param set_id [String]
682
+ # @param params [Hash] Options for this API method (see the link below under "Flickr API method")
683
+ # @return [Flickrie::Collection<Flickrie::Photo>]
684
+ # @api_method [flickr.photosets.getPhotos](http://www.flickr.com/services/api/flickr.photosets.getPhotos.html)
685
+ def photos_from_set(set_id, params = {})
686
+ media_from_set(set_id, {:media => 'photos'}.merge(params))
687
+ end
688
+ # Fetches videos from a set with the given ID.
689
+ #
690
+ # @param set_id [String]
691
+ # @param params [Hash] Options for this API method (see the link below under "Flickr API method")
692
+ # @return [Flickrie::Collection<Flickrie::Video>]
693
+ # @api_method [flickr.photosets.getPhotos](http://www.flickr.com/services/api/flickr.photosets.getPhotos.html)
694
+ def videos_from_set(set_id, params = {})
695
+ media_from_set(set_id, {:media => 'videos'}.merge(params))
696
+ end
697
+ end
698
+ end