annotate app/models/tweet.rb @ 15:207917e41964

Add tweets~ Feature is now on par with the thing it's replacing.
author edogawaconan <me@myconan.net>
date Fri, 05 Sep 2014 20:37:25 +0900
parents
children 6e3ff830e94a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15
207917e41964 Add tweets~
edogawaconan <me@myconan.net>
parents:
diff changeset
1 class Tweet
207917e41964 Add tweets~
edogawaconan <me@myconan.net>
parents:
diff changeset
2 CONFIG = {
207917e41964 Add tweets~
edogawaconan <me@myconan.net>
parents:
diff changeset
3 :consumer_key => ENV["RT_CONSUMER_KEY"],
207917e41964 Add tweets~
edogawaconan <me@myconan.net>
parents:
diff changeset
4 :consumer_secret => ENV["RT_CONSUMER_SECRET"],
207917e41964 Add tweets~
edogawaconan <me@myconan.net>
parents:
diff changeset
5 :access_token => ENV["RT_OAUTH_TOKEN"],
207917e41964 Add tweets~
edogawaconan <me@myconan.net>
parents:
diff changeset
6 :access_token_secret => ENV["RT_OAUTH_TOKEN_SECRET"]
207917e41964 Add tweets~
edogawaconan <me@myconan.net>
parents:
diff changeset
7 }
207917e41964 Add tweets~
edogawaconan <me@myconan.net>
parents:
diff changeset
8
207917e41964 Add tweets~
edogawaconan <me@myconan.net>
parents:
diff changeset
9 def timeline
207917e41964 Add tweets~
edogawaconan <me@myconan.net>
parents:
diff changeset
10 @timeline ||= @client.user_timeline(@twitter_id)
207917e41964 Add tweets~
edogawaconan <me@myconan.net>
parents:
diff changeset
11 end
207917e41964 Add tweets~
edogawaconan <me@myconan.net>
parents:
diff changeset
12
207917e41964 Add tweets~
edogawaconan <me@myconan.net>
parents:
diff changeset
13 def initialize(twitter_id)
207917e41964 Add tweets~
edogawaconan <me@myconan.net>
parents:
diff changeset
14 @client = Twitter::REST::Client.new do |config|
207917e41964 Add tweets~
edogawaconan <me@myconan.net>
parents:
diff changeset
15 CONFIG.each do |cfg_key, cfg_value|
207917e41964 Add tweets~
edogawaconan <me@myconan.net>
parents:
diff changeset
16 config.public_send("#{cfg_key}=", cfg_value)
207917e41964 Add tweets~
edogawaconan <me@myconan.net>
parents:
diff changeset
17 end
207917e41964 Add tweets~
edogawaconan <me@myconan.net>
parents:
diff changeset
18 end
207917e41964 Add tweets~
edogawaconan <me@myconan.net>
parents:
diff changeset
19 @twitter_id = twitter_id
207917e41964 Add tweets~
edogawaconan <me@myconan.net>
parents:
diff changeset
20 end
207917e41964 Add tweets~
edogawaconan <me@myconan.net>
parents:
diff changeset
21 end