Sha256: 3ae01de8134b3ea9ace1fb7b8b831a0f999701f0f90e60f142a949ed92a27ec3

Contents?: true

Size: 957 Bytes

Versions: 14

Compression:

Stored size: 957 Bytes

Contents

gem "tumblr-rb"
require 'tumblr'

module Caboodle
  class Tumblr < Caboodle::Kit   
    description "Includes a tumblr.com account"
  
    helpers do
      def semantic_date post
        date = Date.parse(post.date)
        a = []
        a << "slug-#{post.slug}"
        a << "y#{date.year}"
        a << "m#{date.month}"
        a << "d#{date.day}"
        a.join(" ")
      end
    end
   
    required [:tumblr_email, :tumblr_password, :tumblr_sitename]
  
    menu "Tumblr" do
      tumblr = ::Tumblr::Reader.new(@tumblr_email,@tumblr_password)
      req = tumblr.read(@tumblr_sitename, {:num=>10}).perform_sleepily
      posts = ::Tumblr::Reader.get_posts(req)
      haml :tumblr, :locals => { :posts => posts }
    end
  
    get "/tumblr/page/:page" do
      tumblr = ::Tumblr::Reader.new(@tumblr_email,@tumblr_password)
      posts = tumblr.get_posts()
      haml :tumblr, :locals => { :posts => posts }
    end
  
    add_sass ["tumblr"]
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
caboodle-0.3.0 lib/caboodle/kits/tumblr/tumblr.rb
caboodle-0.2.30 lib/caboodle/kits/tumblr/tumblr.rb
caboodle-0.2.29 lib/caboodle/kits/tumblr/tumblr.rb
caboodle-0.2.28 lib/caboodle/kits/tumblr/tumblr.rb
caboodle-0.2.27 lib/caboodle/kits/tumblr/tumblr.rb
caboodle-0.2.26 lib/caboodle/kits/tumblr/tumblr.rb
caboodle-0.2.25 lib/caboodle/kits/tumblr/tumblr.rb
caboodle-0.2.24 lib/caboodle/kits/tumblr/tumblr.rb
caboodle-0.2.23 lib/caboodle/kits/tumblr/tumblr.rb
caboodle-0.2.22 lib/caboodle/kits/tumblr/tumblr.rb
caboodle-0.2.21 lib/caboodle/kits/tumblr/tumblr.rb
caboodle-0.2.20 lib/caboodle/kits/tumblr/tumblr.rb
caboodle-0.2.19 lib/caboodle/kits/tumblr/tumblr.rb
caboodle-0.2.18 lib/caboodle/kits/tumblr/tumblr.rb