diff options
author | Rhenium <rhenium@rhe.jp> | 2014-01-19 22:41:02 +0900 |
---|---|---|
committer | Rhenium <rhenium@rhe.jp> | 2014-01-19 22:41:02 +0900 |
commit | 2c1096b493bfe45d87bd8c4233215ecc04af947a (patch) | |
tree | 8af9b7227038b612b8a669a21e1c3ed49c7c3d1d /app/models/account.rb | |
parent | 75affd437039207c13b22f477c7e8330ced25d17 (diff) | |
download | aclog-2c1096b493bfe45d87bd8c4233215ecc04af947a.tar.gz |
add tweets#import
Diffstat (limited to 'app/models/account.rb')
-rw-r--r-- | app/models/account.rb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/app/models/account.rb b/app/models/account.rb index b7ea90c..66c1523 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -47,10 +47,15 @@ class Account < ActiveRecord::Base end def client - Twitter::REST::Client.new(consumer_key: Settings.consumer.key, - consumer_secret: Settings.consumer.secret, - oauth_token: oauth_token, - oauth_token_secret: oauth_token_secret) + @client ||= Twitter::REST::Client.new(consumer_key: Settings.consumer.key, + consumer_secret: Settings.consumer.secret, + oauth_token: oauth_token, + oauth_token_secret: oauth_token_secret) + end + + def import(id) + obj = client.status(id) + Tweet.from_twitter_object(obj) end def following?(target_user_id) |