Module: Flickrie

Extended by:
ApiMethods
Defined in:
lib/flickrie.rb,
lib/flickrie.rb,
lib/flickrie/oauth.rb,
lib/flickrie/base58.rb,
lib/flickrie/version.rb,
lib/flickrie/callable.rb,
lib/flickrie/instance.rb,
lib/flickrie/collection.rb,
lib/flickrie/api_methods.rb,
lib/flickrie/objects/set.rb,
lib/flickrie/deprecatable.rb,
lib/flickrie/objects/user.rb,
lib/flickrie/objects/video.rb,
lib/flickrie/objects/media.rb,
lib/flickrie/objects/photo.rb,
lib/flickrie/client/methods.rb,
lib/flickrie/objects/ticket.rb,
lib/flickrie/objects/license.rb,
lib/flickrie/objects/comment.rb,
lib/flickrie/objects/location.rb,
lib/flickrie/middleware/retry.rb,
lib/flickrie/objects/media/tag.rb,
lib/flickrie/flickr_api_methods.rb,
lib/flickrie/objects/media/exif.rb,
lib/flickrie/objects/media/note.rb,
lib/flickrie/objects/media_count.rb,
lib/flickrie/objects/media_context.rb,
lib/flickrie/objects/media/visibility.rb,
lib/flickrie/objects/user/upload_status.rb,
lib/flickrie/middleware/fix_flickr_data.rb

Defined Under Namespace

Modules: ApiMethods, Base58, Callable, Deprecatable, Media, Middleware, OAuth Classes: Client, Collection, Comment, Instance, License, Location, MediaContext, MediaCount, Photo, Set, Ticket, User, Video

Constant Summary

