Sha256: 65104c8630b0e9ad8c201ad30f43b4783cb52b04c0cad4f5846bd42ea9c8b84a

Contents?: true

Size: 883 Bytes

Versions: 19

Compression:

Stored size: 883 Bytes

Contents

require 'twitter'


#### Get your twitter keys & secrets:
#### https://dev.twitter.com/docs/auth/tokens-devtwittercom
twitter = Twitter::REST::Client.new do |config|
  config.consumer_key = 'YOUR_CONSUMER_KEY'
  config.consumer_secret = 'YOUR_CONSUMER_SECRET'
  config.access_token = 'YOUR_OAUTH_TOKEN'
  config.access_token_secret = 'YOUR_OAUTH_SECRET'
end

search_term = URI::encode('#todayilearned')

SCHEDULER.every '10m', :first_in => 0 do |job|
  begin
    tweets = twitter.search("#{search_term}")

    if tweets
      tweets = tweets.map do |tweet|
        { name: tweet.user.name, body: tweet.text, avatar: tweet.user.profile_image_url_https }
      end
      send_event('twitter_mentions', comments: tweets)
    end
  rescue Twitter::Error
    puts "\e[33mFor the twitter widget to work, you need to put in your twitter API keys in the jobs/twitter.rb file.\e[0m"
  end
end

Version data entries

19 entries across 19 versions & 4 rubygems

Version Path
smashing-1.3.6 templates/project/jobs/twitter.rb.disabled
smashing-1.3.5 templates/project/jobs/twitter.rb.disabled
smashing-1.3.4 templates/project/jobs/twitter.rb.disabled
smashing-1.3.3 templates/project/jobs/twitter.rb.disabled
smashing-1.3.2 templates/project/jobs/twitter.rb.disabled
smashing-1.3.1 templates/project/jobs/twitter.rb.disabled
smashing-1.3.0 templates/project/jobs/twitter.rb.disabled
smashing-1.2.0 templates/project/jobs/twitter.rb
smashing-1.1.0 templates/project/jobs/twitter.rb
smashing-1.0.0 templates/project/jobs/twitter.rb
dashing-1.3.7 templates/project/jobs/twitter.rb
dashing-1.3.6 templates/project/jobs/twitter.rb
baseboard-1.0.4 templates/project/jobs/twitter.rb
baseboard-1.0.3 templates/project/jobs/twitter.rb
baseboard-1.0.2 templates/project/jobs/twitter.rb
baseboard-1.0.1 templates/project/jobs/twitter.rb
dashing-jruby-1.3.4.1 templates/project/jobs/twitter.rb
dashing-jruby-1.3.4 templates/project/jobs/twitter.rb
dashing-1.3.4 templates/project/jobs/twitter.rb