Module: Thoth::Plugin::Flickr

### Home Classes Methods

### In Files

- lib/thoth/plugin/thoth_flickr.rb

### Methods

- ::recent_photos

### Files

- robots.txt

### Class/Module Index

Quicksearch

- Thoth
- Thoth::AdminController
- Thoth::ArchiveController
- Thoth::Comment
- Thoth::CommentApiController
- Thoth::CommentController
- Thoth::Config
- Thoth::Error
- Thoth::Importer
- Thoth::MainController
- Thoth::Media
- Thoth::MediaController
- Thoth::MinifyController
- Thoth::Page
- Thoth::PageApiController
- Thoth::PageController
- Thoth::Pager
- Thoth::Plugin
- Thoth::Plugin::Delicious
- Thoth::Plugin::Flickr
- Thoth::Plugin::Tags
- Thoth::Plugin::Twitter
- Thoth::Post
- Thoth::PostApiController
- Thoth::PostController
- Thoth::SchemaError
- Thoth::SearchController
- Thoth::Tag
- Thoth::TagApiController
- Thoth::TagController
- Thoth::TagsPostsMap
- Ramaze
- Ramaze::Dispatcher
- Ramaze::Dispatcher::File
- Ramaze::Helper
- Ramaze::Helper::Admin
- Ramaze::Helper::Cookie
- Ramaze::Helper::Error
- Ramaze::Helper::Pagination
- Ramaze::Helper::Sanitize
- Ramaze::Helper::Wiki
- Ramaze::Helper::Ysearch
- Ramaze::Helper::Ysearch::SearchError
- AddMediaSize
- CreateSchema
- PantsImporter
- PoseidonImporter

No matching classes.

# Thoth::Plugin::Flickr

Flickr plugin for Thoth.

### Public Class Methods

recent_photos(username, limit = 4) click to toggle source

Gets recent Flickr photos (up to limit) for the specified username. The return value of this method is cached to improve performance and to avoid abusing the Flickr API.

    # File lib/thoth/plugin/thoth_flickr.rb, line 58
    def recent_photos(username, limit = 4)
      cache = Ramaze::Cache.value_cache
      key   = "recent_photos_#{username}_#{limit}"

      if value = cache[key]
        return value
      end

      @flickr ||= Net::Flickr.new(Config.flickr.api_key)

      begin
        Timeout.timeout(Config.flickr.request_timeout.to_i, StandardError) do
          value = cache.store(key, @flickr.people.find_by_username(username).
              photos(:per_page => limit), :ttl => Config.flickr.cache_ttl)
        end
      rescue => e
        return []
      else
        value
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.