Sha256: 19359519ad8f863d774cb0c5040db405fc07545d1832bd675ea3d22d1eb6f937

Contents?: true

Size: 553 Bytes

Versions: 2

Compression:

Stored size: 553 Bytes

Contents

module Earthquake
  module Twitter
    attr_reader :twitter
  end

  init do
    @twitter = TwitterOAuth::Client.new(config.slice(:consumer_key, :consumer_secret, :token, :secret))
  end

  once do
    class ::TwitterOAuth::Client
      def status_with_cache(id)
        key = "status:#{id}"
        unless s = Earthquake.cache.read(key)
          s = status_without_cache(id)
          Earthquake.cache.write(key, s, :expires_in => 1.hour.ago)
        end
        s
      end
      alias_method_chain :status, :cache
    end
  end

  extend Twitter
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
earthquake-0.4.4 lib/earthquake/twitter.rb
earthquake-0.4.3 lib/earthquake/twitter.rb