0

I am new to dashing and I have managed to work a lot out using the internet, however I am now at a loss as to why my widget doesn't update to the new search_term when I change it in the twitter.rb file?

I am using the default twitter.rb file with a couple of amendments. Firstly I have included my Tokens and authorisation keys from twitter.com and secondly, I have just added an extra line to receive more info when something fails in the twitter::error statement.

This is my current code (minus the keys & tokens)

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

SCHEDULER.every '2m', :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 => e
    puts "Twitter Error: #{e}"
    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

I have restarted Dashing; I have even rebooted the box it is on, but all to no avail. I am a total loss.

Any help would be greatly appreciated.

Roman Kiselenko
  • 43,210
  • 9
  • 91
  • 103
MarkyMark
  • 23
  • 5
  • I have noticed that I am also getting this error:Twitter Error: execution expired "Twitter Error: execution expired". I am researching this error. – MarkyMark Jan 19 '15 at 10:51
  • Update: I have now found out that it might be a timeout issue. Some code provided is: Twitter.configure do |config| # open_timeout is the maximum mount of time that the HTTP adapter will wait to # open a connection to the server. # Once the connection is established it has timeout seconds to respond. # the &gt things are of course > but you're against the limitation of my markup now ;-) config.connection_options = Twitter::Default::CONNECTION_OPTIONS.merge(:request => { :open_timeout => 10, :timeout => 20 }) end – MarkyMark Jan 19 '15 at 11:42
  • Does anyone know how to add this to the ruby file including the above code please? I am not a programmer, so not too sure. I did give it a go, but I keep getting errors, so where I have placed the code is obviously incorrect. – MarkyMark Jan 19 '15 at 11:43

0 Answers0