Module: Thoth::Plugin::Delicious

### Home Classes Methods

### In Files

- lib/thoth/plugin/thoth_delicious.rb

### Methods

- ::recent_bookmarks

### 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::Delicious

Del.icio.us plugin for Thoth.

### Constants

FEED_URL

### Public Class Methods

recent_bookmarks(username, options = {}) click to toggle source

Gets recent del.icio.us bookmarks for the specified username. The return value of this method is cached to improve performance and to avoid pounding del.icio.us with excess traffic.

Available options:

`:count`

  Number of bookmarks to return (default is 5)

`:tags`

  Array of tags to filter by. Only bookmarks with the specified tags will be returned.

    # File lib/thoth/plugin/thoth_delicious.rb, line 66
    def recent_bookmarks(username, options = {})
      cache   = Ramaze::Cache.value_cache
      options = {:count => 5}.merge(options)
      request = "#{FEED_URL}/#{::CGI.escape(username)}" <<
          (options[:tags] ? '/' << ::CGI.escape(options[:tags].join(' ')) : '') <<
          "?raw&count=#{options[:count]}"

      if value = cache[request]
        return value
      end

      response = []

      Timeout.timeout(Config.delicious.request_timeout, StandardError) do
        response = JSON.parse(open(request).read)
      end

      # Parse the response into a more friendly format.
      data = []

      response.each do |item|
        data << {
          :url  => item['u'],
          :desc => item['d'],
          :note => item['n'] ? item['n'] : '',
          :tags => item['t'] ? item['t'] : []
        }
      end

      return cache.store(request, data, :ttl => Config.delicious.cache_ttl)

    rescue => e
      return []
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.