Sha256: 239923445d228623306bf276c6a36ee71bd00693fa02e310d6ba2d60b567f827

Contents?: true

Size: 996 Bytes

Versions: 10

Compression:

Stored size: 996 Bytes

Contents

# Contains hooks for the twitter console

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

10 entries across 10 versions & 3 rubygems

Version Path
dambalah-twitter4r-0.3.1 lib/twitter/console.rb
dambalah-twitter4r-0.3.2 lib/twitter/console.rb
mbbx6spp-twitter4r-0.3.1 lib/twitter/console.rb
twitter4r-0.2.5 lib/twitter/console.rb
twitter4r-0.2.2 lib/twitter/console.rb
twitter4r-0.2.4 lib/twitter/console.rb
twitter4r-0.2.0 lib/twitter/console.rb
twitter4r-0.3.0 lib/twitter/console.rb
twitter4r-0.2.1 lib/twitter/console.rb
twitter4r-0.2.3 lib/twitter/console.rb