lesser-evil 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d054ca93dff9d88e38526a6fce26a0aff6307ecb
4
+ data.tar.gz: 02d0edbfb1c88657a136045e45973856ddf41f6a
5
+ SHA512:
6
+ metadata.gz: 6dfe2ad5c1a8a8a1bee4742169800d19f9a8ab4bbd675a6519231624c4024f6051c36b91ffb2d02bad546aceff428829b9ac7e0e582a8dd89e3451e123ab8b1b
7
+ data.tar.gz: 3f6a59b886bd978997129040cf3a6165eebb6f1e79daa8440cdbef35d9cd9382ae50a67d9cd34c0a8c04045a76b56c625e3e5891e6a27df3b735f285d02ab124
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'httparty'
4
+ gem 'rb-readline'
5
+ gem 'pry'
6
+ # gem 'bundler'
7
+ gem 'require_all'
8
+ gem 'whirly'
9
+ gem 'paint'
10
+ gem 'colorize'
data/README.md ADDED
@@ -0,0 +1 @@
1
+ # lesser-evil-cli-app
data/assets/donald.txt ADDED
@@ -0,0 +1,65 @@
1
+ .............`..--:+ooooossssssssyysyyyyyyyhyyyyyyyyyyyyyyyyhyyyyyyyyyyhhhyhdhyhhy/.................
2
+ ............`.://+oooooosoossssssssssssyyyyyyyyssyssssyyyyyyyyyyyyyyyyyyhyyyyhyyhyy+:-..............
3
+ ............::++ooooooooooosssossssssssssssyyyyyssssooosssyyssssyhyyyyyyhyyyssysyyys+:-.............
4
+ ............:/++oosooooosoosossssssssssssssssyysssssooosssssssyyysyyyyyyyyyyyyssooooo+-.............
5
+ ..........--/+o+++oooooosossosssssssssssyyyyyyyyyysoosssososyysyssyyyyyyyyyyyyysoo++++/-............
6
+ .........-://++ooooooooososoossssssssssyyyyyyyysyyyyssssssssssyyyysssssyyyyyssssso+++++:............
7
+ ......-:/+++++++o+oooooosssssssssssssssssyyyyyyyyyyyysssyyyyyyyyyysssssyyysyyso+++++++/:-...........
8
+ .....-:+++/++++oooosssossosoosssssssssssssyyyyyyyyyyyyyyyyyyyyyyyyyyysosssssoo++////+//:-.-.........
9
+ ...-:/++/+/+++ooooossooososossssssysssssssyyyyyyyyyyyhhhyyyyyyhyyyyyyyyyysso++++///////:---.........
10
+ ...-/++o+///+++++++ooooooossssssssysssssssssyyyyyhyyhhhhhyyyyyyyyyyyyyyyyysso+++//////+/--..........
11
+ ....:/++o+++++++++ooooooossssssssssssssssyysssyyyhhyyhddhhyyyyyssssssysssssoo++//////++:-.-.........
12
+ ....-/+++++++o+++oooooososssssssyyysssssssyyssyyyyhhhyhdhhyyyysssssssssssso+++///+++++/::--.........
13
+ ....:/++++++++oooooo++ooooooosossyyssyyssyyyyysyyyyyhhyyhhhyyyssyssssssssoo++//+/++o+++/:---........
14
+ ...-/++o++o++++++oooooooooossoossssssyyyyyyyyhyysyssshyyyyhyyysyyyyyyyyssoo++/+++++/+++/:---........
15
+ ..--:/++++++++++++ooooooooossssssyysyyyyyyyyyyyysssyysyyyyyyyyyyyyyyyyyssso+++++++++//+/:---........
16
+ ....-:++/+/+++++++++++oooooossssyyssyyyyyyysyyyyyyyyyyssyyyssyssyyyyyysssso+++++++++++//:---.-......
17
+ ....-:+////+++++//+++ooossoooooosssssssyyyyyyyyyyyyyyyysssyyssssssssssssssooo+ooo+++++//::--........
18
+ ....-++///////+++++++++osyysssssossssyssyyyyysssyyyyysyyssssssssssssssssssssoooooo+/////::----......
19
+ ....:++//:::///+++++++++oosyyssssssssyyyyyyyyyysssssssssssssyssosssosssssssssso++++////::/----......
20
+ ....+++++/::::////++++++o+oosyyyyssssssssysssssssssossssosssssssssooooooosssssoo+++///:::::-........
21
+ ....:+//++/////::://////++++++oossssssssossoooooooooooooo+o+ooossooooooooooooooooo++//::::::........
22
+ .....:+///::::-:::::////++++++++++++ooooo+++++++++++++++++++oo+oo+o++oooo+ooooooo++++/:::::/-.......
23
+ ....`-////:::::::::::::://///+///////+++/////////////++++++++++++oooooooo+++oooooo+++/::://+:.......
24
+ ....../////////////:::::////:::::::::::::::::::////////+++////++++oo+++++++//+++++++////::://--.....
25
+ ......-::///+++++////:::::://///://::::::////:::///++++++++++oooooooooooo+++++++++++////::///:......
26
+ .......-:://++++///:::::::::::::::::::///////+///+++++//+++++++++//++++oo+++ooo+/+++/////////+-.....
27
+ ........:::/+++////:---/////:::--.----::///+++////+///:::::::-:////////+++ooooo+//////////////-...--
28
+ ....`..-/::/+//////:---::::://::--..--::::/+++/++/::::::------:///////////+ooooo+//////////:-----...
29
+ ......`:/::////////::::-.................://++++o/:-----..--://////+///////+++oo+//////:::..........
30
+ .......///://:://///////://////::::-.....:++++++/:............-----::::////++++++////:----..........
31
+ .......+/+///:::///++++oooooo+oooo+++++++++syssso:------:/::---:--./:://////+++++////:-.-...........
32
+ .......+/++++/////+++++ooooooossssssoooooo+syyyyooo++ooooooooooo++////++//++//+++::/+:..............
33
+ ......`/o+o/+/+///+++++++oooooooooosssooososyyyyssssssyyysooooooooooooo+++++///+--:/+:..-...........
34
+ ......`:oo+///+///++++/++ooossssysssoooooossyysssooosyssyyyyssssssssssoo+++////+--:/+:..............
35
+ ......../+o/////+////////++oossssooo+///+ossyysso+ooosssooossssssssooooo+++/++++:://+--.......-.....
36
+ .........:+/:///////////////+++oo+++:://+ossyysso++++oossooooossooooooo+o++++++++///:.-.......--....
37
+ .........`-:::///////:::::://+++++/:-/+++osyyyyso+/:++oooooooooo++++++++++++++//+++:................
38
+ ...........-:::::////:::::://+////::/oo+osyyyyyso++:/+++++ooo++++++++++++++++///+o/----.............
39
+ ............:::::::////::///////::/+/o++ossssyso++o+//+++++++++///////++++/////++/---...............
40
+ ...........`-:::::::://:://///////+o::+++oooooo+++++++/+++++/////////++++//////+:-..--..............
41
+ ..........``.-:::::::::///////://++++:-::///+++//://++///+++///////++/+//////::-....................
42
+ .........````.::::::::://////::///++++/:-----:::////+++//++///////++///////:/:......................
43
+ .....`````````:::::::::::////://///++o+/:..-:://///+++++////////////////////:.``....................
44
+ ``````````````-:::::::::://////////+oooo+::::/+++++/++++///////////////////:.`````..................
45
+ ```````````````:::::::::://///////++oosso++ooooooo+++++////////////////:://.`````````...............
46
+ ```````````````-:::////////////::///++oosossssssooo+//////////////////:://-`````````````............
47
+ ```````````````-::::///////////::-.....--::::::://+//////////////////////:`````````````````.........
48
+ ```````````````./://///////////::-..`````````````.-:////++++/////////////-`````````````````````.....
49
+ ````````````````//:////////////::--..````````````.-::://+++++++//////////-````````````````````````..
50
+ ````````````````./::::////////:/:///-.```````````.-:/:///++++++/////////o.``````````````````````````
51
+ `````````````````-/::::::::/::////+o+:.``` ```.-/++/:///////////++////sy```````````````````````````
52
+ ``````````````````s:-::::///::::::/oo+:---....-/o+++//////////////////ss/```````````````````````````
53
+ ``````````````````+o--::::/:::::-:://+o/++//::/+++/:://///////////://yy/````````````````````````````
54
+ ``````````````````-yo:--::///:::---:/++++++++/++//---::////////:::/shho`````````````````````````````
55
+ ```````````````````sys/--::////::--.-:/+++++++//:-----://////::::/ydhh:`````````````````````````````
56
+ ```````````````````/hys+---://///::-......---------::////::::::/shhhhs``````````````````````````````
57
+ ```````````````````.yhyso:.-////////:.......------://+//:-:::/yhddhhy-``````````````````````````````
58
+ ````````````````````/hhyss+:-://////::--.----::::://///::-/oyhddddhy+```````````````````````````````
59
+ `````````````````````ohyysso/:-:://////::---:::://///::-:sdddddddhh+.```````````````````````````````
60
+ ``````````````````````syyssso+/:---:::://::::::/::::/+syhdddddddhho.````````````````````````````````
61
+ ``````````````````````:hyyysso+/.............---.-yhddhhdddhhddhhy-`````````````````````````````````
62
+ ```````````````````````shhyys/-``...`````.```..`../yhdhhhhhhhhhhh/.`````````````````````````````````
63
+ ```````````````````````:hhho.`````````````````````..shhhhhhhhdhho..`````````````````````````````````
64
+ ```````````````````````.yy/````..````````````````....shdhhhhhhhs:-.`````````````````````````````````
65
+ © 2016 Saturday Night Live
@@ -0,0 +1,63 @@
1
+ ....................................................................................................
2
+ ............................................---..........-..........................................
3
+ ............................--......--:/+oossooooo++/:----.--.......................................
4
+ ...............................-/+osyhhddddddhhyyssssyso+//////+++//::-.............................
5
+ ...........................-:+shdddddddddhhhhdhhhysosoosssssssssssyssso+/:-.........................
6
+ .........................-/oyhdddddhhhhhhhhhhhhyyyyyoooosssoooosssssyyyssso+:--.....................
7
+ .....................-:+syyhyyyysssooo+ooossssssssyyyooo+++oooosossssssssssyss+/:--.................
8
+ ...................-/osyyyssssoooo++++++////++++ooosss+++++++++osssyyyyyyyyyyyyso/-.................
9
+ ..................:osyysssooossso+/:::--::///::::/++oso/++osyyyyhyhyyhhyyyssyyyyyso/-...............
10
+ ................-:osssoooooss+/:--...-...-:::-:-:::/+oooossyyhhhhhhhhhyyhhyyyyyyyyyso/-.............
11
+ ...............-+osssoooooo/:--......--:::////:////++ososssssssooooyhhhhysshyyyyyyyyys+:-...........
12
+ ..............-/ooooooooo++/-......-::://++++oooosssssyssssso+++//::/+shhhysyyhyyyyyysyo/:..........
13
+ ............../+++++o+++/++:.....-:/+oosssyyhhhhhhdhhhhhhhhyso+++++///:/syhhysshhyyyyysooo/-........
14
+ ............-/+++/++++++++:.`..:/+osyyyyhhhhdddddddddddddddhhhysooo+////:/shhhyssyyyyyysooo:--......
15
+ ...........-/++/++++++/++:-.-:+ossyyyyyhhhdddddddddddddddddddddhyyys+////::oyyhyysosyyysssoo--......
16
+ ..........-//////++/++++/-.-+oosssyyyyhhhhhdddddddddddddddddddhhhhhys+/////:+oyyyyso+ossssoo/--.....
17
+ ..........://///+/++++++:.:+oossssyyyhhhhhhhdddhhhhhdddddddddhhhhhhyyyo////::/+syysssoo+++oo++/--...
18
+ .........-/////+++++////--/oooosssyyyyyyyyhhhhhhhhhhhhhddddhhhhhhhhyyyys//////:/ooosssooo++++++--...
19
+ ........-/////+////////-:/oooooosssyyyyyyyhhhhhhhhddddddddddddddddhhyyyss+/:://::/oo+oooo+++++/:---.
20
+ ........:///////////:/--:+ooosssyyyyyhhhhhhhhddhddddddddddhhhyyysyyyyyysyo+/:-:::://+++++++/////--..
21
+ ........::::///////::---/++ossssssyyyyyyhhhhhhdhhhddhhyyssoooossoo++oosssso/++/:--:///++++++++//:-..
22
+ ........-:://+////::-.--/++++/////++++ooyyhhhhhhhhhhysoo+++osssyyyyso+oysss+///++/::::/++oo+++//:-..
23
+ .......--///++/::---.--:/::/++++++/++/++ssyhhhhhhyysoo+++//:///+osyysssysss+++///+++:---::::::----..
24
+ ......----+//:::---.---:/:/+o+++////////++osyyhhyysooo++//:----:/+ossssyyyys++/////+++/:::////::-...
25
+ .......-..-:::---..----///+++/:-----::://://oshhhysooo+/:/+++++::/+oyyyyyyyyo+////+/+++++++///:-....
26
+ .........--.......----:++/+//:-.--:::/::////+ohdhhysso++sho//oyy/+syhhhyhhyyso++//:::://///+//-.....
27
+ .........--...```.::::/+o+++//-:oo///+y+:/+oosydddhyyoosyy+//++oooyhhdhhhhyyso+//:::/:::::/:---.....
28
+ ............```..-::--:+o+ooo+//o+/::/oso+ossshhddhhhyyyyysoooosyyhdddhhhhyysso+/:--::::-:::::-.....
29
+ ...........-...--::---:+++ossso+//++oossssssyhhhdhhhhdhhyyysyyyhdddddddhhyyysss+//+/-.-:----::-.....
30
+ ```........-:--:------:/+oossssoooooosssssssyhhhdddhhhdddhhhhhhdddddddhhhyysssh+/+yo/-.::--:::-.....
31
+ ``````.......--...-..--/++oosyyyssssyyysooooyhhhhhhhyysydddddddddddddhhhyysssyhysshs++:--::::--.....
32
+ `````````.....---...--./++ooosyyyyyyyyso+oooyhhdhhhhhhsosyhdddddddddhhhyyysssyhyyyh//++-..:::-......
33
+ ``````````````..-.....-++++ooossyyyyyso+oo++osssyssyyyyso+oyhdddddhhhhyyyysssyyhhyo-://+-.-:/:::::::
34
+ ```````````````....`-::+/+++ooosssssso/++/--://///::/+oyys++syhhhhhhyyyyysssssyhyy:--:/++:::////////
35
+ ``````````````.`````.//+/++++ooosssoo+/o+/----:://+ssyyhhhs++oyyyyyyyyyyysssoossy+-::--/++/:.:.-----
36
+ ````````````````````..:+//++++oooooo+/+ooo++++++osyhhdddhhhs++syyyyyyyyyysss//::+::::::////``-``````
37
+ ````````````````````-`.:///++++++ooo//ooosssssssssossssyhhhys+osyyyyssyyysso--:/---///+:++/`..``````
38
+ ````````````````````..`--:/+++++++++/+o+///://+++oooo+/+//osso+ssyysssyyyss////:::/++/++++:.````````
39
+ ````````````````````....`.//+++/++++/++-.:oohsddhmmddmydyo/-+s+oyyyssyyysss/sso+///++++ooo-`````````
40
+ ``````````````````````....-//+++++o+/+/.-/oosohhsyhs+o///--`./+oyysssyyysss/yyyso++++++oo+.````` ``
41
+ ````````````````````````...-/+++++oo++-```````..`````````````:ooyysssysssy+oyyyyssoo+/oo++:`` ``````
42
+ ```````````````````````````.:/+++++o+o+-.`....-...`..----...:ysoyysysssssy:sssyhyyo+ooo++oo:..``````
43
+ ````````````````````````````.:/++++ooos/:////://///++ooooo+/yhyoyssyssssyy/hmmNNNmhyysssssyy:...----
44
+ `````````````````````````````.-/++/oo+oo:/ooooossossssssss+oyyysyssyyyyyyyomMMMMMMNNNNNNNNNNd+...---
45
+ `````````````````````````````---///+ooo++//ooossssssyyso+/+syyysysyyyyyyyohNMMMMMMMMMMMMMMMMMd------
46
+ `````````````````````````````:-.-///ooo+/+//++ooooooso++/+oyyyhyysyyyyyyyomNMMMMMMMMMMMMMMMMMy.-----
47
+ `````````````````````````````.-.`.//+oo+/:/++/++++++oo+o++syyyhhysyyyyss+yNMMMMMMMMMMMMMMMMMN+--..--
48
+ ``````````````````````````````--.`.//+oo+/:::://+++++//+ossyyhhhssyyysso+hNMMMMMMMMMMMMMMMMMy--.....
49
+ ```````````````````````````````.----//+o++/:::::::///++ossyyhhhysyyssso/ymNMMMMMMMMMMMMMMMMM:.......
50
+ ````````````````````````````````..---:/ooo+////+++oooossyyyhhhyssysoss++dmMMMMMMMMMMMMMMMMMN........
51
+ `````````````````````````````````````-:+oooo++oosssyyyyyyhyhhyssso+oo+/smNMMMMMMMMMMMMMMMMMh........
52
+ ````````````````````````````````` `.:::+oooooosyyyyyhhhhyyyysoo+++o++/yNNMMMMMMMMMMMMMMMMMo........
53
+ ```.``` `````````````````````````.::/++//+oooosssssyyyyysysoo+/++++++/mNMMMMMMMMMMMMMMMMMM/-.......
54
+ `.````` `````````````````````````:ss+ooo/::/++oooooooooooooo++////++//omNMMMMMMMMMMMMMMMMMM-........
55
+ ````````````````````````````````shhy+oso+/::::://////////:/++/////+//:smNMMMMMMMMMMMMMMMMMN.........
56
+ ```````````````````````````````/ddhy++yso+-::::::::::::::::///////+/::ymNMMMMMMMMMMMMMMMMMm.........
57
+ ` ```````````````````````````-hmdhysshys+:-:::::::::::----:::::///:::dmNNMMMMMMMMMMMMMMMMh.........
58
+ ```````````````````````````+dmmdhyhhhyo/:::::::::::--------::////:/mNNNMMMMMMMMMNNNMMMMy.........
59
+ ```````.```````````````````.hmmmdddmddhyo/o/::::::-----------::/::/smNNNMMMMMMMMMNNNNMMMs.........
60
+ ``````````.``````````````````/dNNmmmmmdmdhs+ys/::::------------:::/ohdmNNNNMNNNNNNNNNNNMMNs.........
61
+ ``````````.``````````````````smNNNNNNmmmmmhshyyo/::---------::+shmNNmdNNNNNNNNNNNNNNNNNMMNo.-.......
62
+ `````````.```````````````````smNNNNNmmNNNNmyydhhhyo/:///++oshdmNNNNNmmNNNNNMNNNNNNNNNNNMMNo.-.......
63
+ © 2016 Saturday Night Live
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../config/environment'
4
+
5
+ LesserEvil::CommandLineInterface.new.call
@@ -0,0 +1,4 @@
1
+ require 'bundler'
2
+ Bundler.require
3
+
4
+ require_all 'lib'
@@ -0,0 +1,2 @@
1
+ module LesserEvil
2
+ end
@@ -0,0 +1,64 @@
1
+ class LesserEvil::CommandLineInterface
2
+
3
+ def initialize
4
+ end
5
+
6
+ def intro_display
7
+ 20.times { puts }
8
+
9
+ File.open("assets/hillary.txt", "r") do |file|
10
+ file.readlines.each do |line|
11
+ print line.white.on_black
12
+ sleep 0.05
13
+ end
14
+ end
15
+
16
+ puts "\n\n"
17
+
18
+
19
+ File.open("assets/donald.txt", "r") do |file|
20
+ file.readlines.each do |line|
21
+ print line.white.on_black
22
+ sleep 0.05
23
+ end
24
+ end
25
+
26
+ puts "\n\n"
27
+ puts "-----------------------------------".red
28
+ puts "LESSER EVIL ••••••••••••••••••••••".red
29
+ puts
30
+ puts "Peruse the angriest election tweets".red
31
+ puts "-----------------------------------\n\n\n".red
32
+ end
33
+
34
+ def input_validation(valid_array)
35
+ input = gets.chomp.downcase
36
+ while !valid_array.include?(input) do
37
+ print "\nInvalid input. Try again. "
38
+ input = gets.chomp.downcase
39
+ end
40
+ input
41
+ end
42
+
43
+ def call
44
+
45
+ intro_display
46
+ exit = nil
47
+
48
+ while !exit do
49
+ print "Trump or Clinton? Choose a candidate: "
50
+ candidate = input_validation(['trump','clinton'])
51
+ print "Angry or very angry? "
52
+ very_angry = input_validation(['angry','very angry']) == 'very angry'
53
+ puts "\n\n"
54
+ tweets = LesserEvil::TweetController.new(candidate: candidate, is_intense: very_angry, sentiment: "Negative", fast_print: true).get_print_tweets
55
+ puts "\n\n"
56
+ print "New batch? (yes/no): "
57
+ exit = input_validation(['y','yes','n','no']).start_with?('n')
58
+ end
59
+
60
+ puts "O.K.! Take it easy."
61
+
62
+ end
63
+
64
+ end
@@ -0,0 +1,13 @@
1
+ module LesserEvil
2
+
3
+ BASE_TWITTER_URL = "https://api.twitter.com/1.1/search/tweets.json"
4
+ SENTIMENT_URL = "http://sentiment.vivekn.com/api/text/"
5
+ SEARCH_TERMS = {
6
+ clinton: "'Hillary+Clinton'+%23ImWithHer+lang:en",
7
+ trump: "'Donald+Trump'+-Jr+%23MAGA+OR+%23MakeAmericaGreatAgain+lang:en"
8
+ }
9
+ DEFAULT_TWEET_QTY = 9
10
+ DEFAULT_BATCH_QTY = 30
11
+ SEPARATOR = "---------------------\n".red
12
+
13
+ end
@@ -0,0 +1,5 @@
1
+ module LesserEvil
2
+
3
+ APP_AUTH = "Bearer AAAAAAAAAAAAAAAAAAAAAPztxgAAAAAAqq0aDjAjGtwkizqhV8wwLdKQB9I%3DY1wGPKUWSz7LV94M2VHBwHle7I3kW46WRmCEgIaZZS6GNTCqwn"
4
+
5
+ end
@@ -0,0 +1,57 @@
1
+ class LesserEvil::TweetController
2
+
3
+ attr_accessor :result, :candidate, :is_intense, :sentiment, :fast_print, :tweet_qty, :batch_qty
4
+
5
+ def initialize(options)
6
+ @result = []
7
+ @candidate = options[:candidate]
8
+ @is_intense = options[:is_intense]
9
+ @sentiment = options[:sentiment] || "Negative"
10
+ @fast_print = options[:fast_print] == nil ? true : options[:fast_print]
11
+ @tweet_qty = options[:tweet_qty] || LesserEvil::DEFAULT_TWEET_QTY
12
+ @batch_qty = options[:batch_qty] || LesserEvil::DEFAULT_BATCH_QTY
13
+ end
14
+
15
+ def get_batch(candidate,is_intense,max_id = nil)
16
+ response = HTTParty.get("#{LesserEvil::BASE_TWITTER_URL}?q=#{LesserEvil::SEARCH_TERMS[candidate.to_sym]}&count=#{@batch_qty}&max_id=#{max_id}", headers: {"Authorization" => LesserEvil::APP_AUTH})
17
+ response["statuses"]
18
+ end
19
+
20
+ def get_sentiment(text)
21
+ options = { body: { txt: text }}
22
+ response = HTTParty.post(LesserEvil::SENTIMENT_URL, options)
23
+ response["result"]
24
+ end
25
+
26
+ def get_print_tweets
27
+ Whirly.configure spinner: "bouncingBar", remove_after_stop: true, stop: LesserEvil::SEPARATOR
28
+ Whirly.start
29
+ max_id = nil
30
+ while @result.length < @tweet_qty
31
+ batch = get_batch(@candidate,@is_intense,max_id)
32
+ max_id = batch.last["id"] - 1
33
+ index = 0
34
+ while index < batch.length && @result.length < @tweet_qty
35
+ status = batch[index]
36
+ if status["retweeted_status"] == nil || (!@result.collect {|tweet_slim| tweet_slim.orig_id}.include?(status["retweeted_status"]["id"]) && !@result.collect {|tweet_slim| tweet_slim.orig_id}.include?(status["id"]))
37
+ sentiment_analysis = get_sentiment(status["text"])
38
+ intensity = @is_intense ? 1 : 0
39
+ if sentiment_analysis["sentiment"] == @sentiment && sentiment_analysis["confidence"].to_f >= 75 * intensity && @result.length < @tweet_qty
40
+ tweet_slim = TweetSlim.new(@candidate,status)
41
+ Whirly.stop
42
+ tweet_slim.prettyprint if @fast_print
43
+ @result << tweet_slim
44
+ Whirly.start
45
+ end
46
+ end
47
+ index += 1
48
+ end
49
+ end
50
+ # puts
51
+ Whirly.stop
52
+ # puts "---------------------".red
53
+ # puts LesserEvil::SEPARATOR
54
+ @result
55
+ end
56
+
57
+ end
@@ -0,0 +1,20 @@
1
+ class TweetSlim
2
+
3
+ attr_accessor :text, :author, :timestamp, :id, :candidate, :orig_id
4
+
5
+ def initialize(candidate,status)
6
+ @text = status["text"]
7
+ @author = status["user"]["screen_name"]
8
+ @timestamp = status["created_at"]
9
+ @id = status["id"]
10
+ @candidate = candidate
11
+ @orig_id = status["retweeted_status"] == nil ? nil : status["retweeted_status"]["id"]
12
+ end
13
+
14
+ def prettyprint
15
+ # puts LesserEvil::SEPARATOR
16
+ puts @text.white.on_black
17
+ puts "@#{@author} #{@timestamp}".blue
18
+ end
19
+
20
+ end
@@ -0,0 +1,5 @@
1
+ module LesserEvil
2
+
3
+ VERSION = '0.0.0'
4
+
5
+ end
data/spec.md ADDED
@@ -0,0 +1,6 @@
1
+ # Specifications for the CLI Assessment
2
+
3
+ Specs:
4
+ - [x] Have a CLI for interfacing with the application
5
+ - [ ] Pull data from an external source
6
+ - [ ] Implement both list and detail views
metadata ADDED
@@ -0,0 +1,58 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lesser-evil
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Adam Cooper
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-11-10 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Tweet gathering and sentiment analysis in the 2016 U.S. presidential
14
+ election
15
+ email: amcooper@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - Gemfile
21
+ - README.md
22
+ - assets/donald.txt
23
+ - assets/hillary.txt
24
+ - bin/lesser-evil-cli
25
+ - config/environment.rb
26
+ - lib/lesser_evil.rb
27
+ - lib/lesser_evil/command_line_interface.rb
28
+ - lib/lesser_evil/constants.rb
29
+ - lib/lesser_evil/secret.rb
30
+ - lib/lesser_evil/tweet_controller.rb
31
+ - lib/lesser_evil/tweet_slim.rb
32
+ - lib/lesser_evil/version.rb
33
+ - spec.md
34
+ homepage: http://rubygems.org/gems/lesser-evil
35
+ licenses:
36
+ - MIT
37
+ metadata: {}
38
+ post_install_message:
39
+ rdoc_options: []
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ requirements: []
53
+ rubyforge_project:
54
+ rubygems_version: 2.4.5.1
55
+ signing_key:
56
+ specification_version: 4
57
+ summary: Who's the lesser evil in 2016?
58
+ test_files: []