dashing 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZjhmYjgyNWQxYTFkMGQ4YWZiMmJhYzFkOTQyNjlhNjU1YTI1NDgxYg==
4
+ N2Q3MzM2YmQzYjQyOTQxYjk2OGNjMjRkMjBiMjM1Mzg1N2NhODkyMQ==
5
5
  data.tar.gz: !binary |-
6
- NWRkNWYyOWY4NzM2ZWE1MDBhMzgxMWYzOTc1ZDE5OTEyNjhmMmVkNQ==
6
+ ZjkxYWEzZmIwNjliZDM1Yjg1OTljNmY4MDY0NDhkYTQzMTcyMDc2ZA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- OGUyODkzMGQ4MWQ4N2E0N2VjOWRkNTg2ODUxODk3YjIyY2Q2MzBmNzNlZGRi
10
- NGYzNDUyZjViYTJlMmRjNjNjNGJkNGE4OWE1NzBhMGU4MjAzYThlY2IxNmFh
11
- MzYzYWQ5NzFkNGU3NmI2ODZlYzk4YjVjZTE5YzE3ODc2MjkzODA=
9
+ OGYwZGVlZTFkMThkMzJkNjZhNGQ5ZTI0ODI0OTAzY2VkNTc2MmYxNzFhYTI2
10
+ NjIyNjZlOTNhNmVmMTA1MzBlZGY4YmU5ZDRhYjBjZjM4YmZmODFjYWM3Mzg1
11
+ NzhiOWM5Zjg2NDQ3MGUwMTRkZTM4ZGJmNmMxZWMxMmU1ZTUzOGY=
12
12
  data.tar.gz: !binary |-
13
- MDdhNDYzYTA2YWYwYmQ3ZTY5MTExODMyMDk1YjhmNTc5ZTZjNjYzZTQzYTNk
14
- OGNkZGMzMzlhOTM1MTdmNjljMGQ2NTQ2MmZhZDkzN2RkZTA2MmZiOGU2ODQ0
15
- OGVkM2E2MzI0NTMwNjkxNjg5M2ViNTNhODhiYjkxMTU4YzYyYjU=
13
+ MGUxNDU0NzAwMmFmNGI1Zjg2ODNiNzU5Mjk2OGMzYWM4YTRlMTc4ZGUyNjBk
14
+ ZjZhMTFlY2U1NTI4MWRmMzU0M2E3NGZiOTJmYTJjODExYmQxYTI4NzZjYTg5
15
+ MzM0MzA5YzlmYTNiM2Y1OWI3N2ZiYzFmZGUyYTAwMDliY2ZmNzY=
@@ -1,3 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'dashing'
3
+ gem 'dashing'
4
+
5
+ ## Remove this if you don't need a twitter widget.
6
+ gem 'twitter'
@@ -1,17 +1,28 @@
1
- require 'net/http'
2
- require 'json'
1
+ require 'twitter'
2
+
3
+
4
+ #### Get your twitter keys & secrets:
5
+ #### https://dev.twitter.com/docs/auth/tokens-devtwittercom
6
+ Twitter.configure do |config|
7
+ config.consumer_key = 'YOUR_CONSUMER_KEY'
8
+ config.consumer_secret = 'YOUR_CONSUMER_SECRET'
9
+ config.oauth_token = 'YOUR_OAUTH_TOKEN'
10
+ config.oauth_token_secret = 'YOUR_OAUTH_SECRET'
11
+ end
3
12
 
4
13
  search_term = URI::encode('#todayilearned')
5
14
 
6
15
  SCHEDULER.every '10m', :first_in => 0 do |job|
7
- http = Net::HTTP.new('search.twitter.com')
8
- response = http.request(Net::HTTP::Get.new("/search.json?q=#{search_term}"))
9
- tweets = JSON.parse(response.body)["results"]
10
- if tweets
11
- tweets.map! do |tweet|
12
- { name: tweet['from_user'], body: tweet['text'], avatar: tweet['profile_image_url_https'] }
16
+ begin
17
+ tweets = Twitter.search("#{search_term}").results
18
+
19
+ if tweets
20
+ tweets.map! do |tweet|
21
+ { name: tweet.user.name, body: tweet.text, avatar: tweet.user.profile_image_url_https }
22
+ end
23
+ send_event('twitter_mentions', comments: tweets)
13
24
  end
14
-
15
- send_event('twitter_mentions', comments: tweets)
25
+ rescue Twitter::Error
26
+ 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"
16
27
  end
17
28
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dashing
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Beauchamp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-09 00:00:00.000000000 Z
11
+ date: 2013-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  prerelease: false