lita-onewheel-election-cnn 5.0.0 → 5.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: dcb36f750767782db3259ff0c1d9c8cb4125fa30
4
- data.tar.gz: 96f838ab65a3b2e6fa584b21260c61a1aed33156
3
+ metadata.gz: 47b44b4ebd1e5b3153867585b0859aa47676b483
4
+ data.tar.gz: 17db4eaf216708bf308e84199f02e295a1525c4f
5
5
  SHA512:
6
- metadata.gz: 4783f07244c7353d8171775137269befe9a5cac21752ef53fc44f9c165d58d47efc1956917b500882f0a4eff5327319417d2845b11af998759fb7878ad0c92f7
7
- data.tar.gz: f0e062b036c60d5ced29faccdb3de0343a54afa767d600e30753d67f277b89ccb7b8ded9799a1414fb24935313bbcdb4ac2a7a4180bc4cc8f6833fb4fa38ef63
6
+ metadata.gz: 479d4a23f39c1f8183ddc4d5280518d505d18be621fa3f98f361e9e6d5bebe0c20b7c1182f87a9a4efeb7f79d16b10f66d52bd52663b1210cd072b5dc737e84e
7
+ data.tar.gz: 9c5deba4678cc842d1ef263b2a35765038b86f4a327472ad7814a7f4af9b2fddace1e9898375296d30e85e44743d754e6f3d6cc9e4c34f4a4a326008ea930fa7
@@ -30,7 +30,7 @@ module Lita
30
30
  Lita.logger.debug 'Getting election data'
31
31
  results = JSON.parse(RestClient.get('http://data.cnn.com/ELECTION/2016/full/P.full.json'))
32
32
 
33
- response.reply "United States 2016 Presidential Election, #{results['races'][0]['pctsrep']}% reporting."
33
+ response.reply "\x0300United States 2016 Presidential Election, #{results['races'][0]['pctsrep']}% reporting."
34
34
  votes = {'blue' => {}, 'red' => {}}
35
35
  results['candidates'].each do |candidate|
36
36
  if candidate['lname'] == 'Clinton'
@@ -49,7 +49,7 @@ module Lita
49
49
  end
50
50
 
51
51
  blueredstr = get_blueredstr(votes)
52
- response.reply "Clinton #{votes['blue']['percentage']}% #{votes['blue']['popular']} |#{blueredstr}\x0300| Trump #{votes['red']['percentage']}% #{votes['red']['popular']}"
52
+ response.reply "\x0300Clinton #{votes['blue']['percentage']}% #{votes['blue']['popular']} |#{blueredstr}\x0300| Trump #{votes['red']['percentage']}% #{votes['red']['popular']}"
53
53
  end
54
54
 
55
55
  def get_blueredstr(votes)
@@ -74,7 +74,7 @@ module Lita
74
74
 
75
75
  results['races'].each do |race|
76
76
  if race['state'].downcase == state.downcase
77
- state_reply = "#{state}, #{race['evotes']} electoral votes, #{race['pctsrep']}% reporting"
77
+ state_reply = "\x0300#{state}, #{race['evotes']} electoral votes, #{race['pctsrep']}% reporting"
78
78
  response.reply state_reply
79
79
  Lita.logger.debug "Replying with #{state_reply}"
80
80
  race['candidates'].each do |candidate|
@@ -94,7 +94,7 @@ module Lita
94
94
  end
95
95
 
96
96
  blueredstr = get_blueredstr(votes)
97
- response.reply "Clinton #{(votes['blue']['winner'] == true)? ' WINNER! ' : '' }#{votes['blue']['percentage']}% #{votes['blue']['popular']} |#{blueredstr}\x0300| Trump #{votes['red']['percentage']}% #{votes['red']['popular']}"
97
+ response.reply "\x0300Clinton #{(votes['blue']['winner'] == true)? ' WINNER! ' : '' }#{votes['blue']['percentage']}% #{votes['blue']['popular']} |#{blueredstr}\x0300| Trump #{votes['red']['percentage']}% #{votes['red']['popular']}"
98
98
  end
99
99
  end
100
100
  end
@@ -191,7 +191,7 @@ module Lita
191
191
 
192
192
  reply.insert((reply.length / 2) + 3, "👽")
193
193
 
194
- reply = "Clinton #{blues} |" + reply + "\x0300| Trump #{reds}"
194
+ reply = "\x0300Clinton #{blues} |" + reply + "\x0300| Trump #{reds}"
195
195
 
196
196
  response.reply reply
