aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/account.rb
diff options
context:
space:
mode:
authorre4k <re4k@re4k.info>2013-04-25 20:29:38 +0900
committerre4k <re4k@re4k.info>2013-04-25 20:29:38 +0900
commite6cbb503f22a476bd0796f1ef4618a1692551f42 (patch)
tree014f07d2f1f469df547116d0d1c75dd993b8ec5d /app/models/account.rb
parent36b3dff713f8452c1cedb4fb6098716dbc515e04 (diff)
downloadaclog-e6cbb503f22a476bd0796f1ef4618a1692551f42.tar.gz
remove Account#twitter_user (was only used in Account#stats_api)
merged Account#stats_api into User#stats changed Account.register_or_update to Account.create_or_update
Diffstat (limited to 'app/models/account.rb')
-rw-r--r--app/models/account.rb21
1 files changed, 1 insertions, 20 deletions
diff --git a/app/models/account.rb b/app/models/account.rb
index faeaadc..8a7fb9d 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -1,5 +1,5 @@
class Account < ActiveRecord::Base
- def self.register_or_update(hash)
+ def self.create_or_update(hash)
account = where(user_id: hash[:user_id]).first_or_initialize
account.oauth_token = hash[:oauth_token]
account.oauth_token_secret = hash[:oauth_token_secret]
@@ -20,13 +20,6 @@ class Account < ActiveRecord::Base
oauth_token_secret: oauth_token_secret)
end
- def twitter_user(uid = nil)
- uid ||= user_id
- Rails.cache.fetch("twitter_user/#{uid}", expires_in: 1.hour) do
- client.user(uid) rescue nil
- end
- end
-
def import_favorites(id)
result = client.status_activity(id)
@@ -43,16 +36,4 @@ class Account < ActiveRecord::Base
Retweet.from_tweet_object(status)
end
end
-
- def stats_api
- return {} unless twitter_user
- {
- favorites_count: twitter_user.favourites_count,
- listed_count: twitter_user.listed_count,
- followers_count: twitter_user.followers_count,
- tweets_count: twitter_user.statuses_count,
- friends_count: twitter_user.friends_count,
- bio: twitter_user.description
- }
- end
end