DEFAULTS =
{
  open_timeout: 3,
  timeout: 4
}
VERSION =
"1.6.1"
NOT_IMPLEMENTED =
"Not implemented yet"
FLICKR_API_METHODS =
{
  "flickr.activity.userComments"                => NOT_IMPLEMENTED,
  "flickr.activity.userPhotos"                  => NOT_IMPLEMENTED,

  "flickr.auth.checkToken"                      => NOT_IMPLEMENTED,
  "flickr.auth.getFrob"                         => NOT_IMPLEMENTED,
  "flickr.auth.getFullToken"                    => NOT_IMPLEMENTED,
  "flickr.auth.getToken"                        => NOT_IMPLEMENTED,

  "flickr.auth.oauth.checkToken"                => NOT_IMPLEMENTED,
  "flickr.auth.oauth.getAccessToken"            => NOT_IMPLEMENTED,

  "flickr.blogs.getList"                        => NOT_IMPLEMENTED,
  "flickr.blogs.getServices"                    => NOT_IMPLEMENTED,
  "flickr.blogs.postPhoto"                      => NOT_IMPLEMENTED,

  "flickr.collections.getInfo"                  => NOT_IMPLEMENTED,
  "flickr.collections.getTree"                  => NOT_IMPLEMENTED,

  "flickr.commons.getInstitutions"              => NOT_IMPLEMENTED,

  "flickr.contacts.getList"                     => NOT_IMPLEMENTED,
  "flickr.contacts.getListRecentlyUploaded"     => NOT_IMPLEMENTED,
  "flickr.contacts.getPublicList"               => NOT_IMPLEMENTED,
  "flickr.contacts.getTaggingSuggestions"       => NOT_IMPLEMENTED,

  "flickr.favorites.add"                        => NOT_IMPLEMENTED,
  "flickr.favorites.getContext"                 => NOT_IMPLEMENTED,
  "flickr.favorites.getList"                    => NOT_IMPLEMENTED,
  "flickr.favorites.getPublicList"              => NOT_IMPLEMENTED,
  "flickr.favorites.remove"                     => NOT_IMPLEMENTED,

  "flickr.galleries.addPhoto"                   => NOT_IMPLEMENTED,
  "flickr.galleries.create"                     => NOT_IMPLEMENTED,
  "flickr.galleries.editMeta"                   => NOT_IMPLEMENTED,
  "flickr.galleries.editPhoto"                  => NOT_IMPLEMENTED,
  "flickr.galleries.editPhotos"                 => NOT_IMPLEMENTED,
  "flickr.galleries.getInfo"                    => NOT_IMPLEMENTED,
  "flickr.galleries.getList"                    => NOT_IMPLEMENTED,
  "flickr.galleries.getListForPhoto"            => NOT_IMPLEMENTED,
  "flickr.galleries.getPhotos"                  => NOT_IMPLEMENTED,

  "flickr.groups.browse"                        => NOT_IMPLEMENTED,
  "flickr.groups.getInfo"                       => NOT_IMPLEMENTED,
  "flickr.groups.join"                          => NOT_IMPLEMENTED,
  "flickr.groups.joinRequest"                   => NOT_IMPLEMENTED,
  "flickr.groups.leave"                         => NOT_IMPLEMENTED,
  "flickr.groups.search"                        => NOT_IMPLEMENTED,

  "flickr.groups.discuss.replies.add"           => NOT_IMPLEMENTED,
  "flickr.groups.discuss.replies.delete"        => NOT_IMPLEMENTED,
  "flickr.groups.discuss.replies.edit"          => NOT_IMPLEMENTED,
  "flickr.groups.discuss.replies.getInfo"       => NOT_IMPLEMENTED,
  "flickr.groups.discuss.replies.getList"       => NOT_IMPLEMENTED,

  "flickr.groups.discuss.topics.add"            => NOT_IMPLEMENTED,
  "flickr.groups.discuss.topics.getInfo"        => NOT_IMPLEMENTED,
  "flickr.groups.discuss.topics.getList"        => NOT_IMPLEMENTED,

  "flickr.groups.members.getList"               => NOT_IMPLEMENTED,

  "flickr.groups.pools.add"                     => NOT_IMPLEMENTED,
  "flickr.groups.pools.getContext"              => NOT_IMPLEMENTED,
  "flickr.groups.pools.getGroups"               => NOT_IMPLEMENTED,
  "flickr.groups.pools.getPhotos"               => NOT_IMPLEMENTED,
  "flickr.groups.pools.remove"                  => NOT_IMPLEMENTED,

  "flickr.interestingness.getList"              => NOT_IMPLEMENTED,

  "flickr.machinetags.getNamespaces"            => NOT_IMPLEMENTED,
  "flickr.machinetags.getPairs"                 => NOT_IMPLEMENTED,
  "flickr.machinetags.getPredicates"            => NOT_IMPLEMENTED,
  "flickr.machinetags.getRecentValues"          => NOT_IMPLEMENTED,
  "flickr.machinetags.getValues"                => NOT_IMPLEMENTED,

  "flickr.panda.getList"                        => NOT_IMPLEMENTED,
  "flickr.panda.getPhotos"                      => NOT_IMPLEMENTED,

  "flickr.people.findByEmail"                   => "find_user_by_email",
  "flickr.people.findByUsername"                => "find_user_by_username",
  "flickr.people.getGroups"                     => NOT_IMPLEMENTED,
  "flickr.people.getInfo"                       => "get_user_info",
  "flickr.people.getLimits"                     => NOT_IMPLEMENTED,
  "flickr.people.getPhotos"                     => "get_(photos|videos|media)_from_user",
  "flickr.people.getPhotosOf"                   => "get_(photos|videos|media)_of_user",
  "flickr.people.getPublicGroups"               => NOT_IMPLEMENTED,
  "flickr.people.getPublicPhotos"               => "get_public_(photos|videos|media)_from_user",
  "flickr.people.getUploadStatus"               => "get_upload_status",

  "flickr.photos.addTags"                       => "tag_(photo|video|media)",
  "flickr.photos.delete"                        => "delete_(photo|video|media)",
  "flickr.photos.getAllContexts"                => NOT_IMPLEMENTED,
  "flickr.photos.getContactsPhotos"             => "get_(photos|videos|media)_from_contacts",
  "flickr.photos.getContactsPublicPhotos"       => "get_public_(photos|videos|media)_from_contacts",
  "flickr.photos.getContext"                    => "get_(photo|video|media)_context",
  "flickr.photos.getCounts"                     => "get_(photo|video|media)_counts",
  "flickr.photos.getExif"                       => "get_(photo|video)_exif",
  "flickr.photos.getFavorites"                  => "get_(photo|video)_favorites",
  "flickr.photos.getInfo"                       => "get_(photo|video|media)_info",
  "flickr.photos.getNotInSet"                   => "get_(photos|videos|media)_not_in_set",
  "flickr.photos.getPerms"                      => "get_(photo|video)_permissions",
  "flickr.photos.getRecent"                     => "get_recent_(photos|videos|media)",
  "flickr.photos.getSizes"                      => "get_(photo|video)_sizes",
  "flickr.photos.getUntagged"                   => "get_untagged_(photos|videos|media)",
  "flickr.photos.getWithGeoData"                => "get_(photos|videos|media)_with_geo_data",
  "flickr.photos.getWithoutGeoData"             => "get_(photos|videos|media)_without_geo_data",
  "flickr.photos.recentlyUpdated"               => "get_recently_updated_(photos|videos|media)",
  "flickr.photos.removeTag"                     => "untag_(photo|video|media)",
  "flickr.photos.search"                        => "search_(photos|videos|media)",
  "flickr.photos.setContentType"                => "set_(photo|video|media)_content_type",
  "flickr.photos.setDates"                      => "set_(photo|video|media)_dates",
  "flickr.photos.setMeta"                       => "set_(photo|video|media)_meta",
  "flickr.photos.setPerms"                      => "set_(photo|video|media)_permissions",
  "flickr.photos.setSafetyLevel"                => "set_(photo|video|media)_safety_level",
  "flickr.photos.setTags"                       => "set_(photo|video|media)_tags",

  "flickr.photos.comments.addComment"           => "comment_(photo|video|media)",
  "flickr.photos.comments.deleteComment"        => "delete_(photo|video|media)_comment",
  "flickr.photos.comments.editComment"          => "edit_(photo|video|media)_comment",
  "flickr.photos.comments.getList"              => "get_(photo|video|media)_comments",
  "flickr.photos.comments.getRecentForContacts" => "get_recently_commented_(photos|videos|media)_from_contacts",

  "flickr.photos.geo.batchCorrectLocation"      => NOT_IMPLEMENTED,
  "flickr.photos.geo.correctLocation"           => NOT_IMPLEMENTED,
  "flickr.photos.geo.getLocation"               => NOT_IMPLEMENTED,
  "flickr.photos.geo.getPerms"                  => NOT_IMPLEMENTED,
  "flickr.photos.geo.photosForLocation"         => NOT_IMPLEMENTED,
  "flickr.photos.geo.removeLocation"            => NOT_IMPLEMENTED,
  "flickr.photos.geo.setContext"                => NOT_IMPLEMENTED,
  "flickr.photos.geo.setLocation"               => NOT_IMPLEMENTED,
  "flickr.photos.geo.setPerms"                  => NOT_IMPLEMENTED,

  "flickr.photos.licenses.getInfo"              => "get_licenses",
  "flickr.photos.licenses.setLicense"           => "set_(photo|video|media)_license",

  "flickr.photos.notes.add"                     => NOT_IMPLEMENTED,
  "flickr.photos.notes.delete"                  => NOT_IMPLEMENTED,
  "flickr.photos.notes.edit"                    => NOT_IMPLEMENTED,

  "flickr.photos.people.add"                    => NOT_IMPLEMENTED,
  "flickr.photos.people.delete"                 => NOT_IMPLEMENTED,
  "flickr.photos.people.deleteCoords"           => NOT_IMPLEMENTED,
  "flickr.photos.people.editCoords"             => NOT_IMPLEMENTED,
  "flickr.photos.people.getList"                => NOT_IMPLEMENTED,

  "flickr.photos.suggestions.approveSuggestion" => NOT_IMPLEMENTED,
  "flickr.photos.suggestions.getList"           => NOT_IMPLEMENTED,
  "flickr.photos.suggestions.rejectSuggestion"  => NOT_IMPLEMENTED,
  "flickr.photos.suggestions.removeSuggestion"  => NOT_IMPLEMENTED,
  "flickr.photos.suggestions.suggestLocation"   => NOT_IMPLEMENTED,

  "flickr.photos.transform.rotate"              => "rotate_(photo|video|media)",

  "flickr.photos.upload.checkTickets"           => "check_upload_tickets",

  "flickr.photosets.addPhoto"                   => "add_(photos|videos|media)_to_set",
  "flickr.photosets.create"                     => "create_set",
  "flickr.photosets.delete"                     => "delete_set",
  "flickr.photosets.editMeta"                   => "edit_set_metadata",
  "flickr.photosets.editPhotos"                 => "edit_set_(photos|videos|media)",
  "flickr.photosets.getContext"                 => "get_set_context",
  "flickr.photosets.getInfo"                    => "get_set_info",
  "flickr.photosets.getList"                    => "get_sets_from_user",
  "flickr.photosets.getPhotos"                  => "get_(photos|videos|media)_from_set",
  "flickr.photosets.orderSets"                  => "order_sets",
  "flickr.photosets.removePhoto"                => "remove_(photos|videos|media)_from_set",
  "flickr.photosets.removePhotos"               => "remove_(photos|videos|media)_from_set",
  "flickr.photosets.reorderPhotos"              => "reorder_(photos|videos|media)_in_set",
  "flickr.photosets.setPrimaryPhoto"            => "set_set_primary_(photo|video|media)",

  "flickr.photosets.comments.addComment"        => NOT_IMPLEMENTED,
  "flickr.photosets.comments.deleteComment"     => NOT_IMPLEMENTED,
  "flickr.photosets.comments.editComment"       => NOT_IMPLEMENTED,
  "flickr.photosets.comments.getList"           => NOT_IMPLEMENTED,

  "flickr.places.find"                          => NOT_IMPLEMENTED,
  "flickr.places.findByLatLon"                  => NOT_IMPLEMENTED,
  "flickr.places.getChildrenWithPhotosPublic"   => NOT_IMPLEMENTED,
  "flickr.places.getInfo"                       => NOT_IMPLEMENTED,
  "flickr.places.getInfoByUrl"                  => NOT_IMPLEMENTED,
  "flickr.places.getPlaceTypes"                 => NOT_IMPLEMENTED,
  "flickr.places.getShapeHistory"               => NOT_IMPLEMENTED,
  "flickr.places.getTopPlacesList"              => NOT_IMPLEMENTED,
  "flickr.places.placesForBoundingBox"          => NOT_IMPLEMENTED,
  "flickr.places.placesForContacts"             => NOT_IMPLEMENTED,
  "flickr.places.placesForTags"                 => NOT_IMPLEMENTED,
  "flickr.places.placesForUser"                 => NOT_IMPLEMENTED,
  "flickr.places.resolvePlaceId"                => NOT_IMPLEMENTED,
  "flickr.places.resolvePlaceURL"               => NOT_IMPLEMENTED,
  "flickr.places.tagsForPlace"                  => NOT_IMPLEMENTED,

  "flickr.prefs.getContentType"                 => NOT_IMPLEMENTED,
  "flickr.prefs.getGeoPerms"                    => NOT_IMPLEMENTED,
  "flickr.prefs.getHidden"                      => NOT_IMPLEMENTED,
  "flickr.prefs.getPrivacy"                     => NOT_IMPLEMENTED,
  "flickr.prefs.getSafetyLevel"                 => NOT_IMPLEMENTED,

  "flickr.push.getSubscriptions"                => NOT_IMPLEMENTED,
  "flickr.push.getTopics"                       => NOT_IMPLEMENTED,
  "flickr.push.subscribe"                       => NOT_IMPLEMENTED,
  "flickr.push.unsubscribe"                     => NOT_IMPLEMENTED,

  "flickr.reflection.getMethodInfo"             => NOT_IMPLEMENTED,
  "flickr.reflection.getMethods"                => "get_methods",

  "flickr.stats.getCollectionDomains"           => NOT_IMPLEMENTED,
  "flickr.stats.getCollectionReferrers"         => NOT_IMPLEMENTED,
  "flickr.stats.getCollectionStats"             => NOT_IMPLEMENTED,
  "flickr.stats.getCSVFiles"                    => NOT_IMPLEMENTED,
  "flickr.stats.getPhotoDomains"                => NOT_IMPLEMENTED,
  "flickr.stats.getPhotoReferrers"              => NOT_IMPLEMENTED,
  "flickr.stats.getPhotoStats"                  => NOT_IMPLEMENTED,
  "flickr.stats.getPhotosetDomains"             => NOT_IMPLEMENTED,
  "flickr.stats.getPhotosetReferrers"           => NOT_IMPLEMENTED,
  "flickr.stats.getPhotosetStats"               => NOT_IMPLEMENTED,
  "flickr.stats.getPhotostreamDomains"          => NOT_IMPLEMENTED,
  "flickr.stats.getPhotostreamReferrers"        => NOT_IMPLEMENTED,
  "flickr.stats.getPhotostreamStats"            => NOT_IMPLEMENTED,
  "flickr.stats.getPopularPhotos"               => NOT_IMPLEMENTED,
  "flickr.stats.getTotalViews"                  => NOT_IMPLEMENTED,

  "flickr.tags.getClusterPhotos"                => NOT_IMPLEMENTED,
  "flickr.tags.getClusters"                     => NOT_IMPLEMENTED,
  "flickr.tags.getHotList"                      => NOT_IMPLEMENTED,
  "flickr.tags.getListPhoto"                    => NOT_IMPLEMENTED,
  "flickr.tags.getListUser"                     => NOT_IMPLEMENTED,
  "flickr.tags.getListUserPopular"              => NOT_IMPLEMENTED,
  "flickr.tags.getListUserRaw"                  => NOT_IMPLEMENTED,
  "flickr.tags.getMostFrequentlyUsed"           => NOT_IMPLEMENTED,
  "flickr.tags.getRelated"                      => NOT_IMPLEMENTED,

  "flickr.test.echo"                            => NOT_IMPLEMENTED,
  "flickr.test.login"                           => "test_login",
  "flickr.test.null"                            => NOT_IMPLEMENTED,

  "flickr.urls.getGroup"                        => NOT_IMPLEMENTED,
  "flickr.urls.getUserPhotos"                   => NOT_IMPLEMENTED,
  "flickr.urls.getUserProfile"                  => NOT_IMPLEMENTED,
  "flickr.urls.lookupGallery"                   => NOT_IMPLEMENTED,
  "flickr.urls.lookupGroup"                     => NOT_IMPLEMENTED,
  "flickr.urls.lookupUser"                      => NOT_IMPLEMENTED
}