197
197
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'lita-onewheel-election-cnn'
3
- spec.version = '5.0.0'
3
+ spec.version = '5.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.}
@@ -11,46 +11,46 @@ describe Lita::Handlers::OnewheelElectionCnn, lita_handler: true do
11
11
  mock = File.open('spec/fixtures/election.json').read
12
12
  allow(RestClient).to receive(:get) { mock }
13
13
  send_command 'election'
14
- expect(replies[0]).to eq("United States 2016 Presidential Election, 1% reporting.")
15
- expect(replies[1]).to eq("Clinton 0.0% 0 |\u000312\u000300--------------------------------------------------\u000304\u000300| Trump 0.0% 0")
14
+ expect(replies[0]).to eq("\x0300United States 2016 Presidential Election, 1% reporting.")
15
+ expect(replies[1]).to eq("\x0300Clinton 0.0% 0 |\u000312\u000300--------------------------------------------------\u000304\u000300| Trump 0.0% 0")
16
16
  end
17
17
 
18
18
  it 'shows a winner' do
19
19
  mock = File.open('spec/fixtures/winner.json').read
20
20
  allow(RestClient).to receive(:get) { mock }
21
21
  send_command 'election'
22
- expect(replies[0]).to eq("United States 2016 Presidential Election, 1% reporting.")
23
- expect(replies[1]).to eq("Clinton 0.0% 0 |\u000312\u000300--------------------------------------------------\u000304\u000300| Trump 0.0% 0")
22
+ expect(replies[0]).to eq("\x0300United States 2016 Presidential Election, 1% reporting.")
23
+ expect(replies[1]).to eq("\x0300Clinton 0.0% 0 |\u000312\u000300--------------------------------------------------\u000304\u000300| Trump 0.0% 0")
24
24
  end
25
25
 
26
26
  it 'shows by state' do
27
27
  mock = File.open('spec/fixtures/election.json').read
28
28
  allow(RestClient).to receive(:get) { mock }
29
29
  send_command 'election va'
30
- expect(replies[0]).to eq("Virginia, 13 electoral votes, 0% reporting")
31
- expect(replies[1]).to eq("Clinton 0.0% 0 |\u000312\u000300--------------------------------------------------\u000304\u000300| Trump 0.0% 0")
30
+ expect(replies[0]).to eq("\x0300Virginia, 13 electoral votes, 0% reporting")
31
+ expect(replies[1]).to eq("\x0300Clinton 0.0% 0 |\u000312\u000300--------------------------------------------------\u000304\u000300| Trump 0.0% 0")
32
32
  end
33
33
 
34
34
  it 'shows by STATE' do
35
35
  mock = File.open('spec/fixtures/election.json').read
36
36
  allow(RestClient).to receive(:get) { mock }
37
37
  send_command 'election VA'
38
- expect(replies[0]).to eq("Virginia, 13 electoral votes, 0% reporting")
39
- expect(replies[1]).to eq("Clinton 0.0% 0 |\u000312\u000300--------------------------------------------------\u000304\u000300| Trump 0.0% 0")
38
+ expect(replies[0]).to eq("\x0300Virginia, 13 electoral votes, 0% reporting")
39
+ expect(replies[1]).to eq("\x0300Clinton 0.0% 0 |\u000312\u000300--------------------------------------------------\u000304\u000300| Trump 0.0% 0")
40
40
  end
41
41
 
42
42
  it 'shows by full state name downcase' do
43
43
  mock = File.open('spec/fixtures/election.json').read
44
44
  allow(RestClient).to receive(:get) { mock }
45
45
  send_command 'election new york'
46
- expect(replies[0]).to eq("NEW YORK, 29 electoral votes, 0% reporting")
47
- expect(replies[1]).to eq("Clinton 0.0% 0 |\u000312\u000300--------------------------------------------------\u000304\u000300| Trump 0.0% 0")
46
+ expect(replies[0]).to eq("\x0300NEW YORK, 29 electoral votes, 0% reporting")
47
+ expect(replies[1]).to eq("\x0300Clinton 0.0% 0 |\u000312\u000300--------------------------------------------------\u000304\u000300| Trump 0.0% 0")
48
48
  end
49
49
 
50
50
  it 'ansis' do
51
51
  mock = File.open('spec/fixtures/election.json').read
52
52
  allow(RestClient).to receive(:get) { mock }
53
53
  send_command 'ansielection'
54
- expect(replies.last).to eq("Clinton 0 |\u000312\u000300----------------------------👽-------------------------\u000304█\u000300| Trump 19")
54
+ expect(replies.last).to eq("\x0300Clinton 0 |\u000312\u000300----------------------------👽-------------------------\u000304█\u000300| Trump 19")
55
55
  end
56
56
  end
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: 5.0.0
4
+ version: 5.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kreps