Sha256: 30de2b1e1d7e01adb2f559a3c04b38abcd55990fbe824d778ed3e2d6fa12165a

Contents?: true

Size: 654 Bytes

Versions: 3

Compression:

Stored size: 654 Bytes

Contents

require 'twitter_oauth/client'
require 'twitter_oauth'

module Twuckoo::TwitterOauth
  #TODO: This should be a class and instantiated as @tweeter in Twuckoo::Runner

  def self._tweet(message, options)
    client(options).update(message)
  end

  def self.latest_tweet(options)
    last_tweet = client(options).home_timeline.first
    last_tweet['text'] if last_tweet
  end

private
  def self.client(options)
    @client ||= TwitterOAuth::Client.new(
      :consumer_key => options[:consumer_key],
      :consumer_secret => options[:consumer_secret],
      :token => options[:oauth_token],
      :secret => options[:oauth_token_secret]
    )
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
twuckoo-0.5.4 lib/twuckoo/twitter_oauth_module.rb
twuckoo-0.5.3 lib/twuckoo/twitter_oauth_module.rb
twuckoo-0.5.2 lib/twuckoo/twitter_oauth_module.rb