Class Attribute Summary collapse

Class Method Summary collapse

Methods included from ApiMethods

add_media_to_set, check_upload_tickets, comment_media, create_set, delete_media, delete_media_comment, delete_set, edit_media_comment, edit_set_media, edit_set_metadata, find_user_by_email, find_user_by_username, get_licenses, get_media_comments, get_media_context, get_media_counts, get_media_from_contacts, get_media_from_set, get_media_from_user, get_media_info, get_media_not_in_set, get_media_of_user, get_media_with_geo_data, get_media_without_geo_data, get_methods, get_photo_exif, get_photo_favorites, get_photo_permissions, get_photo_sizes, get_photos_from_contacts, get_photos_from_set, get_photos_from_user, get_photos_not_in_set, get_photos_of_user, get_photos_with_geo_data, get_photos_without_geo_data, get_public_media_from_contacts, get_public_media_from_user, get_public_photos_from_contacts, get_public_photos_from_user, get_public_videos_from_contacts, get_public_videos_from_user, get_recent_media, get_recent_photos, get_recent_videos, get_recently_commented_media_from_contacts, get_recently_commented_photos_from_contacts, get_recently_commented_videos_from_contacts, get_recently_updated_media, get_recently_updated_photos, get_recently_updated_videos, get_set_context, get_set_info, get_sets_from_user, get_untagged_media, get_untagged_photos, get_untagged_videos, get_upload_status, get_user_info, get_video_exif, get_video_favorites, get_video_permissions, get_video_sizes, get_videos_from_contacts, get_videos_from_set, get_videos_from_user, get_videos_not_in_set, get_videos_of_user, get_videos_with_geo_data, get_videos_without_geo_data, order_sets, remove_media_from_set, reorder_media_in_set, replace, rotate_media, search_media, search_photos, search_videos, set_media_content_type, set_media_dates, set_media_license, set_media_meta, set_media_permissions, set_media_safety_level, set_media_tags, set_set_primary_media, tag_media, test_login, untag_media, upload

