Module: FlickrMocks::Api::Flickr

Defined in:
lib/flickr_mocks/api/flickr.rb

Overview

Wrapper methods for accessing Flickr Api. Module is used internally.

Class Method Summary collapse

Class Method Details

.author(options) ⇒ Object

Wrapper for flickr.photos-search Flickr API call. Sample usage:

self.author(:owner_id => '20')

Options hash accepts:

:owner_id : string containing owner for the photo. This gets mapped to :user_id
:per_page : optional string containing maximum number of items per page
:page : optional string containing the page to retrieve for the query


66
67
68
# File 'lib/flickr_mocks/api/flickr.rb', line 66

def self.author(options)
  flickr.photos.search Api::Options.author(options)
end

.commons_institutionsObject

wrapper for flickr.commons.getInstitutions Flickr API call. Sample usage:

self.commons_institutions

Options hash accepts:

:per_page : optional string containing maximum number of items per page
:page : optional string containing the page to retrieve for the query


77
78
79
# File 'lib/flickr_mocks/api/flickr.rb', line 77

def self.commons_institutions
  flickr.commons.getInstitutions
end

.interestingness(options) ⇒ Object

Wrapper for flickr.interestingness.getList Flickr API call. Sample usage:

self.interestingness(:dage => '2010-10-10')

Options hash accepts:

:date : string containing date of format 'YYYY-MM-DD'
:per_page : optional string containing maximum number of items per page
:page : optional string containing the page to retrieve for the query


54
55
56
# File 'lib/flickr_mocks/api/flickr.rb', line 54

def self.interestingness(options)
  flickr.interestingness.getList Api::Options.interesting(options)
end

.photo(options) ⇒ Object

Wrapper for flickr.photos.getInfo Flickr API call. Sample usage:

self.photo(:photo_id => '123')

Options hash accepts:

:photo_id : required string that contains the id for the photo
:secret  : optional string that contains the flickr secret for photo.
            When provided query is slightly faster


30
31
32
# File 'lib/flickr_mocks/api/flickr.rb', line 30

def self.photo(options)
  flickr.photos.getInfo Api::Options.photo(options)
end

.photo_sizes(options) ⇒ Object

Wrapper for flickr.photos-getSizes Flickr API call. Sample usage:

self.photo_sizes(:photo_id => '1', :secret => 'abcdef')

Options hash accepts:

:photo_id : required string that contains the id for the photo
:secret  : optional string that contains the flickr secret for photo.
            When provided query is slightly faster


42
43
44
# File 'lib/flickr_mocks/api/flickr.rb', line 42

def self.photo_sizes(options)
  flickr.photos.getSizes Api::Options.photo(options)
end

.photos(options) ⇒ Object

Wrapper for flickr.photos.search Flickr API call. Sample usage:

self.photos(:search_terms => 'france')

Options hash accepts:

:search_terms : string with comma separated list of terms 'france,lyon'
:owner_id : pptional string containing the id for the owner of the photo.
:per_page : optional string containing the maximum number of photos
returned in a single page. The default value is '200'
:page : optional string containing the page for search
         results to be returned. The default is '1'
:tag_mode : optionsl string containing either 'any' or 'all'.
             Affects the interpretation of the search terms to the FlickRaw API.


18
19
20
# File 'lib/flickr_mocks/api/flickr.rb', line 18

def self.photos(options)
  flickr.photos.search Api::Options.search(options)
end