Module: Flickrie::ApiMethods
Instance Method Summary collapse
-
#add_media_to_set(set_id, media_id, params = {}) ⇒ nil
(also: #add_photo_to_set, #add_video_to_set)
Adds existing photo/video to a set with the given ID.
-
#check_upload_tickets(tickets, params = {}) ⇒ Flickrie::Ticket
Fetches upload tickets with given IDs.
-
#comment_media(media_id, comment, params = {}) ⇒ String
(also: #comment_photo, #comment_video)
Comment on a photo/video.
-
#create_set(params = {}) ⇒ Flickrie::Set
Creates a new set.
-
#delete_media(media_id, params = {}) ⇒ nil
(also: #delete_photo, #delete_video)
Deletes the photo/video with the given ID.
-
#delete_media_comment(comment_id, params = {}) ⇒ nil
(also: #delete_photo_comment, #delete_video_comment)
Delete a comment.
-
#delete_set(set_id, params = {}) ⇒ nil
Deletes a set.
-
#edit_media_comment(comment_id, comment, params = {}) ⇒ nil
(also: #edit_photo_comment, #edit_video_comment)
Edit a specific comment.
-
#edit_set_media(set_id, params = {}) ⇒ nil
(also: #edit_set_photos, #edit_set_videos)
Edits photos/videos of a set with the given ID.
-
#edit_set_metadata(set_id, params = {}) ⇒ nil
Modifies metadata of a set.
-
#find_user_by_email(email, params = {}) ⇒ Flickrie::User
Fetches the Flickr user with the given email.
-
#find_user_by_username(username, params = {}) ⇒ Flickrie::User
Fetches the Flickr user with the given username.
-
#get_licenses(params = {}) ⇒ Array<Flickrie::License>
Fetches all available types of licenses.
-
#get_media_comments(media_id, params = {}) ⇒ Array<Flickrie::Comment>
(also: #get_photo_comments, #get_video_comments)
Get list of comments of a photo/video.
-
#get_media_context(media_id, params = {}) ⇒ Flickrie::MediaContext
(also: #get_photo_context, #get_video_context)
Fetches context of the photo/video with the given ID.
-
#get_media_counts(params = {}) ⇒ Flickrie::MediaCount
(also: #get_photos_counts, #get_videos_counts)
Fetches numbers of photos and videos for given date ranges.
-
#get_media_from_contacts(params = {}) ⇒ Flickrie::Collection<Flickrie::Photo, Flickrie::Video>
Fetches photos and videos from contacts of the user who authenticated.
-
#get_media_from_set(set_id, params = {}) ⇒ Flickrie::Collection<Flickrie::Photo, Flickrie::Video>
Fetches photos and videos from a set with the given ID.
-
#get_media_from_user(nsid, params = {}) ⇒ Flickrie::Collection<Flickrie::Photo, Flickrie::Video>
Fetches photos and videos from the Flickr user with the given NSID.
-
#get_media_info(media_id, params = {}) ⇒ Flickrie::Photo, Flickrie::Video
(also: #get_photo_info, #get_video_info)
Fetches info of the photo/video with the given ID.
-
#get_media_not_in_set(params = {}) ⇒ Flickrie::Collection<Flickrie::Photo, Flickrie::Video>
Fetches photos and videos from the authenticated user that are not in any set.
-
#get_media_of_user(nsid, params = {}) ⇒ Flickrie::Collection<Flickrie::Photo, Flickrie::Video>
Fetches photos and videos containing a Flickr user with the given NSID.
-
#get_media_with_geo_data(params = {}) ⇒ Flickrie::Collection<Flickrie::Photo, Flickrie::Video>
Fetches geo-tagged photos and videos from the authenticated user.
-
#get_media_without_geo_data(params = {}) ⇒ Flickrie::Collection<Flickrie::Photo, Flickrie::Video>
Fetches photos and videos from the authenticated user that are not geo-tagged.
-
#get_methods(params = {}) ⇒ Array<String>
Fetches the list of all API methods.
-
#get_photo_exif(photo_id, params = {}) ⇒ Flickrie::Photo
Fetches the exif for the photo with the given ID.
-
#get_photo_favorites(photo_id, params = {}) ⇒ Flickrie::Photo
Fetches the list of users who favorited the photo with the given ID.
-
#get_photo_permissions(photo_id, params = {}) ⇒ Flickrie::Photo
Gets permissions of a photo with the given ID.
-
#get_photo_sizes(photo_id, params = {}) ⇒ Flickrie::Photo
Fetches the sizes of the photo with the given ID.
-
#get_photos_from_contacts(params = {}) ⇒ Flickrie::Collection<Flickrie::Photo>
Fetches photos from contacts of the user who authenticated.
-
#get_photos_from_set(set_id, params = {}) ⇒ Flickrie::Collection<Flickrie::Photo>
Fetches photos from a set with the given ID.
-
#get_photos_from_user(nsid, params = {}) ⇒ Flickrie::Collection<Flickrie::Photo>
Fetches photos from the Flickr user with the given NSID.
-
#get_photos_not_in_set(params = {}) ⇒ Flickrie::Collection<Flickrie::Photo>
Fetches photos from the authenticated user that are not in any set.
-
#get_photos_of_user(nsid, params = {}) ⇒ Flickrie::Collection<Flickrie::Photo>
Fetches photos containing a Flickr user with the given NSID.
-
#get_photos_with_geo_data(params = {}) ⇒ Flickrie::Collection<Flickrie::Photo>
Fetches geo-tagged photos from the authenticated user.
-
#get_photos_without_geo_data(params = {}) ⇒ Flickrie::Collection<Flickrie::Photo>
Fetches photos from the authenticated user that are not geo-tagged.
-
#get_public_media_from_contacts(nsid, params = {}) ⇒ Flickrie::Collection<Flickrie::Photo, Flickrie::Video>
Fetches public photos and videos from contacts of the user with the given NSID.
-
#get_public_media_from_user(nsid, params = {}) ⇒ Flickrie::Collection<Flickrie::Photo, Flickrie::Video>
Fetches public photos and videos from the Flickr user with the given NSID.
-
#get_public_photos_from_contacts(nsid, params = {}) ⇒ Flickrie::Collection<Flickrie::Photo>
Fetches public photos from contacts of the user with the given NSID.
-
#get_public_photos_from_user(nsid, params = {}) ⇒ Flickrie::Collection<Flickrie::Photo>
Fetches public photos from the Flickr user with the given NSID.
-
#get_public_videos_from_contacts(nsid, params = {}) ⇒ Flickrie::Collection<Flickrie::Video>
Fetches public videos from contacts of the user with the given NSID.
-
#get_public_videos_from_user(nsid, params = {}) ⇒ Flickrie::Collection<Flickrie::Video>
Fetches public videos from the Flickr user with the given NSID.
-
#get_recent_media(params = {}) ⇒ Flickrie::Collection<Flickrie::Photo, Flickrie::Video>
Fetches the latest photos and videos uploaded to Flickr.
-
#get_recent_photos(params = {}) ⇒ Flickrie::Collection<Flickrie::Photo>
Fetches the latest photos uploaded to Flickr.
-
#get_recent_videos(params = {}) ⇒ Flickrie::Collection<Flickrie::Video>
Fetches the latest videos uploaded to Flickr.
-
#get_recently_commented_media_from_contacts(params = {}) ⇒ Flickrie::Collection<Flickrie::Photo, Flickrie::Video>
Get list of photos/videos that have been recently commented by the contacts of the authenticated user.
-
#get_recently_commented_photos_from_contacts(params = {}) ⇒ Flickrie::Collection<Flickrie::Photo>
Get list of photos that have been recently commented by the contacts of the authenticated user.
-
#get_recently_commented_videos_from_contacts(params = {}) ⇒ Flickrie::Collection<Flickrie::Video>
Get list of videos that have been recently commented by the contacts of the authenticated user.
-
#get_recently_updated_media(params = {}) ⇒ Flickrie::Collection<Flickrie::Photo, Flickrie::Video>
Fetches photos and videos from the authenticated user that have recently been updated.
-
#get_recently_updated_photos(params = {}) ⇒ Flickrie::Collection<Flickrie::Photo>
Fetches photos from the authenticated user that have recently been updated.
-
#get_recently_updated_videos(params = {}) ⇒ Flickrie::Collection<Flickrie::Video>
Fetches videos from the authenticated user that have recently been updated.
-
#get_set_context(set_id, media_id, params = {}) ⇒ Flickrie::MediaContext
Returns next and previous photos/videos for a photo/video in a set.
-
#get_set_info(set_id, params = {}) ⇒ Flickrie::Set
Fetches information about the set with the given ID.
-
#get_sets_from_user(nsid, params = {}) ⇒ Flickrie::Collection<Flickrie::Set>
Fetches sets from a user with the given NSID.
-
#get_untagged_media(params = {}) ⇒ Flickrie::Collection<Flickrie::Photo, Flickrie::Video>
Fetches photos and videos from the authenticated user that have no tags.
-
#get_untagged_photos(params = {}) ⇒ Flickrie::Collection<Flickrie::Photo>
Fetches photos from the authenticated user that have no tags.
-
#get_untagged_videos(params = {}) ⇒ Flickrie::Collection<Flickrie::Video>
Fetches videos from the authenticated user that have no tags.
-
#get_upload_status(params = {}) ⇒ Flickrie::User
Returns the upload status of the user who is currently authenticated.
-
#get_user_info(nsid, params = {}) ⇒ Flickrie::User
Fetches the Flickr user with the given NSID.
-
#get_video_exif(video_id, params = {}) ⇒ Flickrie::Video
Fetches the exif for the video with the given ID.
-
#get_video_favorites(video_id, params = {}) ⇒ Flickrie::Video
Fetches the list of users who favorited the video with the given ID.
-
#get_video_permissions(video_id, params = {}) ⇒ Flickrie::Video
Gets permissions of a video with the given ID.
-
#get_video_sizes(video_id, params = {}) ⇒ Flickrie::Video
Fetches the sizes of the video with the given ID.
-
#get_videos_from_contacts(params = {}) ⇒ Flickrie::Collection<Flickrie::Video>
Fetches videos from contacts of the user who authenticated.
-
#get_videos_from_set(set_id, params = {}) ⇒ Flickrie::Collection<Flickrie::Video>
Fetches videos from a set with the given ID.
-
#get_videos_from_user(nsid, params = {}) ⇒ Flickrie::Collection<Flickrie::Video>
Fetches videos from the Flickr user with the given NSID.
-
#get_videos_not_in_set(params = {}) ⇒ Flickrie::Collection<Flickrie::Video>
Fetches videos from the authenticated user that are not in any set.
-
#get_videos_of_user(nsid, params = {}) ⇒ Flickrie::Collection<Flickrie::Video>
Fetches videos containing a Flickr user with the given NSID.
-
#get_videos_with_geo_data(params = {}) ⇒ Flickrie::Collection<Flickrie::Video>
Fetches geo-tagged videos from the authenticated user.
-
#get_videos_without_geo_data(params = {}) ⇒ Flickrie::Collection<Flickrie::Video>
Fetches videos from the authenticated user that are not geo-tagged.
-
#order_sets(set_ids, params = {}) ⇒ nil
Sets the order of sets belonging to the authenticated user.
-
#remove_media_from_set(set_id, media_ids, params = {}) ⇒ nil
(also: #remove_photos_from_set, #remove_videos_from_set)
Removes photos/videos from a set.
-
#reorder_media_in_set(set_id, media_ids, params = {}) ⇒ nil
(also: #reorder_photos_in_set, #reorder_videos_in_set)
Reorders photos/videos inside a set.
-
#replace(media, media_id, params = {}) ⇒ String
For replacing photos and videos on Flickr.
-
#rotate_media(media_id, degrees, params = {}) ⇒ nil
(also: #rotate_photo, #rotate_video)
Rotates a photo/video.
-
#search_media(params = {}) ⇒ Flickrie::Collection<Flickrie::Photo, Flickrie::Video>
Fetches photos and videos matching a certain criteria.
-
#search_photos(params = {}) ⇒ Flickrie::Collection<Flickrie::Photo>
Fetches photos matching a certain criteria.
-
#search_videos(params = {}) ⇒ Flickrie::Collection<Flickrie::Video>
Fetches videos matching a certain criteria.
-
#set_media_content_type(media_id, content_type, params = {}) ⇒ nil
(also: #set_photo_content_type, #set_video_content_type)
Sets the content type of a photo/video.
-
#set_media_dates(media_id, params = {}) ⇒ nil
(also: #set_photo_dates, #set_video_dates)
Sets dates for a photo/video.
-
#set_media_license(media_id, license_id, params = {}) ⇒ nil
(also: #set_photo_license, #set_video_license)
Sets the license of a photo/video.
-
#set_media_meta(media_id, params = {}) ⇒ nil
(also: #set_photo_meta, #set_video_meta)
Sets meta information for a photo/video.
-
#set_media_permissions(media_id, params = {}) ⇒ nil
(also: #set_photo_permissions, #set_video_permissions)
Sets permissions for a photo/video.
-
#set_media_safety_level(media_id, params = {}) ⇒ nil
(also: #set_photo_safety_level, #set_video_safety_level)
Sets the safety level of a photo/video.
-
#set_media_tags(media_id, tags, params = {}) ⇒ nil
(also: #set_photo_tags, #set_video_tags)
Sets tags for a photo/video.
-
#set_set_primary_media(set_id, media_id, params = {}) ⇒ nil
(also: #set_set_primary_photo, #set_set_primary_video)
Sets set's primary photo/video.
-
#tag_media(media_id, tags, params = {}) ⇒ nil
(also: #tag_photo, #tag_video)
Add tags to the photo/video with the given ID.
-
#test_login(params = {}) ⇒ Flickrie::User
Tests if the authentication was successful.
-
#untag_media(tag_id, params = {}) ⇒ nil
(also: #untag_photo, #untag_video)
Remove the tag with the given ID.
-
#upload(media, params = {}) ⇒ String
For uploading photos and videos to Flickr.
Methods included from Deprecatable
Methods included from Callable
Instance Method Details
#add_media_to_set(set_id, media_id, params = {}) ⇒ nil Also known as: add_photo_to_set, add_video_to_set
This method requires authentication with "write" permissions.
Adds existing photo/video to a set with the given ID.
875 876 877 |
# File 'lib/flickrie/api_methods.rb', line 875 def add_media_to_set(set_id, media_id, params = {}) make_request(set_id, media_id, params) end |
#check_upload_tickets(tickets, params = {}) ⇒ Flickrie::Ticket
861 862 863 864 865 866 |
# File 'lib/flickrie/api_methods.rb', line 861 def check_upload_tickets(tickets, params = {}) ticket_ids = tickets.join(',') rescue tickets response = make_request(ticket_ids, params) response.body['uploader']['ticket']. map { |info| Ticket.new(info) } end |
#comment_media(media_id, comment, params = {}) ⇒ String Also known as: comment_photo, comment_video
This method requires authentication with "write" permissions.
Comment on a photo/video.
736 737 738 739 |
# File 'lib/flickrie/api_methods.rb', line 736 def comment_media(media_id, comment, params = {}) response = make_request(media_id, comment, params) response.body["comment"]["id"] end |
#create_set(params = {}) ⇒ Flickrie::Set
This method requires authentication with "write" permissions.
Creates a new set.
887 888 889 890 |
# File 'lib/flickrie/api_methods.rb', line 887 def create_set(params = {}) response = make_request(params) Set.new(response.body['photoset'], self) end |
#delete_media(media_id, params = {}) ⇒ nil Also known as: delete_photo, delete_video
This method requires authentication with "delete" permissions.
Deletes the photo/video with the given ID.
200 201 202 203 |
# File 'lib/flickrie/api_methods.rb', line 200 def delete_media(media_id, params = {}) make_request(media_id, params) nil end |
#delete_media_comment(comment_id, params = {}) ⇒ nil Also known as: delete_photo_comment, delete_video_comment
This method requires authentication with "write" permissions.
Delete a comment.
749 750 751 752 |
# File 'lib/flickrie/api_methods.rb', line 749 def delete_media_comment(comment_id, params = {}) make_request(comment_id, params) nil end |
#delete_set(set_id, params = {}) ⇒ nil
This method requires authentication with "write" permissions.
Deletes a set.
899 900 901 902 |
# File 'lib/flickrie/api_methods.rb', line 899 def delete_set(set_id, params = {}) make_request(set_id, params) nil end |
#edit_media_comment(comment_id, comment, params = {}) ⇒ nil Also known as: edit_photo_comment, edit_video_comment
This method requires authentication with "write" permissions.
Edit a specific comment.
762 763 764 765 |
# File 'lib/flickrie/api_methods.rb', line 762 def edit_media_comment(comment_id, comment, params = {}) make_request(comment_id, comment, params) nil end |
#edit_set_media(set_id, params = {}) ⇒ nil Also known as: edit_set_photos, edit_set_videos
This method requires authentication with "write" permissions.
Edits photos/videos of a set with the given ID.
923 924 925 926 |
# File 'lib/flickrie/api_methods.rb', line 923 def edit_set_media(set_id, params = {}) make_request(set_id, params) nil end |
#edit_set_metadata(set_id, params = {}) ⇒ nil
This method requires authentication with "write" permissions.
Modifies metadata of a set.
911 912 913 914 |
# File 'lib/flickrie/api_methods.rb', line 911 def (set_id, params = {}) make_request(set_id, params) nil end |
#find_user_by_email(email, params = {}) ⇒ Flickrie::User
Fetches the Flickr user with the given email.
57 58 59 60 |
# File 'lib/flickrie/api_methods.rb', line 57 def find_user_by_email(email, params = {}) response = make_request(email, params) User.new(response.body['user'], self) end |
#find_user_by_username(username, params = {}) ⇒ Flickrie::User
Fetches the Flickr user with the given username.
66 67 68 69 |
# File 'lib/flickrie/api_methods.rb', line 66 def find_user_by_username(username, params = {}) response = make_request(username, params) User.new(response.body['user'], self) end |
#get_licenses(params = {}) ⇒ Array<Flickrie::License>
Fetches all available types of licenses.
816 817 818 819 |
# File 'lib/flickrie/api_methods.rb', line 816 def get_licenses(params = {}) response = make_request(params) License.from_hash(response.body['licenses']['license']) end |
#get_media_comments(media_id, params = {}) ⇒ Array<Flickrie::Comment> Also known as: get_photo_comments, get_video_comments
Get list of comments of a photo/video.
773 774 775 776 |
# File 'lib/flickrie/api_methods.rb', line 773 def get_media_comments(media_id, params = {}) response = make_request(media_id, params) response.body["comments"]["comment"].map { |hash| Flickrie::Comment.new(hash, self) } end |
#get_media_context(media_id, params = {}) ⇒ Flickrie::MediaContext Also known as: get_photo_context, get_video_context
Fetches context of the photo/video with the given ID. Example:
context = Flickrie.get_photo_context(37124234)
context.count # => 23
context.previous # => #<Photo: id=2433240, ...>
context.next # => #<Video: id=1282404, ...>
277 278 279 280 |
# File 'lib/flickrie/api_methods.rb', line 277 def get_media_context(media_id, params = {}) response = make_request(media_id, params) MediaContext.new(response.body, self) end |
#get_media_counts(params = {}) ⇒ Flickrie::MediaCount Also known as: get_photos_counts, get_videos_counts
Fetches numbers of photos and videos for given date ranges. Example:
require 'date'
dates = [DateTime.parse("3rd Jan 2011").to_time, DateTime.parse("11th Aug 2011").to_time]
counts = Flickrie.get_media_counts(taken_dates: dates.map(&:to_i).join(','))
count = counts.first
count.value # => 24
count.date_range # => 2011-01-03 01:00:00 +0100..2011-08-11 02:00:00 +0200
count.date_range.begin # => 2011-01-03 01:00:00 +0100
count.from # => 2011-01-03 01:00:00 +0100
298 299 300 301 |
# File 'lib/flickrie/api_methods.rb', line 298 def get_media_counts(params = {}) response = make_request(params) MediaCount.new_collection(response.body['photocounts']) end |
#get_media_from_contacts(params = {}) ⇒ Flickrie::Collection<Flickrie::Photo, Flickrie::Video>
This method requires authentication with "read" permissions.
Fetches photos and videos from contacts of the user who authenticated.
213 214 215 216 |
# File 'lib/flickrie/api_methods.rb', line 213 def get_media_from_contacts(params = {}) response = make_request(params) Media.new_collection(response.body['photos'], self) end |
#get_media_from_set(set_id, params = {}) ⇒ Flickrie::Collection<Flickrie::Photo, Flickrie::Video>
Fetches photos and videos from a set with the given ID.
962 963 964 965 |
# File 'lib/flickrie/api_methods.rb', line 962 def get_media_from_set(set_id, params = {}) response = make_request(set_id, {media: 'all'}.merge(params)) Media.new_collection(response.body['photoset'], self) end |
#get_media_from_user(nsid, params = {}) ⇒ Flickrie::Collection<Flickrie::Photo, Flickrie::Video>
This method requires authentication with "read" permissions.
Fetches photos and videos from the Flickr user with the given NSID.
77 78 79 80 |
# File 'lib/flickrie/api_methods.rb', line 77 def get_media_from_user(nsid, params = {}) response = make_request(nsid, params) Media.new_collection(response.body['photos'], self) end |
#get_media_info(media_id, params = {}) ⇒ Flickrie::Photo, Flickrie::Video Also known as: get_photo_info, get_video_info
Fetches info of the photo/video with the given ID.
370 371 372 373 |
# File 'lib/flickrie/api_methods.rb', line 370 def get_media_info(media_id, params = {}) response = make_request(media_id, params) Media.new(response.body['photo'], self) end |
#get_media_not_in_set(params = {}) ⇒ Flickrie::Collection<Flickrie::Photo, Flickrie::Video>
This method requires authentication with "read" permissions.
Fetches photos and videos from the authenticated user that are not in any set.
384 385 386 387 |
# File 'lib/flickrie/api_methods.rb', line 384 def get_media_not_in_set(params = {}) response = make_request({media: 'all'}.merge(params)) Media.new_collection(response.body['photos'], self) end |
#get_media_of_user(nsid, params = {}) ⇒ Flickrie::Collection<Flickrie::Photo, Flickrie::Video>
Fetches photos and videos containing a Flickr user with the given NSID.
107 108 109 110 |
# File 'lib/flickrie/api_methods.rb', line 107 def get_media_of_user(nsid, params = {}) response = make_request(nsid, params) Media.new_collection(response.body['photos'], self) end |
#get_media_with_geo_data(params = {}) ⇒ Flickrie::Collection<Flickrie::Photo, Flickrie::Video>
This method requires authentication with "read" permissions.
Fetches geo-tagged photos and videos from the authenticated user.
519 520 521 522 |
# File 'lib/flickrie/api_methods.rb', line 519 def get_media_with_geo_data(params = {}) response = make_request({media: 'all'}.merge(params)) Media.new_collection(response.body['photos'], self) end |
#get_media_without_geo_data(params = {}) ⇒ Flickrie::Collection<Flickrie::Photo, Flickrie::Video>
This method requires authentication with "read" permissions.
Fetches photos and videos from the authenticated user that are not geo-tagged.
549 550 551 552 |
# File 'lib/flickrie/api_methods.rb', line 549 def get_media_without_geo_data(params = {}) response = make_request({media: 'all'}.merge(params)) Media.new_collection(response.body['photos'], self) end |
#get_methods(params = {}) ⇒ Array<String>
Fetches the list of all API methods.
1044 1045 1046 1047 |
# File 'lib/flickrie/api_methods.rb', line 1044 def get_methods(params = {}) response = make_request(params) response.body["methods"]["method"] end |
#get_photo_exif(photo_id, params = {}) ⇒ Flickrie::Photo
Fetches the exif for the photo with the given ID. Example:
photo = Flickrie.get_photo_exif(27234987)
photo.exif.get('Model') # => 'Canon PowerShot G12'
photo.exif.get('X-Resolution', data: 'raw') # => '180'
photo.exif.get('X-Resolution', data: 'clean') # => '180 dpi'
photo.exif.get('X-Resolution') # => '180 dpi'
317 318 319 320 |
# File 'lib/flickrie/api_methods.rb', line 317 def get_photo_exif(photo_id, params = {}) response = make_request(photo_id, params) Photo.new(response.body['photo'], self) end |
#get_photo_favorites(photo_id, params = {}) ⇒ Flickrie::Photo
Fetches the list of users who favorited the photo with the given ID. Example:
photo = Flickrie.get_photo_favorites(24810948)
photo.favorites.first.username # => "John Smith"
347 348 349 350 |
# File 'lib/flickrie/api_methods.rb', line 347 def get_photo_favorites(photo_id, params = {}) response = make_request(photo_id, params) Photo.new(response.body['photo'], self) end |
#get_photo_permissions(photo_id, params = {}) ⇒ Flickrie::Photo
This method requires authentication with "read" permissions.
Gets permissions of a photo with the given ID.
418 419 420 421 |
# File 'lib/flickrie/api_methods.rb', line 418 def (photo_id, params = {}) response = make_request(photo_id, params) Photo.new(response.body['perms'], self) end |
#get_photo_sizes(photo_id, params = {}) ⇒ Flickrie::Photo
Fetches the sizes of the photo with the given ID. Example:
photo = Flickrie.get_photo_sizes(242348)
photo.medium!(500)
photo.size # => "Medium 500"
photo.source_url # => "http://farm8.staticflickr.com/7090/7093101501_9337f28800.jpg"
466 467 468 469 |
# File 'lib/flickrie/api_methods.rb', line 466 def get_photo_sizes(photo_id, params = {}) response = make_request(photo_id, params) Photo.new(response.body['sizes'], self) end |
#get_photos_from_contacts(params = {}) ⇒ Flickrie::Collection<Flickrie::Photo>
This method requires authentication with "read" permissions.
Fetches photos from contacts of the user who authenticated.
224 225 226 |
# File 'lib/flickrie/api_methods.rb', line 224 def get_photos_from_contacts(params = {}) get_media_from_contacts(params).select { |media| media.is_a?(Photo) } end |
#get_photos_from_set(set_id, params = {}) ⇒ Flickrie::Collection<Flickrie::Photo>
Fetches photos from a set with the given ID.
971 972 973 |
# File 'lib/flickrie/api_methods.rb', line 971 def get_photos_from_set(set_id, params = {}) get_media_from_set(set_id, {media: 'photos'}.merge(params)) end |
#get_photos_from_user(nsid, params = {}) ⇒ Flickrie::Collection<Flickrie::Photo>
This method requires authentication with "read" permissions.
Fetches photos from the Flickr user with the given NSID.
88 89 90 |
# File 'lib/flickrie/api_methods.rb', line 88 def get_photos_from_user(nsid, params = {}) get_media_from_user(nsid, params).select { |media| media.is_a?(Photo) } end |
#get_photos_not_in_set(params = {}) ⇒ Flickrie::Collection<Flickrie::Photo>
This method requires authentication with "read" permissions.
Fetches photos from the authenticated user that are not in any set.
396 397 398 |
# File 'lib/flickrie/api_methods.rb', line 396 def get_photos_not_in_set(params = {}) get_media_not_in_set({media: "photos"}.merge(params)) end |
#get_photos_of_user(nsid, params = {}) ⇒ Flickrie::Collection<Flickrie::Photo>
Fetches photos containing a Flickr user with the given NSID.
116 117 118 |
# File 'lib/flickrie/api_methods.rb', line 116 def get_photos_of_user(nsid, params = {}) get_media_of_user(nsid, params).select { |media| media.is_a?(Photo) } end |
#get_photos_with_geo_data(params = {}) ⇒ Flickrie::Collection<Flickrie::Photo>
This method requires authentication with "read" permissions.
Fetches geo-tagged photos from the authenticated user.
529 530 531 |
# File 'lib/flickrie/api_methods.rb', line 529 def get_photos_with_geo_data(params = {}) get_media_with_geo_data({media: 'photos'}.merge(params)) end |
#get_photos_without_geo_data(params = {}) ⇒ Flickrie::Collection<Flickrie::Photo>
This method requires authentication with "read" permissions.
Fetches photos from the authenticated user that are not geo-tagged.
559 560 561 |
# File 'lib/flickrie/api_methods.rb', line 559 def get_photos_without_geo_data(params = {}) get_media_with_geo_data({media: 'photos'}.merge(params)) end |
#get_public_media_from_contacts(nsid, params = {}) ⇒ Flickrie::Collection<Flickrie::Photo, Flickrie::Video>
Fetches public photos and videos from contacts of the user with the given NSID.
244 245 246 247 |
# File 'lib/flickrie/api_methods.rb', line 244 def get_public_media_from_contacts(nsid, params = {}) response = make_request(nsid, params) Media.new_collection(response.body['photos'], self) end |
#get_public_media_from_user(nsid, params = {}) ⇒ Flickrie::Collection<Flickrie::Photo, Flickrie::Video>
Fetches public photos and videos from the Flickr user with the given NSID.
134 135 136 137 |
# File 'lib/flickrie/api_methods.rb', line 134 def get_public_media_from_user(nsid, params = {}) response = make_request(nsid, params) Media.new_collection(response.body['photos'], self) end |
#get_public_photos_from_contacts(nsid, params = {}) ⇒ Flickrie::Collection<Flickrie::Photo>
Fetches public photos from contacts of the user with the given NSID.
254 255 256 |
# File 'lib/flickrie/api_methods.rb', line 254 def get_public_photos_from_contacts(nsid, params = {}) get_public_media_from_contacts(nsid, params).select { |media| media.is_a?(Photo) } end |
#get_public_photos_from_user(nsid, params = {}) ⇒ Flickrie::Collection<Flickrie::Photo>
Fetches public photos from the Flickr user with the given NSID.
143 144 145 |
# File 'lib/flickrie/api_methods.rb', line 143 def get_public_photos_from_user(nsid, params = {}) get_public_media_from_user(nsid, params).select { |media| media.is_a?(Photo) } end |
#get_public_videos_from_contacts(nsid, params = {}) ⇒ Flickrie::Collection<Flickrie::Video>
Fetches public videos from contacts of the user with the given NSID.
263 264 265 |
# File 'lib/flickrie/api_methods.rb', line 263 def get_public_videos_from_contacts(nsid, params = {}) get_public_media_from_contacts(nsid, params).select { |media| media.is_a?(Video) } end |
#get_public_videos_from_user(nsid, params = {}) ⇒ Flickrie::Collection<Flickrie::Video>
Fetches public videos from the Flickr user with the given NSID.
151 152 153 |
# File 'lib/flickrie/api_methods.rb', line 151 def get_public_videos_from_user(nsid, params = {}) get_public_media_from_user(nsid, params).select { |media| media.is_a?(Video) } end |
#get_recent_media(params = {}) ⇒ Flickrie::Collection<Flickrie::Photo, Flickrie::Video>
Fetches the latest photos and videos uploaded to Flickr.
437 438 439 440 |
# File 'lib/flickrie/api_methods.rb', line 437 def get_recent_media(params = {}) response = make_request(params) Media.new_collection(response.body['photos'], self) end |
#get_recent_photos(params = {}) ⇒ Flickrie::Collection<Flickrie::Photo>
Fetches the latest photos uploaded to Flickr.
445 446 447 |
# File 'lib/flickrie/api_methods.rb', line 445 def get_recent_photos(params = {}) get_recent_media(params).select { |media| media.is_a?(Photo) } end |
#get_recent_videos(params = {}) ⇒ Flickrie::Collection<Flickrie::Video>
Fetches the latest videos uploaded to Flickr.
452 453 454 |
# File 'lib/flickrie/api_methods.rb', line 452 def get_recent_videos(params = {}) get_recent_media(params).select { |media| media.is_a?(Video) } end |
#get_recently_commented_media_from_contacts(params = {}) ⇒ Flickrie::Collection<Flickrie::Photo, Flickrie::Video>
This method requires authentication with "read" permissions.
Get list of photos/videos that have been recently commented by the contacts of the authenticated user.
787 788 789 790 |
# File 'lib/flickrie/api_methods.rb', line 787 def get_recently_commented_media_from_contacts(params = {}) response = make_request(params) Media.new_collection(response.body["photos"], self) end |
#get_recently_commented_photos_from_contacts(params = {}) ⇒ Flickrie::Collection<Flickrie::Photo>
This method requires authentication with "read" permissions.
Get list of photos that have been recently commented by the contacts of the authenticated user.
798 799 800 |
# File 'lib/flickrie/api_methods.rb', line 798 def get_recently_commented_photos_from_contacts(params = {}) get_recently_commented_media_from_contacts(params).select { |media| media.is_a?(Photo) } end |
#get_recently_commented_videos_from_contacts(params = {}) ⇒ Flickrie::Collection<Flickrie::Video>
This method requires authentication with "read" permissions.
Get list of videos that have been recently commented by the contacts of the authenticated user.
808 809 810 |
# File 'lib/flickrie/api_methods.rb', line 808 def get_recently_commented_videos_from_contacts(params = {}) get_recently_commented_media_from_contacts(params).select { |media| media.is_a?(Video) } end |
#get_recently_updated_media(params = {}) ⇒ Flickrie::Collection<Flickrie::Photo, Flickrie::Video>
This method requires authentication with "read" permissions.
Fetches photos and videos from the authenticated user that have recently been updated.
579 580 581 582 |
# File 'lib/flickrie/api_methods.rb', line 579 def get_recently_updated_media(params = {}) response = make_request(params) Media.new_collection(response.body['photos'], self) end |
#get_recently_updated_photos(params = {}) ⇒ Flickrie::Collection<Flickrie::Photo>
This method requires authentication with "read" permissions.
Fetches photos from the authenticated user that have recently been updated.
590 591 592 |
# File 'lib/flickrie/api_methods.rb', line 590 def get_recently_updated_photos(params = {}) recently_updated_media(params).select { |media| media.is_a?(Photo) } end |
#get_recently_updated_videos(params = {}) ⇒ Flickrie::Collection<Flickrie::Video>
This method requires authentication with "read" permissions.
Fetches videos from the authenticated user that have recently been updated.
600 601 602 |
# File 'lib/flickrie/api_methods.rb', line 600 def get_recently_updated_videos(params = {}) recently_updated_media(params).select { |media| media.is_a?(Video) } end |
#get_set_context(set_id, media_id, params = {}) ⇒ Flickrie::MediaContext
Returns next and previous photos/videos for a photo/video in a set
934 935 936 937 |
# File 'lib/flickrie/api_methods.rb', line 934 def get_set_context(set_id, media_id, params = {}) response = make_request(set_id, media_id, params) MediaContext.new(response.body, self) end |
#get_set_info(set_id, params = {}) ⇒ Flickrie::Set
Fetches information about the set with the given ID.
943 944 945 946 |
# File 'lib/flickrie/api_methods.rb', line 943 def get_set_info(set_id, params = {}) response = make_request(set_id, params) Set.new(response.body['photoset'], self) end |
#get_sets_from_user(nsid, params = {}) ⇒ Flickrie::Collection<Flickrie::Set>
Fetches sets from a user with the given NSID.
952 953 954 955 |
# File 'lib/flickrie/api_methods.rb', line 952 def get_sets_from_user(nsid, params = {}) response = make_request(nsid, params) Set.new_collection(response.body['photosets'], self) end |
#get_untagged_media(params = {}) ⇒ Flickrie::Collection<Flickrie::Photo, Flickrie::Video>
This method requires authentication with "read" permissions.
Fetches photos and videos from the authenticated user that have no tags.
490 491 492 493 |
# File 'lib/flickrie/api_methods.rb', line 490 def get_untagged_media(params = {}) response = make_request({media: 'all'}.merge(params)) Media.new_collection(response.body['photos'], self) end |
#get_untagged_photos(params = {}) ⇒ Flickrie::Collection<Flickrie::Photo>
This method requires authentication with "read" permissions.
Fetches photos from the authenticated user that have no tags.
500 501 502 |
# File 'lib/flickrie/api_methods.rb', line 500 def get_untagged_photos(params = {}) get_untagged_media({media: 'photos'}.merge(params)) end |
#get_untagged_videos(params = {}) ⇒ Flickrie::Collection<Flickrie::Video>
This method requires authentication with "read" permissions.
Fetches videos from the authenticated user that have no tags.
509 510 511 |
# File 'lib/flickrie/api_methods.rb', line 509 def get_untagged_videos(params = {}) get_untagged_media({media: 'videos'}.merge(params)) end |
#get_upload_status(params = {}) ⇒ Flickrie::User
This method requires authentication with "read" permissions.
Returns the upload status of the user who is currently authenticated.
172 173 174 175 |
# File 'lib/flickrie/api_methods.rb', line 172 def get_upload_status(params = {}) response = make_request(params) User.new(response.body['user'], self) end |
#get_user_info(nsid, params = {}) ⇒ Flickrie::User
Fetches the Flickr user with the given NSID.
160 161 162 163 |
# File 'lib/flickrie/api_methods.rb', line 160 def get_user_info(nsid, params = {}) response = make_request(nsid, params) User.new(response.body['person'], self) end |
#get_video_exif(video_id, params = {}) ⇒ Flickrie::Video
Fetches the exif for the video with the given ID. Example:
video = Flickrie.get_video_exif(27234987)
video.exif.get('Model') # => 'Canon PowerShot G12'
video.exif.get('X-Resolution', data: 'raw') # => '180'
video.exif.get('X-Resolution', data: 'clean') # => '180 dpi'
video.exif.get('X-Resolution') # => '180 dpi'
333 334 335 336 |
# File 'lib/flickrie/api_methods.rb', line 333 def get_video_exif(video_id, params = {}) response = make_request(video_id, params) Video.new(response.body['photo'], self) end |
#get_video_favorites(video_id, params = {}) ⇒ Flickrie::Video
Fetches the list of users who favorited the video with the given ID. Example:
video = Flickrie.get_video_favorites(24810948)
video.favorites.first.username # => "John Smith"
360 361 362 363 |
# File 'lib/flickrie/api_methods.rb', line 360 def get_video_favorites(video_id, params = {}) response = make_request(video_id, params) Video.new(response.body['photo'], self) end |
#get_video_permissions(video_id, params = {}) ⇒ Flickrie::Video
This method requires authentication with "read" permissions.
Gets permissions of a video with the given ID.
428 429 430 431 |
# File 'lib/flickrie/api_methods.rb', line 428 def (video_id, params = {}) response = make_request(video_id, params) Video.new(response.body['perms'], self) end |
#get_video_sizes(video_id, params = {}) ⇒ Flickrie::Video
Fetches the sizes of the video with the given ID. Example:
video = Flickrie.get_video_sizes(438492)
video.download_url # => "..."
478 479 480 481 |
# File 'lib/flickrie/api_methods.rb', line 478 def get_video_sizes(video_id, params = {}) response = make_request(video_id, params) Video.new(response.body['sizes'], self) end |
#get_videos_from_contacts(params = {}) ⇒ Flickrie::Collection<Flickrie::Video>
This method requires authentication with "read" permissions.
Fetches videos from contacts of the user who authenticated.
234 235 236 |
# File 'lib/flickrie/api_methods.rb', line 234 def get_videos_from_contacts(params = {}) get_media_from_contacts(params).select { |media| media.is_a?(Video) } end |
#get_videos_from_set(set_id, params = {}) ⇒ Flickrie::Collection<Flickrie::Video>
Fetches videos from a set with the given ID.
979 980 981 |
# File 'lib/flickrie/api_methods.rb', line 979 def get_videos_from_set(set_id, params = {}) get_media_from_set(set_id, {media: 'videos'}.merge(params)) end |
#get_videos_from_user(nsid, params = {}) ⇒ Flickrie::Collection<Flickrie::Video>
This method requires authentication with "read" permissions.
Fetches videos from the Flickr user with the given NSID.
98 99 100 |
# File 'lib/flickrie/api_methods.rb', line 98 def get_videos_from_user(nsid, params = {}) get_media_from_user(nsid, params).select { |media| media.is_a?(Video) } end |
#get_videos_not_in_set(params = {}) ⇒ Flickrie::Collection<Flickrie::Video>
This method requires authentication with "read" permissions.
Fetches videos from the authenticated user that are not in any set.
407 408 409 |
# File 'lib/flickrie/api_methods.rb', line 407 def get_videos_not_in_set(params = {}) get_media_not_in_set({media: "videos"}.merge(params)) end |
#get_videos_of_user(nsid, params = {}) ⇒ Flickrie::Collection<Flickrie::Video>
Fetches videos containing a Flickr user with the given NSID.
124 125 126 |
# File 'lib/flickrie/api_methods.rb', line 124 def get_videos_of_user(nsid, params = {}) get_media_of_user(nsid, params).select { |media| media.is_a?(Video) } end |
#get_videos_with_geo_data(params = {}) ⇒ Flickrie::Collection<Flickrie::Video>
This method requires authentication with "read" permissions.
Fetches geo-tagged videos from the authenticated user.
538 539 540 |
# File 'lib/flickrie/api_methods.rb', line 538 def get_videos_with_geo_data(params = {}) get_media_with_geo_data({media: 'videos'}.merge(params)) end |
#get_videos_without_geo_data(params = {}) ⇒ Flickrie::Collection<Flickrie::Video>
This method requires authentication with "read" permissions.
Fetches videos from the authenticated user that are not geo-tagged.
568 569 570 |
# File 'lib/flickrie/api_methods.rb', line 568 def get_videos_without_geo_data(params = {}) get_media_with_geo_data({media: 'videos'}.merge(params)) end |
#order_sets(set_ids, params = {}) ⇒ nil
This method requires authentication with "write" permissions.
Sets the order of sets belonging to the authenticated user.
991 992 993 994 |
# File 'lib/flickrie/api_methods.rb', line 991 def order_sets(set_ids, params = {}) make_request(set_ids, params) nil end |
#remove_media_from_set(set_id, media_ids, params = {}) ⇒ nil Also known as: remove_photos_from_set, remove_videos_from_set
This method requires authentication with "write" permissions.
Removes photos/videos from a set.
1003 1004 1005 1006 |
# File 'lib/flickrie/api_methods.rb', line 1003 def remove_media_from_set(set_id, media_ids, params = {}) make_request(set_id, media_ids, params) nil end |
#reorder_media_in_set(set_id, media_ids, params = {}) ⇒ nil Also known as: reorder_photos_in_set, reorder_videos_in_set
This method requires authentication with "write" permissions.
Reorders photos/videos inside a set.
1017 1018 1019 1020 |
# File 'lib/flickrie/api_methods.rb', line 1017 def reorder_media_in_set(set_id, media_ids, params = {}) make_request(set_id, media_ids, params) nil end |
#replace(media, media_id, params = {}) ⇒ String
This method requires authentication with "write" permissions.
For replacing photos and videos on Flickr. Example:
path = File.("photo.jpg")
photo_id = 42374 # ID of the photo to be replaced
id = Flickrie.replace(path, photo_id)
If the async: 1
option is passed, returns the ticket ID (see #check_upload_tickets).
44 45 46 47 48 49 50 51 |
# File 'lib/flickrie/api_methods.rb', line 44 def replace(media, media_id, params = {}) response = make_request(media, media_id, params) if params[:async] == 1 response.body['rsp']['ticketid'] else response.body['rsp']['photoid'] end end |
#rotate_media(media_id, degrees, params = {}) ⇒ nil Also known as: rotate_photo, rotate_video
This method requires authentication with "write" permissions.
Rotates a photo/video.
840 841 842 843 |
# File 'lib/flickrie/api_methods.rb', line 840 def rotate_media(media_id, degrees, params = {}) make_request(media_id, degrees, params) nil end |
#search_media(params = {}) ⇒ Flickrie::Collection<Flickrie::Photo, Flickrie::Video>
Fetches photos and videos matching a certain criteria.
626 627 628 629 |
# File 'lib/flickrie/api_methods.rb', line 626 def search_media(params = {}) response = make_request({media: 'all'}.merge(params)) Media.new_collection(response.body['photos'], self) end |
#search_photos(params = {}) ⇒ Flickrie::Collection<Flickrie::Photo>
Fetches photos matching a certain criteria.
634 635 636 |
# File 'lib/flickrie/api_methods.rb', line 634 def search_photos(params = {}) search_media({media: 'photos'}.merge(params)) end |
#search_videos(params = {}) ⇒ Flickrie::Collection<Flickrie::Video>
Fetches videos matching a certain criteria.
641 642 643 |
# File 'lib/flickrie/api_methods.rb', line 641 def search_videos(params = {}) search_media({media: 'videos'}.merge(params)) end |
#set_media_content_type(media_id, content_type, params = {}) ⇒ nil Also known as: set_photo_content_type, set_video_content_type
This method requires authentication with "write" permissions.
Sets the content type of a photo/video.
653 654 655 656 |
# File 'lib/flickrie/api_methods.rb', line 653 def set_media_content_type(media_id, content_type, params = {}) make_request(media_id, content_type, params) nil end |
#set_media_dates(media_id, params = {}) ⇒ nil Also known as: set_photo_dates, set_video_dates
This method requires authentication with "write" permissions.
Sets dates for a photo/video.
667 668 669 670 |
# File 'lib/flickrie/api_methods.rb', line 667 def set_media_dates(media_id, params = {}) make_request(media_id, params) nil end |
#set_media_license(media_id, license_id, params = {}) ⇒ nil Also known as: set_photo_license, set_video_license
This method requires authentication with "write" permissions.
Sets the license of a photo/video.
827 828 829 830 |
# File 'lib/flickrie/api_methods.rb', line 827 def set_media_license(media_id, license_id, params = {}) make_request(media_id, license_id, params) nil end |
#set_media_meta(media_id, params = {}) ⇒ nil Also known as: set_photo_meta, set_video_meta
This method requires authentication with "write" permissions.
Sets meta information for a photo/video.
681 682 683 684 |
# File 'lib/flickrie/api_methods.rb', line 681 def (media_id, params = {}) make_request(media_id, params) nil end |
#set_media_permissions(media_id, params = {}) ⇒ nil Also known as: set_photo_permissions, set_video_permissions
This method requires authentication with "write" permissions.
Sets permissions for a photo/video.
695 696 697 698 |
# File 'lib/flickrie/api_methods.rb', line 695 def (media_id, params = {}) make_request(media_id, params) nil end |
#set_media_safety_level(media_id, params = {}) ⇒ nil Also known as: set_photo_safety_level, set_video_safety_level
This method requires authentication with "write" permissions.
Sets the safety level of a photo/video.
709 710 711 712 |
# File 'lib/flickrie/api_methods.rb', line 709 def set_media_safety_level(media_id, params = {}) make_request(media_id, params) nil end |
#set_media_tags(media_id, tags, params = {}) ⇒ nil Also known as: ,
This method requires authentication with "write" permissions.
Sets tags for a photo/video.
723 724 725 726 |
# File 'lib/flickrie/api_methods.rb', line 723 def (media_id, , params = {}) make_request(media_id, , params) nil end |
#set_set_primary_media(set_id, media_id, params = {}) ⇒ nil Also known as: set_set_primary_photo, set_set_primary_video
This method requires authentication with "write" permissions.
Sets set's primary photo/video.
1030 1031 1032 1033 |
# File 'lib/flickrie/api_methods.rb', line 1030 def set_set_primary_media(set_id, media_id, params = {}) make_request(set_id, media_id, params) nil end |
#tag_media(media_id, tags, params = {}) ⇒ nil Also known as: tag_photo, tag_video
This method requires authentication with "write" permissions.
Add tags to the photo/video with the given ID.
184 185 186 187 |
# File 'lib/flickrie/api_methods.rb', line 184 def tag_media(media_id, , params = {}) make_request(media_id, , params) nil end |
#test_login(params = {}) ⇒ Flickrie::User
This method requires authentication with "read" permissions.
Tests if the authentication was successful. If it was, it returns info of the user who just authenticated.
1056 1057 1058 1059 |
# File 'lib/flickrie/api_methods.rb', line 1056 def test_login(params = {}) response = make_request(params) User.new(response.body['user'], self) end |
#untag_media(tag_id, params = {}) ⇒ nil Also known as: untag_photo, untag_video
This method requires authentication with "write" permissions.
Remove the tag with the given ID
612 613 614 615 |
# File 'lib/flickrie/api_methods.rb', line 612 def untag_media(tag_id, params = {}) make_request(tag_id, params) nil end |
#upload(media, params = {}) ⇒ String
This method requires authentication with "write" permissions.
For uploading photos and videos to Flickr. Example:
path = File.("photo.jpg")
photo_id = Flickrie.upload(path, title: "Me and Jessica", description: "...")
photo = Flickrie.get_photo_info(photo_id)
photo.title # => "Me and Jessica"
If the async: 1
option is passed, returns the ticket ID (see #check_upload_tickets).
21 22 23 24 25 26 27 28 |
# File 'lib/flickrie/api_methods.rb', line 21 def upload(media, params = {}) response = make_request(media, params) if params[:async] == 1 response.body['rsp']['ticketid'] else response.body['rsp']['photoid'] end end |