annotate app/models/tweet.rb @ 26:a4deb8a43cc3

Add standalone servers.
author edogawaconan <me@myconan.net>
date Fri, 05 Sep 2014 23:51:16 +0900
parents b82d86b74636
children 03f904c070f7
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"],
23
b82d86b74636 Update variable names.
edogawaconan <me@myconan.net>
parents: 21
diff changeset
5 :access_token => ENV["RT_ACCESS_TOKEN"],
b82d86b74636 Update variable names.
edogawaconan <me@myconan.net>
parents: 21
diff changeset
6 :access_token_secret => ENV["RT_ACCESS_TOKEN_SECRET"]
15
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|
21
6e3ff830e94a Realign.
edogawaconan <me@myconan.net>
parents: 15
diff changeset
15 CONFIG.each do |cfg_key, cfg_value|
6e3ff830e94a Realign.
edogawaconan <me@myconan.net>
parents: 15
diff changeset
16 config.public_send("#{cfg_key}=", cfg_value)
6e3ff830e94a Realign.
edogawaconan <me@myconan.net>
parents: 15
diff changeset
17 end
6e3ff830e94a Realign.
edogawaconan <me@myconan.net>
parents: 15
diff changeset
18 end
15
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