0.0
No commit activity in last 3 years
No release in over 3 years
load twitter credentials from a file for the twitter gem
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.13
~> 10.0
 Project Readme

Twitter::Config

Lets the twitter gem load its tokens from a config file, instead of having to be specified in code.

Installation

Add this line to your application's Gemfile:

gem 'twitter-config'

And then execute:

$ bundle

Or install it yourself as:

$ gem install twitter-config

Usage

This gem makes it easy to load the user tokens from a config file for the api. It uses the standard .trc format from the t command line gem. You can use this gem to configure the tokens for new accounts as well.

require 'twitter'
require 'twitter/config'

# if you don't specify the config file it will look for ~/.trc ...
client = Twitter::REST::Client.from_config('reednj')

# but you can specify it explicitly
client = Twitter::REST::Client.from_config('reednj', :path => "./trc.yaml")

Config file format

Two file formats are supported - a simpiler that is meant to be manually configured, and the more complicated .trc format.

The simpler format:

---
reednj:
    consumer_key: N5FP6mMnW6cBGdtBsBTLgE81s
    consumer_secret: ...
    access_token: ...
    access_token_secret: ...
reddit_stream:
    consumer_key: ...
    consumer_secret: ...
    access_token: ...
    access_token_secret: ...

Use the t twitter command line client to manage the .trc format. If you already have this installed, then you should be able to use twitter-config without any configuring anything.

License

The gem is available as open source under the terms of the MIT License.