Sha256: 90d1c2fcb4eec27c19935def8eefc42ec0f28a0b30496c51e8e84746267ba585

Contents?: true

Size: 1.62 KB

Versions: 7

Compression:

Stored size: 1.62 KB

Contents

module FlickrMocks
  class Api
    def self.search_options(params)
      return {
        :tags => self.sanitize_tags(params[:search_terms]),
        :user_id =>  params[:owner_id],
        :per_page =>  self.sanitize_per_page(params),
        :page =>  self.sanitize_page(params),
        :license => self.default(:license),
        :media => self.default(:media),
        :extras => self.default(:extras),
        :tag_mode => self.sanitize_tag_mode(params)
      }
    end

    def self.interesting_options(params)
      return {
        :date => self.sanitize_time(params),
        :per_page => self.sanitize_per_page(params),
        :page =>  self.sanitize_page(params),
        :extras => self.default(:extras)
      }
    end

    def self.photo_options(params)
      {
        :photo_id => params[:photo_id] || params[:id] || nil,
        :secret => params[:photo_secret] || params[:secret] || nil
      }
    end

    def self.author_options(params)
      options = self.search_options(params)   
      options.delete :tags
      options
    end

    def self.search_params(params)
      return {
        :search_terms => self.sanitize_tags(params[:search_terms]),
        :owner_id => self.sanitize_tags(params[:owner_id]),
        :base_url => params[:base_url]
      }
    end

    def self.interesting_params(params)
      return {
        :date => params[:date],
        :base_url => params[:base_url]
      }
    end

    def self.commons_institutions_params(params)
      return {
        :per_page => params[:per_page] || params[:perpage],
        :current_page => params[:current_page] || params[:page] || 1
      }
    end
  end

 
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
flickrmocks-0.8.15 lib/flickr_mocks/api/options.rb
flickrmocks-0.8.14 lib/flickr_mocks/api/options.rb
flickrmocks-0.8.13 lib/flickr_mocks/api/options.rb
flickrmocks-0.8.12 lib/flickr_mocks/api/options.rb
flickrmocks-0.8.11 lib/flickr_mocks/api/options.rb
flickrmocks-0.8.10 lib/flickr_mocks/api/options.rb
flickrmocks-0.8.9 lib/flickr_mocks/api/options.rb