lita-onewheel-election-cnn 3.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/lita/handlers/onewheel_election_cnn.rb +8 -2
- data/lita-onewheel-election-cnn.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86b0d7c7da63913d2053fe00151d673131d4b5b5
|
4
|
+
data.tar.gz: b038435540dfca7e05a9c42385d526bb4b97ec44
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c65712ee3d6b986fea2d802cb55fa1eb73c9f372e499922cb2022fbfc8890ea354bb09277a7ec6f8ed8a95129f0471cd45a50da3389fb567f9b92f6155e5b28
|
7
|
+
data.tar.gz: e61420adb710a7397158fec56b31f59d6d532570e41c6c17bce727e754d2af25396a2ecaed15aa3dd6bd97c9abda6a09b4268ecbfd7f8863a48a184ea7669f49
|
@@ -14,13 +14,14 @@ module Lita
|
|
14
14
|
help: {'election AB' => 'Display the current election results in Alabama.'}
|
15
15
|
|
16
16
|
def election(response)
|
17
|
-
Lita.logger.debug '
|
17
|
+
Lita.logger.debug 'Getting election data'
|
18
18
|
results = JSON.parse(RestClient.get('http://data.cnn.com/ELECTION/2016/full/P.full.json'))
|
19
19
|
|
20
20
|
results['candidates'].each do |candidate|
|
21
21
|
candidate_str = "#{candidate['fname']} #{candidate['lname']}: "
|
22
22
|
candidate_str += "#{candidate['pctDecimal']}%"
|
23
23
|
candidate_str += " WINNER! #{candidate['evotes']} electoral votes." if candidate['winner']
|
24
|
+
Lita.logger.debug "Replying with #{candidate_str}"
|
24
25
|
response.reply candidate_str
|
25
26
|
end
|
26
27
|
end
|
@@ -33,11 +34,14 @@ module Lita
|
|
33
34
|
|
34
35
|
results['races'].each do |race|
|
35
36
|
if race['state'].downcase == state.downcase
|
36
|
-
|
37
|
+
state_reply = "#{state}, #{race['evotes']} electoral votes, #{race['pctsrep']}% reporting"
|
38
|
+
response.reply state_reply
|
39
|
+
Lita.logger.debug "Replying with #{state_reply}"
|
37
40
|
race['candidates'].each do |candidate|
|
38
41
|
candidate_str = "#{candidate['fname']} #{candidate['lname']}: "
|
39
42
|
candidate_str += "#{candidate['pctDecimal']}%"
|
40
43
|
candidate_str += " WINNER! #{candidate['evotes']} electoral votes." if candidate['winner']
|
44
|
+
Lita.logger.debug "Replying with #{candidate_str}"
|
41
45
|
response.reply candidate_str
|
42
46
|
end
|
43
47
|
end
|
@@ -103,8 +107,10 @@ module Lita
|
|
103
107
|
|
104
108
|
search_state = gimme.upcase
|
105
109
|
if search_state.length == 2
|
110
|
+
Lita.logger.debug "Returning #{states[search_state.upcase]} for #{search_state}"
|
106
111
|
states[search_state.upcase]
|
107
112
|
else
|
113
|
+
Lita.logger.debug "Returning #{search_state}"
|
108
114
|
search_state
|
109
115
|
end
|
110
116
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = 'lita-onewheel-election-cnn'
|
3
|
-
spec.version = '3.0.
|
3
|
+
spec.version = '3.0.1'
|
4
4
|
spec.authors = ['Andrew Kreps']
|
5
5
|
spec.email = ['andrew.kreps@gmail.com']
|
6
6
|
spec.description = %q{Lita interface to CNN's 2016 Presidential Election JSON.}
|