Project

bluetail

0.0
No commit activity in last 3 years
No release in over 3 years
A simple library to create tweets
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

Bluetail

Named after a kind of blue bird, Bluetail is a small, easy to use Ruby library to make Twitter posts with your apps.

Installation

gem install bluetail

Pre-requisites

You'll need to define an application with write permissions in your twitter account to be able to use Bluetail. So, go to http://dev.twitter.com, sign in, create your application and make sure it has write permissions.

Then go to the API Keys tab for your Application Management page, and generate an access token for it.

You may have to wait a couple of seconds until Twitter makes your token visible and then you're ready to go.

From that page, you will need:

  • API Key
  • API Secret
  • Access Token
  • Access Token Secret

Copy them and make sure you have them accessible within your application (a config file, env vars, whatever you find more useful)

Usage

You need to instantiate an object with the OAuth settings you copied before, and then you can just tweet:

require 'bluetail'

oauth_settings = {
    :consumer_key => ENV["BLUETAIL_API_KEY"],
    :consumer_secret => ENV["BLUETAIL_API_SECRET"],
    :token => ENV["BLUETAIL_TOKEN"],
    :token_secret => ENV["BLUETAIL_TOKEN_SECRET"]}

bird = Bluetail.new(oauth_settings)

bird.tweet("Look ma! I'm twitting")

Optionally, you can specify a log file in the constructor, if you don't do it, it will log to STDOUT by default.

bird = Bluetail.new(oauth_settings, "/var/log/my-tweets-log-file.log")

That's it, it's really simple to use.

Hope you enjoy it!