Sha256: 83eb366b1edcb534586fd807095e265010ab1f1006e20350d8b2f8a71f9de14c

Contents?: true

Size: 565 Bytes

Versions: 5

Compression:

Stored size: 565 Bytes

Contents

class Tweet < Bowline::LocalModel
  class << self
    def poll
      destroy_all
      populate(timeline)
    end
    
    def timeline
      twitter.friends_timeline.collect {|t|
        t.delete('user')
        t.to_hash
      }
    end
    
    def update(status)
      twitter.update(status)
    end

    private
      def twitter
        httpauth = Twitter::HTTPAuth.new(
          AppConfig.username, 
          AppConfig.password
        )
        Twitter::Base.new(httpauth)
      end
  end
end

Thread.new do
  loop do
    Tweet.poll
    sleep 60
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bowline-0.5.8 examples/tweet.rb
bowline-0.5.7 examples/tweet.rb
bowline-0.5.6 examples/tweet.rb
bowline-0.5.5 examples/tweet.rb
bowline-0.5.4 examples/tweet.rb