GithubHelp home page GithubHelp logo

tumblr_client's Introduction

Tumblr Ruby Gem

This is a ruby wrapper for the Tumblr v2 API. There should be support for 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.new

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

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.

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!

tumblr_client's People

Contributors

codingjester avatar dallasmarlow avatar bvass avatar

Stargazers

gmarik avatar

Watchers

gmarik avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.