Want to take your software engineering career to the next level? Join the mailing list for career tips & advice Click here

tumblr_client

A Ruby Wrapper for the Tumblr v2 API

Subscribe to updates I use tumblr_client


Statistics on tumblr_client

Number of watchers on Github 216
Number of open issues 15
Average time to close an issue 17 days
Main language Ruby
Average time to merge a PR 21 days
Open pull requests 10+
Closed pull requests 1+
Last commit over 3 years ago
Repo Created over 7 years ago
Repo Last Updated over 2 years ago
Size 138 KB
Organization / Authortumblr
Contributors13
Page Updated
Do you use tumblr_client? Leave a review!
View open issues (15)
View tumblr_client activity
View on github
Book a Mock Interview With Me (Silicon Valley Engineering Leader, 100s of interviews conducted)
Software engineers: It's time to get promoted. Starting NOW! Subscribe to my mailing list and I will equip you with tools, tips and actionable advice to grow in your career.
Evaluating tumblr_client for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)

Tumblr Ruby Gem

Gem Version Build Status

This is the official Ruby wrapper for the Tumblr v2 API. It supports all endpoints currently available on the Tumblr API.

Installation

gem install tumblr_client

Usage

First and foremost, this gem will not do a three legged oauth request for you. It is just a wrapper to help make your life easier when using the v2 api. If you need to do the full oauth workflow, then please check out the Ruby OAuth Gem.

Configuration

Configuration for the gem is actually pretty easy:

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

Once you have your configuration squared away it's time to make some requests!

>> client = Tumblr::Client.new

That's it! You now have a client that can make any request to the Tumblr API.

Also since the client is created with the amazing library Faraday, you can configure it to use any HTTP Client it supports.

>> client = Tumblr::Client.new(:client => :httpclient)

Some quick examples

Getting user information:

>> client.info

Getting a specific blog's posts and type:

# Grabbing a specific blogs posts
>> client.posts("codingjester.tumblr.com")

# Grabbing only the last 10 photos off the blog
>> client.posts("codingjester.tumblr.com", :type => "photo", :limit => 10)

Posting some photos to Tumblr:

# Uploads a great photoset
>> client.photo("codingjester.tumblr.com", {:data => ['/path/to/pic.jpg', '/path/to/pic.jpg']})

The irb Console

Finally, there is an irb console packaged with the gem that should help you test any calls you want to make. The magic here is that you have a .tumblr file in your home directory. Inside this file it's just a basic YAML layout with four lines:

consumer_key: "your_consumer_key"
consumer_secret: "your_consumer_secret"
oauth_token: "your_access_token"
oauth_token_secret: "your_access_token_secret"

From there, you should be able to run any of the above commands, with no problem! Just fire off the command tumblr from the terminal and you should be dropped into a console.


The first time that you go to use the irb console, if you have no .tumblr file, it will walk you through the process of generating one. You will be prompted for your consumer_key and consumer_secret (which you can get here: https://www.tumblr.com/oauth/register) and then sent out to the site to verify your account. Once you verify, you will be redirected to your redirect URL (localhost by default) and copy the oauth_verifier back into the console. Then you're all set!

Contributions and Pull Requests

No request is too small and I encourage everyone to get involved. As you can see, we're sorely lacking in tests! So please if you would like to contribute, let me know and throw me a pull request!

Requirements

  • Ruby 1.9.x or 2.x.x

Copyright 2013 Tumblr, Inc.

Licensed under the Apache License, Version 2.0 (the License); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations.

tumblr_client open issues Ask a question     (View All Issues)
  • about 4 years Update dependency faraday_middleware to 0.10.0?
  • over 4 years doesnt work with faraday 0.9.2
  • over 4 years Link post thumbnail
  • over 5 years verifier or token_secret?
  • over 6 years NoMethodError: undefined method 'chomp'
  • about 7 years Incorrectly Signing arrays of source parameters for photosets
  • about 7 years Unable to post images: HTTP 401 Unauthorized
tumblr_client open pull requests (View All Pulls)
  • Improve README
  • added new link optional parameters
  • Fix draft parameters
  • Threadsafe configuration
  • add source_url to validation
  • Add versioning to dependencies to allow builds to pass on TravisCI
  • Update README.md to include syntax highlighting
  • Fix conflict with twitter 6.0.0
  • relax specificity of faraday dependencies
  • Tumblr::Request#get_redirect_url sees both 301 and 302 as redirects
tumblr_client questions on Stackoverflow (View All Questions)
  • How to get individual tumblr post's likes count for tumblr_client gem
  • tumblr_client post function hash passed as array
  • Rails: tumblr_client gem works in console, not in app
tumblr_client list of languages used
Other projects in Ruby
Powered by Autocode - Instant Webhooks, Scripts and APIs
Autocode logo wordmark