Sha256: b67e066a12f35156c6a192bea48704b8635cb6057198b22c637eda9a30b1bb36

Contents?: true

Size: 1012 Bytes

Versions: 9

Compression:

Stored size: 1012 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

9 entries across 9 versions & 2 rubygems

Version Path
cerberus-0.8.0 lib/vendor/twitter/lib/twitter/console.rb
cerberus-0.7.9 lib/vendor/twitter/lib/twitter/console.rb
edavis10-cerberus-0.7.8 lib/vendor/twitter/lib/twitter/console.rb
cerberus-0.7.8 lib/vendor/twitter/lib/twitter/console.rb
cerberus-0.7.7 lib/vendor/twitter/lib/twitter/console.rb
cerberus-0.7.6 lib/vendor/twitter/lib/twitter/console.rb
cerberus-0.7.2 lib/vendor/twitter/lib/twitter/console.rb
cerberus-0.7.5 lib/vendor/twitter/lib/twitter/console.rb
cerberus-0.7 lib/vendor/twitter/lib/twitter/console.rb