Build Status

The Tumblr Client Wrapper

This gem allows you to easily embed tumblr posts ( Text, Photo, Quote, Link, Chat Audio, Video, Answer) to your ruby on rails view.

It's a Ruby Wrapper for the Tumblr-client official gem and Tumblr v2 API.

View the DEMO

Installation

Add these lines to your application's Gemfile:

gem 'tumblr-client-wrapper'
gem 'tumblr-client'

What You Need

Get an OAuth key on the Tumblr websie by registering your application

Configuration

Tumblr Client Wrapper uses Tumblr-Client configuration.

Tumblr.configure do |config|
  config.consumer_key = "consumer_key"
  config.consumer_secret = "consumer_secret"
  config.oauth_token = "access_token"
  config.oauth_token_secret = "access_token_secret"
end

To get your consumer key register your application

Use the console to get your oauth_token and oauth_token_secret

Usage

example: blogid.tumblr.com

In your view: add the following to Add All Posts from your blog

<%= embed_tumblr("blogid") %>

You can also specify an options and request the gem to only display posts that are photos, quotes or text by passing an option :type followed by the type of post you'd like to dislay.

<%= embed_tumblr("blogid", {type: "quotes"})  %>

Tumblr has 8 differents type of posts: Text, Photo, Quote, Link, Chat, Audio, Video, Answer

valid options you can pass are:

:params, :id, :tag, :limit, :offset, :reblog_info, :type, :notes_info, :filter

You can pass additional options:

<%= embed_tumblr("blogid", {type: :quote, limit: 20})  %>

Add Default or Custom Style

To use the default style of the gem add the following line to application.css

*= require tumblr_client_wrapper.css

You can edit the style of the posts by updating the following CSS classes

.post_content{}
.post_content .post_title{}
.post_content .post_title blockquote{}
.post_content .extra_large{}
.post_body{}
.post_body p{}
.post_body p.source {}

Requirement

Ruby 1.9.x or 2.x.x

Contributing

No request is too small and I encourage everyone to get involved.

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

TODO

  1. Add ability to write custom embed tag

The Tumblr Client gem is Copyright (c) 2015 Richardson Dackam and is licensed under the MIT License. Tumblr is Copyright (c) Tumblr, Inc. The Tumblr gem is NOT affiliated with Tumblr, Inc.