lita-onewheel-election-cnn 3.0.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 30c1898cee0d74d869a5e8d86c48fdf1fca41332
4
- data.tar.gz: 428326960b2d5eb2bbf537605fb79492cae926d9
3
+ metadata.gz: 86b0d7c7da63913d2053fe00151d673131d4b5b5
4
+ data.tar.gz: b038435540dfca7e05a9c42385d526bb4b97ec44
5
5
  SHA512:
6
- metadata.gz: c397ead8761546a44341bd7b1b780020fb43b54b4a8474989ea5f068cf85ce06a38b7cb0569cf1b1b57186f3ebd0fbcdb87db50b8657225d1e18234ce5664a24
7
- data.tar.gz: 1588204b29a442effaf07966d39df58355f4743e35708a8f9310447ef680974ec219c6ddbb6bf808e6a3f4b641e0266c41aece56f6a6b15725f24f2c5c508c90
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 'get_source started'
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
- response.reply "#{state}, #{race['evotes']} electoral votes, #{race['pctsrep']}% reporting"
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.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.}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-onewheel-election-cnn
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kreps