Mercurial > rsstweet
annotate app/models/tweet.rb @ 30:205c0b5d9f44
Whoops, expires_in accidentally as key name.
author | edogawaconan <me@myconan.net> |
---|---|
date | Thu, 18 Sep 2014 09:29:07 +0900 |
parents | 03f904c070f7 |
children | e5082c4c234d |
rev | line source |
---|---|
15 | 1 class Tweet |
2 CONFIG = { | |
3 :consumer_key => ENV["RT_CONSUMER_KEY"], | |
4 :consumer_secret => ENV["RT_CONSUMER_SECRET"], | |
23 | 5 :access_token => ENV["RT_ACCESS_TOKEN"], |
6 :access_token_secret => ENV["RT_ACCESS_TOKEN_SECRET"] | |
15 | 7 } |
8 | |
9 def timeline | |
28 | 10 @timeline ||= |
30
205c0b5d9f44
Whoops, expires_in accidentally as key name.
edogawaconan <me@myconan.net>
parents:
28
diff
changeset
|
11 Rails.cache.fetch({ :timeline => @twitter_id }, :expires_in => 5.minutes) do |
28 | 12 @client.user_timeline(@twitter_id) |
13 end | |
15 | 14 end |
15 | |
16 def initialize(twitter_id) | |
17 @client = Twitter::REST::Client.new do |config| | |
21 | 18 CONFIG.each do |cfg_key, cfg_value| |
19 config.public_send("#{cfg_key}=", cfg_value) | |
20 end | |
21 end | |
15 | 22 @twitter_id = twitter_id |
23 end | |
24 end |