Sha256: 59192f5d3706f0ae25d8bc82f143e034862388f74da44db1857305c3b198de5c
Contents?: true
Size: 1018 Bytes
Versions: 15
Compression:
Stored size: 1018 Bytes
Contents
# Contains hooks for the twitter console require('optparse') module Twitter class Client class << self # Helper method mostly for irb shell prototyping. # # Reads in login/password Twitter credentials from YAML file # found at the location given by <tt>config_file</tt> that has # the following format: # envname: # login: mytwitterlogin # password: mytwitterpassword # # Where <tt>envname</tt> is the name of the environment like 'test', # 'dev' or 'prod'. The <tt>env</tt> argument defaults to 'test'. # # To use this in the shell you would do something like the following # examples: # twitter = Twitter::Client.from_config('config/twitter.yml', 'dev') # twitter = Twitter::Client.from_config('config/twitter.yml') def from_config(config_file, env = 'test') yaml_hash = YAML.load(File.read(config_file)) self.new yaml_hash[env] end end # class << self end end
Version data entries
15 entries across 15 versions & 8 rubygems