Project

tumblrb

0.0
No commit activity in last 3 years
No release in over 3 years
A simple blogging platform built on Tumblr and Redis
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 2.2.0
~> 0.7.5
~> 1.6.0
 Project Readme

Tumblr Blogging with Redis

A simple, blogging "platform" built on Tumblr and Redis.

Reasoning

Tumblr has a great interface for tagging, writing, and editing posts, but you shouldn't rely on it for being up all the time. You also shouldn't have to worry about Tumblr API integration or cacheing on your own. Tumblrb handles the Tumblr API integration, Redis cacheing, and fetching all with an easy to use interface.

VOILA!

Installation

Run

gem install tumblrb

Or add

gem 'tumblrb', :require => "tumblr"

to your Gemfile

Setup

Tumblrb Needs a little configuration to work properly. It needs to know your blog, your Tumblr API key, and how to connect to a running Redis server :

You can do that using the configure method :

Tumblr.configure do |config|
  config.blog = "thegorgonlab"
  config.api_key = "YOUR API KEY"
  config.redis = {:host => "localhost", :port => 6379}
end

Redis configuration takes a string path to a configuration file, a hash of options, or a Redis instance itself. If you don't include a "." in your blog name it will add ".tumblr.com" to the end of what you provide. For information about API keys see the Tumblr API documentation

Or if you like having all your configuration in a YAML file, you can put it all in a YAML file under the key tumblr and call :

Tumblr.load_config("/path/to/config.yml")

Blog and Redis

Most interactions with the Tumblrb gem happen through the Blog class, which handles fetching from Tumblr and caching in Redis.

To get started, fetch the posts from Tumblr and cache them in Redis, call Blog.refresh!. Every time you write a new post for your Tumblr blog, call this method again to keep Tumblrb up to date.

Afterwards, to access your blog entries use an AREL type interface to access posts.

Blog.tagged_with("technology").per_page(3).page(2).all

Fetching only happens when array methods are called in the chain.

Loading posts directly

You can also load posts directly using a similar interface :

Post.page(1).per_page(20).tagged_with("technology").type("text").all

Or you can load 1 post by Tumblr id :

Post.find(tumblr_id)

Post Classes

Every Tumblr entry type is a separate class so you can do stuff like :

case post
when Tumblr::Text
  # Display a regular post
when Tumblr::Quote
  # Display a quote
when Tumblr::Photo
  # Display a photo
...
end

This makes custom display easier.

Known Issues

There's no testing or real documentation. I know, wanna help?

This isn't the same...

If you were using Tumblrb 1.0, this is completely different. I realize that. However, I didn't think anyone was using that gem and I think this is a better more holistic solution. Sorry for the inconvenience.

Anything else?

Questions, requests, concerns? Find me at the gorgon lab