lita-onewheel-baileys 3.7.1 → 3.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +10 -3
- data/README.md +3 -2
- data/lib/lita/handlers/onewheel_baileys.rb +41 -0
- data/lita-onewheel-baileys.gemspec +1 -1
- data/spec/fixtures/baileys.html +1 -1
- data/spec/lita/handlers/onewheel_baileys_spec.rb +20 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a785e446db04a9763df3ac07bdb952a1231e0419
|
4
|
+
data.tar.gz: 2121b4459cc4978d7b7f8544d2d15450fe3ec63b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51d6e5ff8c756dd33c593b8c817c1ea8b091ca6149911a10c1fb37f14d3cf513702f486bb352e0fb680f5aeefd47c2cc47922b2403c7015e603f36a3d902892b
|
7
|
+
data.tar.gz: f7f0be033ab7a73658771a137727309a855cb0a47840b7d2d5ff7d24e308bd07e5983bcbcdf63251ae711c8d3e9e37cf3c7e6c25e4f738ba4df42263ae109f49
|
data/.travis.yml
CHANGED
@@ -1,9 +1,16 @@
|
|
1
1
|
language: ruby
|
2
|
+
|
2
3
|
rvm:
|
3
4
|
- 2.2.4
|
4
5
|
- 2.3.0
|
5
|
-
|
6
|
-
|
7
|
-
|
6
|
+
|
7
|
+
script: bundle exec rspec -fp spec
|
8
|
+
|
9
|
+
# Travis CI has an outdated version of bundler on older versions of ruby.
|
10
|
+
# See bundler/bundler#3558 for more information
|
11
|
+
#before_install:
|
12
|
+
# - gem update --system
|
13
|
+
# - gem update bundler
|
14
|
+
|
8
15
|
services:
|
9
16
|
- redis-server
|
data/README.md
CHANGED
@@ -35,6 +35,16 @@ module Lita
|
|
35
35
|
command: true,
|
36
36
|
help: {'tapslow' => 'Show me the kegs at <10% remaining, or the lowest one available.'}
|
37
37
|
|
38
|
+
route /^tapsabvlow$/i,
|
39
|
+
:taps_low_abv,
|
40
|
+
command: true,
|
41
|
+
help: {'tapslow' => 'Show me the lowest abv keg.'}
|
42
|
+
|
43
|
+
route /^tapsabvhigh$/i,
|
44
|
+
:taps_high_abv,
|
45
|
+
command: true,
|
46
|
+
help: {'tapslow' => 'Show me the highest abv keg.'}
|
47
|
+
|
38
48
|
def taps_list(response)
|
39
49
|
beers = get_source
|
40
50
|
reply = "Bailey's taps: "
|
@@ -129,6 +139,9 @@ module Lita
|
|
129
139
|
response_sent = false
|
130
140
|
low_tap = nil
|
131
141
|
beers.each do |tap, datum|
|
142
|
+
unless low_tap
|
143
|
+
low_tap = tap
|
144
|
+
end
|
132
145
|
if low_tap and beers[low_tap][:remaining] > datum[:remaining]
|
133
146
|
low_tap = tap
|
134
147
|
end
|
@@ -139,6 +152,34 @@ module Lita
|
|
139
152
|
end
|
140
153
|
end
|
141
154
|
|
155
|
+
def taps_low_abv(response)
|
156
|
+
beers = get_source
|
157
|
+
low_tap = nil
|
158
|
+
beers.each do |tap, datum|
|
159
|
+
unless low_tap
|
160
|
+
low_tap = tap
|
161
|
+
end
|
162
|
+
if datum[:abv] != 0 and beers[low_tap][:abv] > datum[:abv]
|
163
|
+
low_tap = tap
|
164
|
+
end
|
165
|
+
end
|
166
|
+
send_response(low_tap, beers[low_tap], response)
|
167
|
+
end
|
168
|
+
|
169
|
+
def taps_high_abv(response)
|
170
|
+
beers = get_source
|
171
|
+
high_tap = nil
|
172
|
+
beers.each do |tap, datum|
|
173
|
+
unless high_tap
|
174
|
+
high_tap = tap
|
175
|
+
end
|
176
|
+
if datum[:abv] != 0 and beers[high_tap][:abv] < datum[:abv]
|
177
|
+
high_tap = tap
|
178
|
+
end
|
179
|
+
end
|
180
|
+
send_response(high_tap, beers[high_tap], response)
|
181
|
+
end
|
182
|
+
|
142
183
|
def send_response(tap, datum, response)
|
143
184
|
reply = "Bailey's tap #{tap}) #{get_tap_type_text(datum[:type])}"
|
144
185
|
reply += "#{datum[:brewery]} "
|
data/spec/fixtures/baileys.html
CHANGED
@@ -548,7 +548,7 @@
|
|
548
548
|
</div>
|
549
549
|
</div>
|
550
550
|
<div id="responsecontainer"">
|
551
|
-
<div id="boxfielddata" title="82% remaining" ><b><span>23: <a href="http://http://www.amnesiabrews.com/" target="_blank">Amnesia</a> <i>Slow Train Porter</i></span></b><span id="rateLinks"><a href="http://www.ratebeer.com/advbeersearch.php?BeerName=Slow Train Porter Slow Train Porter" target=_blank title="Click to find a Rate Beer description of this beer!" target=_blank title="Click to find a Rate Beer description of this beer!">RB</a><b>|</b><a href="http://beeradvocate.com/search?q=Amnesia Slow Train Porter&qt=beer" target=_blank title="Click to find a Beer Advocate description of this beer!" target=_blank title="Click to find a Beer Advocate description of this beer!">BA</a></span><br />Porter
|
551
|
+
<div id="boxfielddata" title="82% remaining" ><b><span>23: <a href="http://http://www.amnesiabrews.com/" target="_blank">Amnesia</a> <i>Slow Train Porter</i></span></b><span id="rateLinks"><a href="http://www.ratebeer.com/advbeersearch.php?BeerName=Slow Train Porter Slow Train Porter" target=_blank title="Click to find a Rate Beer description of this beer!" target=_blank title="Click to find a Rate Beer description of this beer!">RB</a><b>|</b><a href="http://beeradvocate.com/search?q=Amnesia Slow Train Porter&qt=beer" target=_blank title="Click to find a Beer Advocate description of this beer!" target=_blank title="Click to find a Beer Advocate description of this beer!">BA</a></span><br />Porter <a href="http://maps.google.com/maps?q=Washougal, WA" target="_blank">Washougal, WA</a> <span></span>
|
552
552
|
<div id="prices">10oz – $3 | 20oz – $5 |
|
553
553
|
<div id="GrowlerPrice"> <form id='cartButtonForm_44' class="Cart66CartButton" method="post" action="http://www.baileystaproom.com/store/cart/" > <input type='hidden' name='task' id="task_44" value='addToCart' /> <input type='hidden' name='cart66ItemId' value='44' /> <input type='hidden' name='product_url' value='http://www.baileystaproom.com/draft-list/' /> <span class="Cart66Price Cart66PriceDescription"> 32oz Crowler $8 </span> <input type='submit' value='Add to Cart' class='Cart66ButtonPrimary purAddToCart ajax-button' name='addToCart_44' id='addToCart_44' /> </form> <div id="stock_message_box_44" class="alert-message alert-error" style="display: none;"> <h2>We're Sorry</h2> <p id="stock_message_44"></p> <input type="button" name="close" value="OK" id="close" class="Cart66ButtonSecondary modalClose" /> </div> <div id="response_warning" class="alert-message warning_44" style="display: none;"> <p><strong><span class="message-header">Inventory Restriction</span></strong></p> <div id="message_warning" class="warning_message_44"></div> <input type="button" name="close" value="OK" class="Cart66ButtonSecondary modalClose"/></div><div id="response_error" class="alert-message alert-error error_44" style="display: none;"> <p><strong><span class="message-header">Inventory Failure</span></strong></p> <div id="message_error" class="error_message_44"></div> <input type="button" name="close" value="OK" class="Cart66ButtonSecondary modalClose"/></div><div id="response_success" class="alert-message success success_44" style="display: none;"> <p><strong><span class="message-header">Success!</span></strong></p> <div id="message_success" class="success_message_44"></div></div> </div>
|
554
554
|
</div>
|
@@ -14,6 +14,8 @@ describe Lita::Handlers::OnewheelBaileys, lita_handler: true do
|
|
14
14
|
it { is_expected.to route_command('taps >=4%') }
|
15
15
|
it { is_expected.to route_command('taps >= 4%') }
|
16
16
|
it { is_expected.to route_command('tapslow') }
|
17
|
+
it { is_expected.to route_command('tapsabvhigh') }
|
18
|
+
it { is_expected.to route_command('tapsabvlow') }
|
17
19
|
|
18
20
|
before do
|
19
21
|
mock = File.open('spec/fixtures/baileys.html').read
|
@@ -144,6 +146,14 @@ describe Lita::Handlers::OnewheelBaileys, lita_handler: true do
|
|
144
146
|
expect(replies[2]).to eq("Bailey's tap 20) Knee Deep Dark Horse - Imperial Stout 12.0%, 4oz - $2 | 12oz - $4 | 32oz Crowler - $10, 39% remaining")
|
145
147
|
end
|
146
148
|
|
149
|
+
it 'searches for prices <= $4.00' do
|
150
|
+
send_command 'taps <= $4.00'
|
151
|
+
expect(replies.count).to eq(3)
|
152
|
+
expect(replies[0]).to eq("Bailey's tap 8) Fat Head’s Zeus Juice - Belgian Strong Blonde 10.0%, 4oz - $2 | 12oz - $4 | 32oz Crowler - $9, 44% remaining")
|
153
|
+
expect(replies[1]).to eq("Bailey's tap 18) Knee Deep Hop Surplus - Triple IPA 10.0%, 4oz - $2 | 12oz - $4 | 32oz Crowler - $10, 25% remaining")
|
154
|
+
expect(replies[2]).to eq("Bailey's tap 20) Knee Deep Dark Horse - Imperial Stout 12.0%, 4oz - $2 | 12oz - $4 | 32oz Crowler - $10, 39% remaining")
|
155
|
+
end
|
156
|
+
|
147
157
|
it 'runs a random beer through' do
|
148
158
|
send_command 'taps roulette'
|
149
159
|
expect(replies.count).to eq(1)
|
@@ -165,4 +175,14 @@ describe Lita::Handlers::OnewheelBaileys, lita_handler: true do
|
|
165
175
|
send_command 'tapslow'
|
166
176
|
expect(replies.last).to eq("Bailey's tap 25) Green Flash Passion Fruit Kicker - Wheat Ale w/ Passion Fruit 5.5%, 10oz - $3 | 20oz - $5, <= 1% remaining")
|
167
177
|
end
|
178
|
+
|
179
|
+
it 'displays low abv' do
|
180
|
+
send_command 'tapsabvhigh'
|
181
|
+
expect(replies.last).to eq("Bailey's tap 20) Knee Deep Dark Horse - Imperial Stout 12.0%, 4oz - $2 | 12oz - $4 | 32oz Crowler - $10, 39% remaining")
|
182
|
+
end
|
183
|
+
|
184
|
+
it 'displays high abv' do
|
185
|
+
send_command 'tapsabvlow'
|
186
|
+
expect(replies.last).to eq("Bailey's tap 3) (Cask) Machine House Crystal Maze - ESB 4.0%, 10oz - $3 | 20oz - $5, 57% remaining")
|
187
|
+
end
|
168
188
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-onewheel-baileys
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kreps
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lita
|