Sha256: de32bde2d0cfc579bfb6c5ac59caa0a8594824610b90e14b258e5e997ad46e49

Contents?: true

Size: 1.26 KB

Versions: 10

Compression:

Stored size: 1.26 KB

Contents

module Weeter
  module Plugins
    module Notification
      class Http
        def initialize(client_app_config)
          @config = client_app_config
        end

        def publish_tweet(tweet_item)
          id = tweet_item['id_str']
          text = tweet_item['text']
          user_id = tweet_item['user']['id_str']
          Weeter.logger.info("Publishing tweet #{id} from user #{user_id}: #{text}")
          Weeter::Plugins::Net::OauthHttp.post(@config, @config.publish_url, {:id => id, :text => text, :twitter_user_id => user_id})
        end

        def delete_tweet(tweet_item)
          id = tweet_item['delete']['status']['id'].to_s
          user_id = tweet_item['delete']['status']['user_id'].to_s
          Weeter.logger.info("Deleting tweet #{id} for user #{user_id}")
          Weeter::Plugins::Net::OauthHttp.delete(@config, @config.delete_url, {:id => id, :twitter_user_id => user_id})
        end

        def notify_missed_tweets(tweet_item)
          Weeter.logger.info("Weeter was limited by Twitter. #{tweet_item.missed_tweets_count} tweets missed.")
        end

        def notify_rate_limiting_initiated(tweet_item, limited_keys)
          Weeter.logger.info("Initiated rate limiting with tweet: #{tweet_item.to_json}")
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
weeter-0.19.4 lib/weeter/plugins/notification/http.rb
weeter-0.19.3 lib/weeter/plugins/notification/http.rb
weeter-0.19.2 lib/weeter/plugins/notification/http.rb
weeter-0.19.1 lib/weeter/plugins/notification/http.rb
weeter-0.19.0 lib/weeter/plugins/notification/http.rb
weeter-0.18.0 lib/weeter/plugins/notification/http.rb
weeter-0.17.0 lib/weeter/plugins/notification/http.rb
weeter-0.15.0 lib/weeter/plugins/notification/http.rb
weeter-0.14.0 lib/weeter/plugins/notification/http.rb
weeter-0.13.0 lib/weeter/plugins/notification/http.rb