flickrie 1.3.1 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +13 -0
- data/lib/flickrie/api_methods.rb +286 -12
- data/lib/flickrie/client.rb +60 -0
- data/lib/flickrie/media/class_methods.rb +31 -0
- data/lib/flickrie/media.rb +8 -0
- data/lib/flickrie/version.rb +1 -1
- metadata +18 -18
data/README.md
CHANGED
@@ -249,6 +249,7 @@ basis of this gem.
|
|
249
249
|
"flickr.people.findByUsername" -> Flickrie.find_user_by_username
|
250
250
|
"flickr.people.getInfo" -> Flickrie.get_user_info
|
251
251
|
"flickr.people.getPhotos" -> Flickrie.photos_from_user
|
252
|
+
"flickr.people.getPhotosOf" -> Flickrie.photos_of_user
|
252
253
|
"flickr.people.getPublicPhotos" -> Flickrie.public_photos_from_user
|
253
254
|
"flickr.people.getUploadStatus" -> Flickrie.get_upload_status
|
254
255
|
|
@@ -263,9 +264,21 @@ basis of this gem.
|
|
263
264
|
"flickr.photos.getFavorites" -> Flickrie.get_photo_favorites
|
264
265
|
"flickr.photos.getInfo" -> Flickrie.get_photo_info
|
265
266
|
"flickr.photos.getNotInSet" -> Flickrie.photos_not_in_set
|
267
|
+
"flickr.photos.getPerms" -> Flickrie.get_photo_permissions
|
268
|
+
"flickr.photos.getRecent" -> Flickrie.get_recent_photos
|
266
269
|
"flickr.photos.getSizes" -> Flickrie.get_photo_sizes
|
270
|
+
"flickr.photos.getUntagged" -> Flickrie.get_untagged_photos
|
271
|
+
"flickr.photos.getWithGeoData" -> Flickrie.get_photos_with_geo_data
|
272
|
+
"flickr.photos.getWithoutGeoData" -> Flickrie.get_photos_without_geo_data
|
273
|
+
"flickr.photos.recentlyUpdated" -> Flickrie.recently_updated_photos
|
267
274
|
"flickr.photos.removeTag" -> Flickrie.remove_photo_tag
|
268
275
|
"flickr.photos.search" -> Flickrie.search_photos
|
276
|
+
"flickr.photos.setContentType" -> Flickrie.set_photo_content_type
|
277
|
+
"flickr.photos.setDates" -> Flickrie.set_photo_dates
|
278
|
+
"flickr.photos.setMeta" -> Flickrie.set_photo_meta
|
279
|
+
"flickr.photos.setPerms" -> Flickrie.set_photo_permissions
|
280
|
+
"flickr.photos.setSafetyLevel" -> Flickrie.set_photo_safety_level
|
281
|
+
"flickr.photos.setTags" -> Flickrie.set_photo_tags
|
269
282
|
|
270
283
|
# photos.licenses
|
271
284
|
"flickr.photos.licenses.getInfo" -> Flickrie.get_licenses
|
data/lib/flickrie/api_methods.rb
CHANGED
@@ -108,6 +108,32 @@ module Flickrie
|
|
108
108
|
media_from_user(nsid, params).select { |media| media.is_a?(Video) }
|
109
109
|
end
|
110
110
|
|
111
|
+
# Fetches photos and videos containing a Flickr user with the given NSID.
|
112
|
+
#
|
113
|
+
# @param nsid [String]
|
114
|
+
# @return [Flickrie::Collection<Flickrie::Photo, Flickrie::Video>]
|
115
|
+
# @api_method [flickr.people.getPhotosOf](http://www.flickr.com/services/api/flickr.people.getPhotosOf.html)
|
116
|
+
def media_of_user(nsid, params = {})
|
117
|
+
response = client.media_of_user(nsid, params)
|
118
|
+
Media.of_user(response.body['photos'])
|
119
|
+
end
|
120
|
+
# Fetches photos containing a Flickr user with the given NSID.
|
121
|
+
#
|
122
|
+
# @param nsid [String]
|
123
|
+
# @return [Flickrie::Collection<Flickrie::Photo>]
|
124
|
+
# @api_method [flickr.people.getPhotosOf](http://www.flickr.com/services/api/flickr.people.getPhotosOf.html)
|
125
|
+
def photos_of_user(nsid, params = {})
|
126
|
+
media_of_user(nsid, params).select { |media| media.is_a?(Photo) }
|
127
|
+
end
|
128
|
+
# Fetches videos containing a Flickr user with the given NSID.
|
129
|
+
#
|
130
|
+
# @param nsid [String]
|
131
|
+
# @return [Flickrie::Collection<Flickrie::Video>]
|
132
|
+
# @api_method [flickr.people.getPhotosOf](http://www.flickr.com/services/api/flickr.people.getPhotosOf.html)
|
133
|
+
def videos_of_user(nsid, params = {})
|
134
|
+
media_of_user(nsid, params).select { |media| media.is_a?(Video) }
|
135
|
+
end
|
136
|
+
|
111
137
|
# Fetches public photos and videos from the Flickr user with the given
|
112
138
|
# NSID.
|
113
139
|
#
|
@@ -363,7 +389,7 @@ module Flickrie
|
|
363
389
|
#
|
364
390
|
# @note This method requires authentication with "read" permissions.
|
365
391
|
def media_not_in_set(params = {})
|
366
|
-
response = client.media_not_in_set(params)
|
392
|
+
response = client.media_not_in_set({:media => 'all'}.merge(params))
|
367
393
|
Media.from_not_in_set(response.body['photos'])
|
368
394
|
end
|
369
395
|
# Fetches photos from the authenticated user
|
@@ -374,7 +400,7 @@ module Flickrie
|
|
374
400
|
#
|
375
401
|
# @note This method requires authentication with "read" permissions.
|
376
402
|
def photos_not_in_set(params = {})
|
377
|
-
media_not_in_set(
|
403
|
+
media_not_in_set({:media => "photos"}.merge(params))
|
378
404
|
end
|
379
405
|
# Fetches videos from the authenticated user
|
380
406
|
# that are not in any set.
|
@@ -384,7 +410,51 @@ module Flickrie
|
|
384
410
|
#
|
385
411
|
# @note This method requires authentication with "read" permissions.
|
386
412
|
def videos_not_in_set(params = {})
|
387
|
-
media_not_in_set(
|
413
|
+
media_not_in_set({:media => "videos"}.merge(params))
|
414
|
+
end
|
415
|
+
|
416
|
+
# Gets permissions of a photo with the given ID.
|
417
|
+
#
|
418
|
+
# @return [Flickrie::Photo]
|
419
|
+
# @api_method [flickr.photos.getPerms](http://www.flickr.com/services/api/flickr.photos.getPerms.html)
|
420
|
+
#
|
421
|
+
# @note This method requires authentication with "read" permissions.
|
422
|
+
def get_photo_permissions(photo_id, params = {})
|
423
|
+
response = client.get_media_permissions(photo_id, params)
|
424
|
+
Photo.from_perms(response.body['perms'])
|
425
|
+
end
|
426
|
+
# Gets permissions of a video with the given ID.
|
427
|
+
#
|
428
|
+
# @return [Flickrie::Video]
|
429
|
+
# @api_method [flickr.photos.getPerms](http://www.flickr.com/services/api/flickr.photos.getPerms.html)
|
430
|
+
#
|
431
|
+
# @note This method requires authentication with "read" permissions.
|
432
|
+
def get_video_permissions(video_id, params = {})
|
433
|
+
response = client.get_media_permissions(video_id, params)
|
434
|
+
Video.from_perms(response.body['perms'])
|
435
|
+
end
|
436
|
+
|
437
|
+
# Fetches the latest photos and videos uploaded to Flickr.
|
438
|
+
#
|
439
|
+
# @return [Flickrie::Collection<Flickrie::Photo, Flickrie::Video>]
|
440
|
+
# @api_method [flickr.photos.getRecent](http://www.flickr.com/services/api/flickr.photos.getRecent.html)
|
441
|
+
def get_recent_media(params = {})
|
442
|
+
response = client.get_recent_media(params)
|
443
|
+
Media.from_recent(response.body['photos'])
|
444
|
+
end
|
445
|
+
# Fetches the latest photos uploaded to Flickr.
|
446
|
+
#
|
447
|
+
# @return [Flickrie::Collection<Flickrie::Photo>]
|
448
|
+
# @api_method [flickr.photos.getRecent](http://www.flickr.com/services/api/flickr.photos.getRecent.html)
|
449
|
+
def get_recent_photos(params = {})
|
450
|
+
get_recent_media(params).select { |media| media.is_a?(Photo) }
|
451
|
+
end
|
452
|
+
# Fetches the latest videos uploaded to Flickr.
|
453
|
+
#
|
454
|
+
# @return [Flickrie::Collection<Flickrie::Video>]
|
455
|
+
# @api_method [flickr.photos.getRecent](http://www.flickr.com/services/api/flickr.photos.getRecent.html)
|
456
|
+
def get_recent_videos(params = {})
|
457
|
+
get_recent_media(params).select { |media| media.is_a?(Video) }
|
388
458
|
end
|
389
459
|
|
390
460
|
# Fetches the sizes of the photo with the given ID. Example:
|
@@ -414,6 +484,125 @@ module Flickrie
|
|
414
484
|
Video.from_sizes(response.body['sizes'].merge('id' => video_id.to_s))
|
415
485
|
end
|
416
486
|
|
487
|
+
# Fetches photos and videos from the authenticated user that have no
|
488
|
+
# tags.
|
489
|
+
#
|
490
|
+
# @return [Flickrie::Collection<Flickrie::Photo, Flickrie::Video>]
|
491
|
+
# @api_method [flickr.photos.getUntagged](http://www.flickr.com/services/api/flickr.photos.getUntagged.html)
|
492
|
+
#
|
493
|
+
# @note This method requires authentication with "read" permissions.
|
494
|
+
def get_untagged_media(params = {})
|
495
|
+
response = client.get_untagged_media({:media => 'all'}.merge(params))
|
496
|
+
Media.from_untagged(response.body['photos'])
|
497
|
+
end
|
498
|
+
# Fetches photos from the authenticated user that have no tags.
|
499
|
+
#
|
500
|
+
# @return [Flickrie::Collection<Flickrie::Photo>]
|
501
|
+
# @api_method [flickr.photos.getUntagged](http://www.flickr.com/services/api/flickr.photos.getUntagged.html)
|
502
|
+
#
|
503
|
+
# @note This method requires authentication with "read" permissions.
|
504
|
+
def get_untagged_photos(params = {})
|
505
|
+
get_untagged_media({:media => 'photos'}.merge(params))
|
506
|
+
end
|
507
|
+
# Fetches videos from the authenticated user that have no tags.
|
508
|
+
#
|
509
|
+
# @return [Flickrie::Collection<Flickrie::Video>]
|
510
|
+
# @api_method [flickr.photos.getUntagged](http://www.flickr.com/services/api/flickr.photos.getUntagged.html)
|
511
|
+
#
|
512
|
+
# @note This method requires authentication with "read" permissions.
|
513
|
+
def get_untagged_videos(params = {})
|
514
|
+
get_untagged_media({:media => 'videos'}.merge(params))
|
515
|
+
end
|
516
|
+
|
517
|
+
# Fetches geo-tagged photos and videos from the authenticated user.
|
518
|
+
#
|
519
|
+
# @return [Flickrie:Collection<Flickrie:Photo, Flickrie::Video>]
|
520
|
+
# @api_method [flickr.photos.getWithGeoData](http://www.flickr.com/services/api/flickr.photos.getWithGeoData.html)
|
521
|
+
#
|
522
|
+
# @note This method requires authentication with "read" permissions.
|
523
|
+
def get_media_with_geo_data(params = {})
|
524
|
+
response = client.get_media_with_geo_data({:media => 'all'}.merge(params))
|
525
|
+
Media.from_geo_data(response.body['photos'])
|
526
|
+
end
|
527
|
+
# Fetches geo-tagged photos from the authenticated user.
|
528
|
+
#
|
529
|
+
# @return [Flickrie:Collection<Flickrie:Photo>]
|
530
|
+
# @api_method [flickr.photos.getWithGeoData](http://www.flickr.com/services/api/flickr.photos.getWithGeoData.html)
|
531
|
+
#
|
532
|
+
# @note This method requires authentication with "read" permissions.
|
533
|
+
def get_photos_with_geo_data(params = {})
|
534
|
+
get_media_with_geo_data({:media => 'photos'}.merge(params))
|
535
|
+
end
|
536
|
+
# Fetches geo-tagged videos from the authenticated user.
|
537
|
+
#
|
538
|
+
# @return [Flickrie:Collection<Flickrie::Video>]
|
539
|
+
# @api_method [flickr.photos.getWithGeoData](http://www.flickr.com/services/api/flickr.photos.getWithGeoData.html)
|
540
|
+
#
|
541
|
+
# @note This method requires authentication with "read" permissions.
|
542
|
+
def get_videos_with_geo_data(params = {})
|
543
|
+
get_media_with_geo_data({:media => 'videos'}.merge(params))
|
544
|
+
end
|
545
|
+
|
546
|
+
# Fetches photos and videos from the authenticated user that are not
|
547
|
+
# geo-tagged.
|
548
|
+
#
|
549
|
+
# @return [Flickrie:Collection<Flickrie:Photo, Flickrie::Video>]
|
550
|
+
# @api_method [flickr.photos.getWithoutGeoData](http://www.flickr.com/services/api/flickr.photos.getWithoutGeoData.html)
|
551
|
+
#
|
552
|
+
# @note This method requires authentication with "read" permissions.
|
553
|
+
def get_media_without_geo_data(params = {})
|
554
|
+
response = client.get_media_with_geo_data({:media => 'all'}.merge(params))
|
555
|
+
Media.from_geo_data(response.body['photos'])
|
556
|
+
end
|
557
|
+
# Fetches photos from the authenticated user that are not geo-tagged.
|
558
|
+
#
|
559
|
+
# @return [Flickrie:Collection<Flickrie:Photo>]
|
560
|
+
# @api_method [flickr.photos.getWithoutGeoData](http://www.flickr.com/services/api/flickr.photos.getWithoutGeoData.html)
|
561
|
+
#
|
562
|
+
# @note This method requires authentication with "read" permissions.
|
563
|
+
def get_photos_without_geo_data(params = {})
|
564
|
+
get_media_with_geo_data({:media => 'photos'}.merge(params))
|
565
|
+
end
|
566
|
+
# Fetches videos from the authenticated user that are not geo-tagged.
|
567
|
+
#
|
568
|
+
# @return [Flickrie:Collection<Flickrie::Video>]
|
569
|
+
# @api_method [flickr.photos.getWithoutGeoData](http://www.flickr.com/services/api/flickr.photos.getWithoutGeoData.html)
|
570
|
+
#
|
571
|
+
# @note This method requires authentication with "read" permissions.
|
572
|
+
def get_videos_without_geo_data(params = {})
|
573
|
+
get_media_with_geo_data({:media => 'videos'}.merge(params))
|
574
|
+
end
|
575
|
+
|
576
|
+
# Fetches photos and videos from the authenticated user that have
|
577
|
+
# recently been updated.
|
578
|
+
#
|
579
|
+
# @return [Flickrie::Collection<Flickrie::Photo, Flickrie::Video>]
|
580
|
+
# @api_method [flickr.photos.recentlyUpdated](http://www.flickr.com/services/api/flickr.photos.recentlyUpdated.html)
|
581
|
+
#
|
582
|
+
# @note This method requires authentication with "read" permissions.
|
583
|
+
def recently_updated_media(params = {})
|
584
|
+
response = client.recently_updated_media(params)
|
585
|
+
Media.from_recently_updated(response.body['photos'])
|
586
|
+
end
|
587
|
+
# Fetches photos from the authenticated user that have recently been updated.
|
588
|
+
#
|
589
|
+
# @return [Flickrie::Collection<Flickrie::Photo>]
|
590
|
+
# @api_method [flickr.photos.recentlyUpdated](http://www.flickr.com/services/api/flickr.photos.recentlyUpdated.html)
|
591
|
+
#
|
592
|
+
# @note This method requires authentication with "read" permissions.
|
593
|
+
def recently_updated_photos(params = {})
|
594
|
+
recently_updated_media(params).select { |media| media.is_a?(Photo) }
|
595
|
+
end
|
596
|
+
# Fetches videos from the authenticated user that have recently been updated.
|
597
|
+
#
|
598
|
+
# @return [Flickrie::Collection<Flickrie::Video>]
|
599
|
+
# @api_method [flickr.photos.recentlyUpdated](http://www.flickr.com/services/api/flickr.photos.recentlyUpdated.html)
|
600
|
+
#
|
601
|
+
# @note This method requires authentication with "read" permissions.
|
602
|
+
def recently_updated_videos(params = {})
|
603
|
+
recently_updated_media(params).select { |media| media.is_a?(Video) }
|
604
|
+
end
|
605
|
+
|
417
606
|
# Remove the tag with the given ID
|
418
607
|
#
|
419
608
|
# @param tag_id [String]
|
@@ -433,8 +622,8 @@ module Flickrie
|
|
433
622
|
# @param search_params [Hash] Options for searching (see the link below under "Flickr API method")
|
434
623
|
# @return [Flickrie::Collection<Flickrie::Photo, Flickrie::Video>]
|
435
624
|
# @api_method [flickr.photos.search](http://www.flickr.com/services/api/flickr.photos.search.html)
|
436
|
-
def search_media(
|
437
|
-
response = client.search_media(
|
625
|
+
def search_media(params = {})
|
626
|
+
response = client.search_media({:media => 'all'}.merge(params))
|
438
627
|
Media.from_search(response.body['photos'])
|
439
628
|
end
|
440
629
|
# Fetches photos matching a certain criteria.
|
@@ -442,17 +631,102 @@ module Flickrie
|
|
442
631
|
# @param search_params [Hash] Options for searching (see the link below under "Flickr API method")
|
443
632
|
# @return [Flickrie::Collection<Flickrie::Photo>]
|
444
633
|
# @api_method [flickr.photos.search](http://www.flickr.com/services/api/flickr.photos.search.html)
|
445
|
-
def search_photos(
|
446
|
-
search_media(
|
634
|
+
def search_photos(params = {})
|
635
|
+
search_media({:media => 'photos'}.merge(params))
|
447
636
|
end
|
448
637
|
# Fetches videos matching a certain criteria.
|
449
638
|
#
|
450
639
|
# @param search_params [Hash] Options for searching (see the link below under "Flickr API method")
|
451
640
|
# @return [Flickrie::Collection<Flickrie::Video>]
|
452
641
|
# @api_method [flickr.photos.search](http://www.flickr.com/services/api/flickr.photos.search.html)
|
453
|
-
def search_videos(
|
454
|
-
search_media(
|
642
|
+
def search_videos(params = {})
|
643
|
+
search_media({:media => 'videos'}.merge(params))
|
644
|
+
end
|
645
|
+
|
646
|
+
# Sets the content type of a photo/video.
|
647
|
+
#
|
648
|
+
# @param media_id [String, Fixnum]
|
649
|
+
# @param content_type [String, Fixnum]
|
650
|
+
# @return [nil]
|
651
|
+
# @api_method [flickr.photos.setContentType](http://www.flickr.com/services/api/flickr.photos.setContentType.html)
|
652
|
+
#
|
653
|
+
# @note This method requires authentication with "write" permissions.
|
654
|
+
def set_media_content_type(media_id, content_type, params = {})
|
655
|
+
client.set_media_content_type(media_id, content_type, params)
|
656
|
+
nil
|
657
|
+
end
|
658
|
+
alias set_photo_content_type set_media_content_type
|
659
|
+
alias set_video_content_type set_media_content_type
|
660
|
+
|
661
|
+
# Sets dates for a photo/video.
|
662
|
+
#
|
663
|
+
# @param media_id [String, Fixnum]
|
664
|
+
# @return [nil]
|
665
|
+
# @api_method [flickr.photos.setDates](http://www.flickr.com/services/api/flickr.photos.setDates.html)
|
666
|
+
#
|
667
|
+
# @note This method requires authentication with "write" permissions.
|
668
|
+
def set_media_dates(media_id, params = {})
|
669
|
+
client.set_media_dates(media_id, params)
|
670
|
+
nil
|
671
|
+
end
|
672
|
+
alias set_photo_dates set_media_dates
|
673
|
+
alias set_video_dates set_media_dates
|
674
|
+
|
675
|
+
# Sets meta information for a photo/video.
|
676
|
+
#
|
677
|
+
# @param media_id [String, Fixnum]
|
678
|
+
# @return [nil]
|
679
|
+
# @api_method [flickr.photos.setMeta](http://www.flickr.com/services/api/flickr.photos.setMeta.html)
|
680
|
+
#
|
681
|
+
# @note This method requires authentication with "write" permissions.
|
682
|
+
def set_media_meta(media_id, params = {})
|
683
|
+
client.set_media_meta(media_id, params)
|
684
|
+
nil
|
685
|
+
end
|
686
|
+
alias set_photo_meta set_media_meta
|
687
|
+
alias set_video_meta set_media_meta
|
688
|
+
|
689
|
+
# Sets permissions for a photo/video.
|
690
|
+
#
|
691
|
+
# @param media_id [String, Fixnum]
|
692
|
+
# @return [nil]
|
693
|
+
# @api_method [flickr.photos.setPerms](http://www.flickr.com/services/api/flickr.photos.setPerms.html)
|
694
|
+
#
|
695
|
+
# @note This method requires authentication with "write" permissions.
|
696
|
+
def set_media_permissions(media_id, params = {})
|
697
|
+
client.set_media_permissions(media_id, params)
|
698
|
+
nil
|
699
|
+
end
|
700
|
+
alias set_photo_permissions set_media_permissions
|
701
|
+
alias set_video_permissions set_media_permissions
|
702
|
+
|
703
|
+
# Sets the safety level of a photo/video.
|
704
|
+
#
|
705
|
+
# @param media_id [String, Fixnum]
|
706
|
+
# @return [nil]
|
707
|
+
# @api_method [flickr.photos.setSafetyLevel](http://www.flickr.com/services/api/flickr.photos.setSafetyLevel.html)
|
708
|
+
#
|
709
|
+
# @note This method requires authentication with "write" permissions.
|
710
|
+
def set_media_safety_level(media_id, params = {})
|
711
|
+
client.set_media_safety_level(media_id, params)
|
712
|
+
nil
|
713
|
+
end
|
714
|
+
alias set_photo_safety_level set_media_safety_level
|
715
|
+
alias set_video_safety_level set_media_safety_level
|
716
|
+
|
717
|
+
# Sets tags for a photo/video.
|
718
|
+
#
|
719
|
+
# @params media_id [String, Fixnum]
|
720
|
+
# @return [nil]
|
721
|
+
# @api_method [flickr.photos.setTags](http://www.flickr.com/services/api/flickr.photos.setTags.html)
|
722
|
+
#
|
723
|
+
# @note This method requires authentication with "write" permissions.
|
724
|
+
def set_media_tags(media_id, tags, params = {})
|
725
|
+
client.set_media_tags(media_id, tags, params)
|
726
|
+
nil
|
455
727
|
end
|
728
|
+
alias set_photo_tags set_media_tags
|
729
|
+
alias set_video_tags set_media_tags
|
456
730
|
|
457
731
|
# Fetches all available types of licenses.
|
458
732
|
#
|
@@ -511,7 +785,7 @@ module Flickrie
|
|
511
785
|
# @return [Flickrie::Collection<Flickrie::Photo, Flickrie::Video>]
|
512
786
|
# @api_method [flickr.photosets.getPhotos](http://www.flickr.com/services/api/flickr.photosets.getPhotos.html)
|
513
787
|
def media_from_set(set_id, params = {})
|
514
|
-
response = client.media_from_set(set_id, params)
|
788
|
+
response = client.media_from_set(set_id, {:media => 'all'}.merge(params))
|
515
789
|
Media.from_set(response.body['photoset'])
|
516
790
|
end
|
517
791
|
# Fetches photos from a set with the given ID.
|
@@ -521,7 +795,7 @@ module Flickrie
|
|
521
795
|
# @return [Flickrie::Collection<Flickrie::Photo>]
|
522
796
|
# @api_method [flickr.photosets.getPhotos](http://www.flickr.com/services/api/flickr.photosets.getPhotos.html)
|
523
797
|
def photos_from_set(set_id, params = {})
|
524
|
-
media_from_set(set_id,
|
798
|
+
media_from_set(set_id, {:media => 'photos'}.merge(params))
|
525
799
|
end
|
526
800
|
# Fetches videos from a set with the given ID.
|
527
801
|
#
|
@@ -530,7 +804,7 @@ module Flickrie
|
|
530
804
|
# @return [Flickrie::Collection<Flickrie::Video>]
|
531
805
|
# @api_method [flickr.photosets.getPhotos](http://www.flickr.com/services/api/flickr.photosets.getPhotos.html)
|
532
806
|
def videos_from_set(set_id, params = {})
|
533
|
-
media_from_set(set_id,
|
807
|
+
media_from_set(set_id, {:media => 'videos'}.merge(params))
|
534
808
|
end
|
535
809
|
|
536
810
|
# Tests if the authentication was successful. If it was, it
|
data/lib/flickrie/client.rb
CHANGED
@@ -37,6 +37,11 @@ module Flickrie
|
|
37
37
|
ensure_media({:user_id => nsid}.merge(params))
|
38
38
|
end
|
39
39
|
|
40
|
+
def media_of_user(nsid, params = {})
|
41
|
+
get 'flickr.people.getPhotosOf',
|
42
|
+
ensure_media({:user_id => nsid}.merge(params))
|
43
|
+
end
|
44
|
+
|
40
45
|
def public_media_from_user(nsid, params = {})
|
41
46
|
get 'flickr.people.getPublicPhotos',
|
42
47
|
ensure_media({:user_id => nsid}.merge(params))
|
@@ -94,11 +99,36 @@ module Flickrie
|
|
94
99
|
get 'flickr.photos.getNotInSet', ensure_media(params)
|
95
100
|
end
|
96
101
|
|
102
|
+
def get_media_permissions(media_id, params = {})
|
103
|
+
get 'flickr.photos.getPerms',
|
104
|
+
{:photo_id => media_id}.merge(params)
|
105
|
+
end
|
106
|
+
|
107
|
+
def get_recent_media(params = {})
|
108
|
+
get 'flickr.photos.getRecent', ensure_media(params)
|
109
|
+
end
|
110
|
+
|
97
111
|
def get_media_sizes(media_id, params = {})
|
98
112
|
get 'flickr.photos.getSizes',
|
99
113
|
{:photo_id => media_id}.merge(params)
|
100
114
|
end
|
101
115
|
|
116
|
+
def get_untagged_media(params = {})
|
117
|
+
get 'flickr.photos.getUntagged', ensure_media(params)
|
118
|
+
end
|
119
|
+
|
120
|
+
def get_media_with_geo_data(params = {})
|
121
|
+
get 'flickr.photos.getWithGeoData', ensure_media(params)
|
122
|
+
end
|
123
|
+
|
124
|
+
def get_media_without_geo_data(params = {})
|
125
|
+
get 'flickr.photos.getWithoutGeoData', ensure_media(params)
|
126
|
+
end
|
127
|
+
|
128
|
+
def recently_updated_media(params = {})
|
129
|
+
get 'flickr.photos.recentlyUpdated', ensure_media(params)
|
130
|
+
end
|
131
|
+
|
102
132
|
def remove_media_tag(tag_id, params = {})
|
103
133
|
post 'flickr.photos.removeTag',
|
104
134
|
{:tag_id => tag_id}.merge(params)
|
@@ -108,6 +138,36 @@ module Flickrie
|
|
108
138
|
get 'flickr.photos.search', ensure_media(params)
|
109
139
|
end
|
110
140
|
|
141
|
+
def set_media_content_type(media_id, content_type, params = {})
|
142
|
+
post 'flickr.photos.setContentType',
|
143
|
+
{:photo_id => media_id, :content_type => content_type}.merge(params)
|
144
|
+
end
|
145
|
+
|
146
|
+
def set_media_dates(media_id, params = {})
|
147
|
+
post 'flickr.photos.setDates',
|
148
|
+
{:photo_id => media_id}.merge(params)
|
149
|
+
end
|
150
|
+
|
151
|
+
def set_media_meta(media_id, params = {})
|
152
|
+
post 'flickr.photos.setMeta',
|
153
|
+
{:photo_id => media_id}.merge(params)
|
154
|
+
end
|
155
|
+
|
156
|
+
def set_media_permissions(media_id, params = {})
|
157
|
+
post 'flickr.photos.setPerms',
|
158
|
+
{:photo_id => media_id}.merge(params)
|
159
|
+
end
|
160
|
+
|
161
|
+
def set_media_safety_level(media_id, params = {})
|
162
|
+
post 'flickr.photos.setSafetyLevel',
|
163
|
+
{:photo_id => media_id}.merge(params)
|
164
|
+
end
|
165
|
+
|
166
|
+
def set_media_tags(media_id, tags, params = {})
|
167
|
+
post 'flickr.photos.setTags',
|
168
|
+
{:photo_id => media_id, :tags => tags}.merge(params)
|
169
|
+
end
|
170
|
+
|
111
171
|
# photos.upload
|
112
172
|
def check_upload_tickets(tickets, params = {})
|
113
173
|
get 'flickr.photos.upload.checkTickets',
|
@@ -65,6 +65,37 @@ module Flickrie
|
|
65
65
|
from_user(hash)
|
66
66
|
end
|
67
67
|
|
68
|
+
def of_user(hash)
|
69
|
+
from_user(hash)
|
70
|
+
end
|
71
|
+
|
72
|
+
def from_perms(hash)
|
73
|
+
fix_visibility(hash)
|
74
|
+
hash['permissions'] = {
|
75
|
+
'permcomment' => hash.delete('permcomment'),
|
76
|
+
'permaddmeta' => hash.delete('permaddmeta')
|
77
|
+
}
|
78
|
+
new(hash)
|
79
|
+
end
|
80
|
+
|
81
|
+
def from_recent(hash)
|
82
|
+
from_user(hash)
|
83
|
+
end
|
84
|
+
|
85
|
+
def from_untagged(hash)
|
86
|
+
from_user(hash)
|
87
|
+
end
|
88
|
+
|
89
|
+
def from_geo_data(hash)
|
90
|
+
from_user(hash)
|
91
|
+
end
|
92
|
+
|
93
|
+
def from_recently_updated(hash)
|
94
|
+
from_user(hash)
|
95
|
+
end
|
96
|
+
|
97
|
+
#------------------------------------------------------------
|
98
|
+
|
68
99
|
def fix_extras(hash)
|
69
100
|
if hash['iconserver'] or hash['iconfarm']
|
70
101
|
hash['owner'] ||= {}
|
data/lib/flickrie/media.rb
CHANGED
@@ -133,6 +133,11 @@ module Flickrie
|
|
133
133
|
# @return [Boolean]
|
134
134
|
def can_share?() Integer(@hash['usage']['canshare']) == 1 rescue nil end
|
135
135
|
|
136
|
+
# @return [Boolean]
|
137
|
+
def commenting_permissions() Integer(@hash['permissions']['permcomment']) rescue nil end
|
138
|
+
# @return [Boolean]
|
139
|
+
def adding_meta_permissions() Integer(@hash['permissions']['permaddmeta']) rescue nil end
|
140
|
+
|
136
141
|
# @return [Boolean]
|
137
142
|
def has_people?() Integer(@hash['people']['haspeople']) == 1 rescue nil end
|
138
143
|
|
@@ -142,6 +147,9 @@ module Flickrie
|
|
142
147
|
# @return [Array<Flickrie::Media::Note>]
|
143
148
|
def notes() @hash['notes']['note'].map { |info| Note.new(info) } rescue nil end
|
144
149
|
|
150
|
+
# @return [Integer]
|
151
|
+
def content_type() Integer(@hash['content_type']) rescue nil end
|
152
|
+
|
145
153
|
# @return [Flickrie::Collection<Flickrie::User>]
|
146
154
|
def favorites
|
147
155
|
collection = @hash['person'].map { |info| User.new(info) }
|
data/lib/flickrie/version.rb
CHANGED
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: 1.
|
4
|
+
version: 1.4.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-05-31 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday_middleware
|
16
|
-
requirement: &
|
16
|
+
requirement: &70134275076460 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -24,10 +24,10 @@ dependencies:
|
|
24
24
|
version: '0.9'
|
25
25
|
type: :runtime
|
26
26
|
prerelease: false
|
27
|
-
version_requirements: *
|
27
|
+
version_requirements: *70134275076460
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: faraday
|
30
|
-
requirement: &
|
30
|
+
requirement: &70134275071700 !ruby/object:Gem::Requirement
|
31
31
|
none: false
|
32
32
|
requirements:
|
33
33
|
- - ! '>='
|
@@ -38,10 +38,10 @@ dependencies:
|
|
38
38
|
version: '0.9'
|
39
39
|
type: :runtime
|
40
40
|
prerelease: false
|
41
|
-
version_requirements: *
|
41
|
+
version_requirements: *70134275071700
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: simple_oauth
|
44
|
-
requirement: &
|
44
|
+
requirement: &70134275068600 !ruby/object:Gem::Requirement
|
45
45
|
none: false
|
46
46
|
requirements:
|
47
47
|
- - ~>
|
@@ -49,10 +49,10 @@ dependencies:
|
|
49
49
|
version: '0.1'
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
|
-
version_requirements: *
|
52
|
+
version_requirements: *70134275068600
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: multi_xml
|
55
|
-
requirement: &
|
55
|
+
requirement: &70134275067560 !ruby/object:Gem::Requirement
|
56
56
|
none: false
|
57
57
|
requirements:
|
58
58
|
- - ~>
|
@@ -60,10 +60,10 @@ dependencies:
|
|
60
60
|
version: '0.4'
|
61
61
|
type: :runtime
|
62
62
|
prerelease: false
|
63
|
-
version_requirements: *
|
63
|
+
version_requirements: *70134275067560
|
64
64
|
- !ruby/object:Gem::Dependency
|
65
65
|
name: bundler
|
66
|
-
requirement: &
|
66
|
+
requirement: &70134275065720 !ruby/object:Gem::Requirement
|
67
67
|
none: false
|
68
68
|
requirements:
|
69
69
|
- - ~>
|
@@ -71,10 +71,10 @@ dependencies:
|
|
71
71
|
version: '1.0'
|
72
72
|
type: :development
|
73
73
|
prerelease: false
|
74
|
-
version_requirements: *
|
74
|
+
version_requirements: *70134275065720
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: rake
|
77
|
-
requirement: &
|
77
|
+
requirement: &70134275064320 !ruby/object:Gem::Requirement
|
78
78
|
none: false
|
79
79
|
requirements:
|
80
80
|
- - ~>
|
@@ -82,10 +82,10 @@ dependencies:
|
|
82
82
|
version: '0.9'
|
83
83
|
type: :development
|
84
84
|
prerelease: false
|
85
|
-
version_requirements: *
|
85
|
+
version_requirements: *70134275064320
|
86
86
|
- !ruby/object:Gem::Dependency
|
87
87
|
name: rspec
|
88
|
-
requirement: &
|
88
|
+
requirement: &70134274422200 !ruby/object:Gem::Requirement
|
89
89
|
none: false
|
90
90
|
requirements:
|
91
91
|
- - ! '>='
|
@@ -96,10 +96,10 @@ dependencies:
|
|
96
96
|
version: '3'
|
97
97
|
type: :development
|
98
98
|
prerelease: false
|
99
|
-
version_requirements: *
|
99
|
+
version_requirements: *70134274422200
|
100
100
|
- !ruby/object:Gem::Dependency
|
101
101
|
name: vcr
|
102
|
-
requirement: &
|
102
|
+
requirement: &70134274418540 !ruby/object:Gem::Requirement
|
103
103
|
none: false
|
104
104
|
requirements:
|
105
105
|
- - ~>
|
@@ -107,7 +107,7 @@ dependencies:
|
|
107
107
|
version: '2.1'
|
108
108
|
type: :development
|
109
109
|
prerelease: false
|
110
|
-
version_requirements: *
|
110
|
+
version_requirements: *70134274418540
|
111
111
|
description: This gem wraps the Flickr API with a nice object-oriented interface.
|
112
112
|
email: janko.marohnic@gmail.com
|
113
113
|
executables: []
|
@@ -163,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
163
163
|
version: '0'
|
164
164
|
segments:
|
165
165
|
- 0
|
166
|
-
hash: -
|
166
|
+
hash: -4103354363918885548
|
167
167
|
requirements: []
|
168
168
|
rubyforge_project:
|
169
169
|
rubygems_version: 1.8.11
|