Sha256: 0fa1060fc0f17d8ebef39f92ee44146205c6bdb73e79b90e08d5584a46735172

Contents?: true

Size: 1.41 KB

Versions: 2

Compression:

Stored size: 1.41 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
  end

 
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
flickrmocks-0.8.6 lib/flickr_mocks/api/options.rb
flickrmocks-0.8.5 lib/flickr_mocks/api/options.rb