Methods included from Deprecatable

#deprecated_alias

Methods included from Callable

#client, #upload_client

Class Attribute Details

.access_secretObject

Access token (token + secret) is used to make authenticated requests. Access tokens are unique for each Flickr user, and they last forever. So, if your app is of that kind that it asks users to authenticate through Flickr, after you get their access token, you can store it somewhere in the database, and you never have to ask that user to authenticate again.

You can obtain the access token in various ways:



61
62
63
# File 'lib/flickrie.rb', line 61

def access_secret
  @access_secret
end

.access_tokenObject

Access token (token + secret) is used to make authenticated requests. Access tokens are unique for each Flickr user, and they last forever. So, if your app is of that kind that it asks users to authenticate through Flickr, after you get their access token, you can store it somewhere in the database, and you never have to ask that user to authenticate again.

You can obtain the access token in various ways:



61
62
63
# File 'lib/flickrie.rb', line 61

def access_token
  @access_token
end

.api_keyObject

Your API key. If you don't have one already, you can apply for it here (you first have to sign in).



15
16
17
# File 'lib/flickrie.rb', line 15

def api_key
  @api_key
end

.open_timeoutObject

Time to wait for the connection to Flickr to open (in seconds). Otherwise Faraday::Error::TimeoutError is raised. If you're in a web application, you may want to rescue this exception and display some custom error page (telling the user to try to load the page again, for example).

