lita-onewheel-beer-base 1.2.4 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lita/handlers/onewheel_beer_base.rb +7 -6
- data/lita-onewheel-beer-base.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: 37425648bc99eff65833da82b0430d4f95ccf26c
|
4
|
+
data.tar.gz: b9a816aec27b360da98174ce8caa998ab9978629
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 030c3ffc69f9c8b463220883a8c763c754e9bcc98820e3f1203f4332bbd2a00b658ab7e7be818002c871e42ec517288d5c97d1e2e57005322f43cb59e3270d7a
|
7
|
+
data.tar.gz: 472a3a1d5fd6f3b50dcdc297a45290439708bc28696319f104eeb9de9d0b0a2019aa64cddac0ff4ba7ce9f38dbe38e4e5373c6b5863c9ffd41021cc94b0a32c0
|
@@ -5,11 +5,12 @@ require 'sanitize'
|
|
5
5
|
module Lita
|
6
6
|
module Handlers
|
7
7
|
class OnewheelBeerBase < Handler
|
8
|
+
attr_accessor :bar_name
|
8
9
|
|
9
10
|
def taps_list(response)
|
10
11
|
# wakka wakka
|
11
12
|
beers = self.get_source
|
12
|
-
reply =
|
13
|
+
reply = '#{@bar_name} taps: '
|
13
14
|
beers.each do |tap, datum|
|
14
15
|
reply += "#{tap}) "
|
15
16
|
reply += get_tap_type_text(datum[:type])
|
@@ -27,7 +28,7 @@ module Lita
|
|
27
28
|
end
|
28
29
|
|
29
30
|
def taps_deets(response)
|
30
|
-
Lita.logger.debug
|
31
|
+
Lita.logger.debug 'taps_deets started'
|
31
32
|
beers = get_source
|
32
33
|
beers.each do |tap, datum|
|
33
34
|
query = response.matches[0][0].strip
|
@@ -78,16 +79,16 @@ module Lita
|
|
78
79
|
if (price_matches = query.match(/([><=]+)\s*\$(\d+\.*\d*)/))
|
79
80
|
direction = price_matches.to_s.match(/[<>=]+/).to_s
|
80
81
|
price_requested = price_matches.to_s.match(/\d+.*\d*/).to_s
|
81
|
-
if direction == '>' and datum[:
|
82
|
+
if direction == '>' and datum[:price].to_f > price_requested.to_f
|
82
83
|
send_response(tap, datum, response)
|
83
84
|
end
|
84
|
-
if direction == '<' and datum[:
|
85
|
+
if direction == '<' and datum[:price].to_f < price_requested.to_f
|
85
86
|
send_response(tap, datum, response)
|
86
87
|
end
|
87
|
-
if direction == '>=' and datum[:
|
88
|
+
if direction == '>=' and datum[:price].to_f >= price_requested.to_f
|
88
89
|
send_response(tap, datum, response)
|
89
90
|
end
|
90
|
-
if direction == '<=' and datum[:
|
91
|
+
if direction == '<=' and datum[:price].to_f <= price_requested.to_f
|
91
92
|
send_response(tap, datum, response)
|
92
93
|
end
|
93
94
|
end
|