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

Version Path
NewMonarch-twitter4r-0.3.2 lib/twitter/console.rb
craigtmackenzie-twitter4r-0.3.1 lib/twitter/console.rb
dambalah-twitter4r-0.3.3 lib/twitter/console.rb
dferranti-twitter4r-0.4.0.1 lib/twitter/console.rb
filipegiusti-twitter4r-0.3.2.1 lib/twitter/console.rb
mbbx6spp-twitter4r-0.4.0 lib/twitter/console.rb
theill-twitter4r-0.3.2 lib/twitter/console.rb
twitter4r-0.7.0 lib/twitter/console.rb
twitter4r-0.6.0 lib/twitter/console.rb
twitter4r-0.5.3 lib/twitter/console.rb
twitter4r-0.5.2 lib/twitter/console.rb
twitter4r-0.5.1 lib/twitter/console.rb
twitter4r-0.5.0 lib/twitter/console.rb
twitter4r-0.3.2 lib/twitter/console.rb
twitter4r-0.3.1 lib/twitter/console.rb