You may want to override this if you notice that your connection often timeouts.

Defaults to 3 seconds.



33
34
35
# File 'lib/flickrie.rb', line 33

def open_timeout
  @open_timeout
end

.paginationObject

If you're in a web application, and you want pagination with will_paginate, you can specify it here.

Flickrie.pagination = :will_paginate

Now let's assume you have a collection of photos

@photos = Flickrie.photos_from_set(2734243, per_page: 20, page: params[:page])

This collection is now paginated. You can now call in your ERB template:

<%= will_paginate @photos %>

If you're using this, be sure to include the 'will_paginate' gem in your Gemfile.

Collection has some basic pagination attributes by itself, these are independent of any pagination library.

See Also:



85
86
87
# File 'lib/flickrie.rb', line 85

def pagination
  @pagination
end

.shared_secretObject

Your shared secret. This goes in pair with your API key. If you don't have the API key already, you can apply for it here (you first have to sign in).



21
22
23
# File 'lib/flickrie.rb', line 21

def shared_secret
  @shared_secret
end

.timeoutObject

Time to wait for the first block of response from Flickr to be read (in seconds). Otherwise Faraday::Error::TimeoutError is raised. If you're in a web application, you may want to rescue this exception and display some custom error page (telling the user to try to load the page again, for example).

You may want to override this if you notice that your connection often timeouts.

Defaults to 4 seconds.



45
46
47
# File 'lib/flickrie.rb', line 45

def timeout
  @timeout
end

Class Method Details

.lookup_method(method) ⇒ Object



124
125
126
# File 'lib/flickrie.rb', line 124

def self.lookup_method(method)
  FLICKR_API_METHODS[method]
end