view app/models/tweet.rb @ 17:6718f51b34b5

Add readme, copied off original app.
author edogawaconan <me@myconan.net>
date Fri, 05 Sep 2014 20:40:50 +0900
parents 207917e41964
children 6e3ff830e94a
line wrap: on
line source

class Tweet
  CONFIG = {
    :consumer_key => ENV["RT_CONSUMER_KEY"],
    :consumer_secret => ENV["RT_CONSUMER_SECRET"],
    :access_token => ENV["RT_OAUTH_TOKEN"],
    :access_token_secret => ENV["RT_OAUTH_TOKEN_SECRET"]
  }

  def timeline
    @timeline ||= @client.user_timeline(@twitter_id)
  end

  def initialize(twitter_id)
    @client = Twitter::REST::Client.new do |config|
                CONFIG.each do |cfg_key, cfg_value|
                  config.public_send("#{cfg_key}=", cfg_value)
                end
              end
    @twitter_id = twitter_id
  end
end