diff options
author | rhenium <re4k@re4k.info> | 2013-05-19 11:38:38 +0900 |
---|---|---|
committer | rhenium <re4k@re4k.info> | 2013-05-19 11:38:38 +0900 |
commit | b49ad1708874c273b5f6bf07c625ea2a7701825a (patch) | |
tree | c54776825c5be7149c31047a7fd7edf2bcc1bd36 /lib | |
parent | c93b516fdb0a2f826bde15aaefe3a66508639111 (diff) | |
download | aclog-b49ad1708874c273b5f6bf07c625ea2a7701825a.tar.gz |
rewrite notification
Diffstat (limited to 'lib')
-rw-r--r-- | lib/aclog/notification.rb | 25 | ||||
-rw-r--r-- | lib/aclog/receiver/collector_connection.rb | 2 |
2 files changed, 1 insertions, 26 deletions
diff --git a/lib/aclog/notification.rb b/lib/aclog/notification.rb deleted file mode 100644 index 0404f4c..0000000 --- a/lib/aclog/notification.rb +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -module Aclog - module Notification - def self.reply_favs(tweet, count) - reply_tweet(tweet.user, "#{count}favs!", tweet) - end - - private - def self.reply_tweet(user, text, tweet) - @@account ||= Twitter::Client.new(consumer_key: Settings.notification.consumer.key, - consumer_secret: Settings.notification.consumer.secret, - oauth_token: Settings.notification.token[0].token, - oauth_token_secret: Settings.notification.token[0].secret) - - url = Rails.application.routes.url_helpers.tweet_url(host: Settings.base_url, id: tweet.id) - - begin - @@account.update("@#{user.screen_name} #{text} #{url}", :in_reply_to_status_id => tweet.id) - rescue Exception - Rails.logger.error($!) - Rails.logger.error($@) - end - end - end -end diff --git a/lib/aclog/receiver/collector_connection.rb b/lib/aclog/receiver/collector_connection.rb index ca37d55..2d82a58 100644 --- a/lib/aclog/receiver/collector_connection.rb +++ b/lib/aclog/receiver/collector_connection.rb @@ -161,7 +161,7 @@ module Aclog f = Favorite.from_hash(:tweet_id => msg["tweet_id"], :user_id => msg["user_id"]) if t = Tweet.find_by(id: msg["tweet_id"]) - t.notify_favorite + Notification.notify_favorite(t) end end end |