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
Add these lines to your application's Gemfile:
gem 'tumblr-client-wrapper', '0.1.1'
gem 'tumblr-client'
Get an OAuth key on the Tumblr websie by registering your application
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](register an application)
Use the console to get your oauth_token and oauth_token_secret
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}) %>
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 {}
Ruby 1.9.x or 2.x.x
No request is too small and I encourage everyone to get involved.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
- 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.