lita-onewheel-beer-growlers 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/.rspec +1 -0
- data/.travis.yml +16 -0
- data/Gemfile +6 -0
- data/README.md +5 -0
- data/Rakefile +6 -0
- data/lib/lita-onewheel-beer-growlers.rb +12 -0
- data/lib/lita/handlers/onewheel_beer_growlers.rb +107 -0
- data/lita-onewheel-beer-growlers.gemspec +30 -0
- data/spec/fixtures/growlers.json +386 -0
- data/spec/lita/handlers/onewheel_beer_growler_bar_spec.rb +72 -0
- data/spec/spec_helper.rb +14 -0
- metadata +200 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 421289f52514a5ef0634c58c50cfeee0582bebd8
|
4
|
+
data.tar.gz: 2d8be9b0c76e676390b2d896b1d91250e0565bc6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9ff48ffa0857515458e93d5bb238a9b7f419f110effe5526ad080d0a6321848e9fa98ddc0f6575f14860849ec4cf9cb85a504f13c2b30679abe35e85989ec26d
|
7
|
+
data.tar.gz: 843d44a4c81f1aeac813a9fb9d878198ede80834e6e8ad0f9c3c9bda94cc0e71503b34cb9b70c688fd3abc05e774ddf6bdd343dbf58155a4ccf32168140e8d05
|
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--order rand
|
data/.travis.yml
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
language: ruby
|
2
|
+
|
3
|
+
rvm:
|
4
|
+
- 2.2.5
|
5
|
+
- 2.3.1
|
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
|
+
|
15
|
+
services:
|
16
|
+
- redis-server
|
data/Gemfile
ADDED
data/README.md
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'lita'
|
2
|
+
|
3
|
+
Lita.load_locales Dir[File.expand_path(
|
4
|
+
File.join('..', '..', 'locales', '*.yml'), __FILE__
|
5
|
+
)]
|
6
|
+
|
7
|
+
require 'lita/handlers/onewheel_beer_growlers'
|
8
|
+
|
9
|
+
Lita::Handlers::OnewheelBeerGrowlers.template_root File.expand_path(
|
10
|
+
File.join('..', '..', 'templates'),
|
11
|
+
__FILE__
|
12
|
+
)
|
@@ -0,0 +1,107 @@
|
|
1
|
+
require 'rest-client'
|
2
|
+
require 'nokogiri'
|
3
|
+
require 'sanitize'
|
4
|
+
require 'lita-onewheel-beer-base'
|
5
|
+
|
6
|
+
module Lita
|
7
|
+
module Handlers
|
8
|
+
class OnewheelBeerGrowlers < OnewheelBeerBase
|
9
|
+
route /^growlers/i,
|
10
|
+
:taps_list,
|
11
|
+
command: true,
|
12
|
+
help: {'growlers' => 'Display the current Apex Bar taps.'}
|
13
|
+
|
14
|
+
route /^growlers ([\w ]+)$/i,
|
15
|
+
:taps_deets,
|
16
|
+
command: true,
|
17
|
+
help: {'growlers 4' => 'Display the tap 4 deets, including prices.'}
|
18
|
+
|
19
|
+
route /^growlers ([<>=\w.\s]+)%$/i,
|
20
|
+
:taps_by_abv,
|
21
|
+
command: true,
|
22
|
+
help: {'growlers >4%' => 'Display beers over 4% ABV.'}
|
23
|
+
|
24
|
+
route /^growlers ([<>=\$\w.\s]+)$/i,
|
25
|
+
:taps_by_price,
|
26
|
+
command: true,
|
27
|
+
help: {'growlers <$5' => 'Display beers under $5.'}
|
28
|
+
|
29
|
+
route /^growlers (roulette|random)$/i,
|
30
|
+
:taps_by_random,
|
31
|
+
command: true,
|
32
|
+
help: {'growlers roulette' => 'Can\'t decide? Let me do it for you!'}
|
33
|
+
|
34
|
+
route /^growlersabvlow$/i,
|
35
|
+
:taps_low_abv,
|
36
|
+
command: true,
|
37
|
+
help: {'growlersabvlow' => 'Show me the lowest abv keg.'}
|
38
|
+
|
39
|
+
route /^growlersabvhigh$/i,
|
40
|
+
:taps_high_abv,
|
41
|
+
command: true,
|
42
|
+
help: {'growlersabvhigh' => 'Show me the highest abv keg.'}
|
43
|
+
|
44
|
+
def send_response(tap, datum, response)
|
45
|
+
reply = "Growlers tap #{tap}) #{get_tap_type_text(datum[:type])}"
|
46
|
+
# reply += "#{datum[:brewery]} "
|
47
|
+
reply += "#{datum[:name]} "
|
48
|
+
# reply += "- #{datum[:desc]}, "
|
49
|
+
# reply += "Served in a #{datum[1]['glass']} glass. "
|
50
|
+
# reply += "#{datum[:remaining]}"
|
51
|
+
# reply += "#{datum[:abv]}%, "
|
52
|
+
reply += "$#{datum[:price].to_s.sub '.0', ''}"
|
53
|
+
|
54
|
+
Lita.logger.info "send_response: Replying with #{reply}"
|
55
|
+
|
56
|
+
response.reply reply
|
57
|
+
end
|
58
|
+
|
59
|
+
def get_source
|
60
|
+
Lita.logger.debug 'get_source started'
|
61
|
+
unless (response = redis.get('page_response'))
|
62
|
+
Lita.logger.info 'No cached result found, fetching.'
|
63
|
+
response = RestClient.get('http://visualizeapi.com/api/hawthorne')
|
64
|
+
redis.setex('page_response', 1800, response)
|
65
|
+
end
|
66
|
+
parse_response response
|
67
|
+
end
|
68
|
+
|
69
|
+
# This is the worker bee- decoding the html into our "standard" document.
|
70
|
+
# Future implementations could simply override this implementation-specific
|
71
|
+
# code to help this grow more widely.
|
72
|
+
def parse_response(response)
|
73
|
+
gimme_what_you_got = {}
|
74
|
+
response_doc = JSON.parse(response)
|
75
|
+
response_doc['data'].each do |id, tap|
|
76
|
+
tap_name = id
|
77
|
+
|
78
|
+
brewery = tap['brewery']
|
79
|
+
beer_name = tap['beer']
|
80
|
+
|
81
|
+
beer_type = tap['style']
|
82
|
+
# beer_type.sub! /\s+-\s+/, ''
|
83
|
+
|
84
|
+
# abv = beer_node.css('td')[4].children.to_s
|
85
|
+
full_text_search = "#{brewery} #{beer_name.to_s.gsub /(\d+|')/, ''}" # #{beer_desc.to_s.gsub /\d+\.*\d*%*/, ''}
|
86
|
+
|
87
|
+
price = (tap['prices'][0].sub /\$/, '').to_f
|
88
|
+
|
89
|
+
gimme_what_you_got[tap_name] = {
|
90
|
+
# type: tap_type,
|
91
|
+
# remaining: remaining,
|
92
|
+
brewery: brewery.to_s,
|
93
|
+
name: beer_name.to_s,
|
94
|
+
desc: beer_type.to_s,
|
95
|
+
# abv: abv.to_f,
|
96
|
+
price: price,
|
97
|
+
search: full_text_search
|
98
|
+
}
|
99
|
+
end
|
100
|
+
|
101
|
+
gimme_what_you_got
|
102
|
+
end
|
103
|
+
|
104
|
+
Lita.register_handler(self)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
Gem::Specification.new do |spec|
|
2
|
+
spec.name = 'lita-onewheel-beer-growlers'
|
3
|
+
spec.version = '0.0.0'
|
4
|
+
spec.authors = ['Andrew Kreps']
|
5
|
+
spec.email = ['andrew.kreps@gmail.com']
|
6
|
+
spec.description = %q{Lita interface to Growlers on Hawthorne's listings.}
|
7
|
+
spec.summary = %q{See above.}
|
8
|
+
spec.homepage = 'https://github.com/onewheelskyward/lita-onewheel-beer-growlers'
|
9
|
+
spec.license = 'MIT'
|
10
|
+
spec.metadata = { 'lita_plugin_type' => 'handler' }
|
11
|
+
|
12
|
+
spec.files = `git ls-files`.split($/)
|
13
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
14
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
15
|
+
spec.require_paths = ['lib']
|
16
|
+
|
17
|
+
spec.add_runtime_dependency 'lita', '~> 4.7'
|
18
|
+
spec.add_runtime_dependency 'rest-client', '~> 1.8'
|
19
|
+
spec.add_runtime_dependency 'sanitize', '~> 4.0'
|
20
|
+
spec.add_runtime_dependency 'lita-onewheel-beer-base', '~> 2'
|
21
|
+
|
22
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
23
|
+
|
24
|
+
# spec.add_development_dependency 'pry-byebug', '~> 3.1'
|
25
|
+
spec.add_development_dependency 'rake', '~> 10.4'
|
26
|
+
spec.add_development_dependency 'rack-test', '~> 0.6'
|
27
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
28
|
+
spec.add_development_dependency 'simplecov', '~> 0.10'
|
29
|
+
spec.add_development_dependency 'coveralls', '~> 0.8'
|
30
|
+
end
|
@@ -0,0 +1,386 @@
|
|
1
|
+
{
|
2
|
+
"status": "ok",
|
3
|
+
"cache": "2016-07-09T07:15:58.390Z",
|
4
|
+
"data": {
|
5
|
+
"1": {
|
6
|
+
"glass": "Nonic",
|
7
|
+
"prices": [
|
8
|
+
"$9.99"
|
9
|
+
],
|
10
|
+
"fill": 0.5919354838709678,
|
11
|
+
"added": "2016-07-01T20:15:07.607Z",
|
12
|
+
"beer": "Star Spangled Lager",
|
13
|
+
"style": "Lager ",
|
14
|
+
"brewery": "Ex Novo"
|
15
|
+
},
|
16
|
+
"2": {
|
17
|
+
"glass": "Nonic",
|
18
|
+
"prices": [
|
19
|
+
"$11.99"
|
20
|
+
],
|
21
|
+
"fill": 0.3122557726465365,
|
22
|
+
"added": "2016-07-02T04:09:12.694Z",
|
23
|
+
"beer": "Helles",
|
24
|
+
"style": "Munich-Style Helles Lager ",
|
25
|
+
"brewery": "pFriem"
|
26
|
+
},
|
27
|
+
"3": {
|
28
|
+
"glass": "Nonic",
|
29
|
+
"prices": [
|
30
|
+
"$11.99"
|
31
|
+
],
|
32
|
+
"fill": 0.32580645161290306,
|
33
|
+
"added": "2016-05-21T04:45:38.228Z",
|
34
|
+
"beer": "German Pilsner",
|
35
|
+
"style": "Pilsner ",
|
36
|
+
"brewery": "ColdFire"
|
37
|
+
},
|
38
|
+
"4": {
|
39
|
+
"glass": "Nonic",
|
40
|
+
"prices": [
|
41
|
+
"$12.99"
|
42
|
+
],
|
43
|
+
"fill": 0.5003253090435914,
|
44
|
+
"added": "2016-04-10T04:17:24.901Z",
|
45
|
+
"beer": "Spring Wit",
|
46
|
+
"style": "Witbier ",
|
47
|
+
"brewery": "Drinking Horse"
|
48
|
+
},
|
49
|
+
"5": {
|
50
|
+
"glass": "Nonic",
|
51
|
+
"prices": [
|
52
|
+
"$13.99"
|
53
|
+
],
|
54
|
+
"fill": 0.6032530904359141,
|
55
|
+
"added": "2016-06-26T22:54:34.416Z",
|
56
|
+
"beer": "Side Line",
|
57
|
+
"style": "Dry-Hopped Saison w/ triticale- Hops (Crystal, Santiam, & Experimental hops)",
|
58
|
+
"brewery": "Upright"
|
59
|
+
},
|
60
|
+
"6": {
|
61
|
+
"glass": "Nonic",
|
62
|
+
"prices": [
|
63
|
+
"$10.99"
|
64
|
+
],
|
65
|
+
"fill": 0.8935483870967742,
|
66
|
+
"added": "2016-07-01T20:15:29.551Z",
|
67
|
+
"beer": "El Guapo",
|
68
|
+
"style": "Blonde Ale w/ cucumber, habanero, and lime",
|
69
|
+
"brewery": "Flat Tail"
|
70
|
+
},
|
71
|
+
"7": {
|
72
|
+
"glass": "Nonic",
|
73
|
+
"prices": [
|
74
|
+
"$12.99"
|
75
|
+
],
|
76
|
+
"fill": 0.11090725806451554,
|
77
|
+
"added": "2016-05-21T04:46:19.087Z",
|
78
|
+
"beer": "Dam Wild: Hops & Lemon Verbena",
|
79
|
+
"style": "Wild Ale w/ lemon verbena- Hops (Citra & Simcoe)",
|
80
|
+
"brewery": "Flat Tail"
|
81
|
+
},
|
82
|
+
"8": {
|
83
|
+
"glass": "Nonic",
|
84
|
+
"prices": [
|
85
|
+
"$10.99"
|
86
|
+
],
|
87
|
+
"fill": 0.8048387096774193,
|
88
|
+
"added": "2016-06-15T18:02:39.268Z",
|
89
|
+
"beer": "Fuzztail",
|
90
|
+
"style": "Hefeweizen ",
|
91
|
+
"brewery": "Sunriver"
|
92
|
+
},
|
93
|
+
"9": {
|
94
|
+
"glass": "Nonic",
|
95
|
+
"prices": [
|
96
|
+
"$12.99"
|
97
|
+
],
|
98
|
+
"fill": 0.16513104838709627,
|
99
|
+
"added": "2016-05-21T04:47:02.114Z",
|
100
|
+
"beer": "Kirsch Gose",
|
101
|
+
"style": "Sour Cherry Gose ",
|
102
|
+
"brewery": "Victory"
|
103
|
+
},
|
104
|
+
"10": {
|
105
|
+
"glass": "Nonic",
|
106
|
+
"prices": [
|
107
|
+
"$11.99"
|
108
|
+
],
|
109
|
+
"fill": 0.8126219908913468,
|
110
|
+
"added": "2016-07-04T21:50:55.468Z",
|
111
|
+
"beer": "Little Red Pils",
|
112
|
+
"style": "Amber Lager ",
|
113
|
+
"brewery": "Double Mountain"
|
114
|
+
},
|
115
|
+
"11": {
|
116
|
+
"glass": "Nonic",
|
117
|
+
"prices": [
|
118
|
+
"$12.99"
|
119
|
+
],
|
120
|
+
"fill": 0.5415038484310243,
|
121
|
+
"added": "2016-07-01T20:18:59.897Z",
|
122
|
+
"beer": "Spruce Budd Ale",
|
123
|
+
"style": "Ale w/ Spruce tips",
|
124
|
+
"brewery": "Fort George"
|
125
|
+
},
|
126
|
+
"12": {
|
127
|
+
"glass": "Nonic",
|
128
|
+
"prices": [
|
129
|
+
"$10.99"
|
130
|
+
],
|
131
|
+
"fill": 0.7870967741935483,
|
132
|
+
"added": "2016-07-01T21:30:43.324Z",
|
133
|
+
"beer": "Kissed by Melons",
|
134
|
+
"style": "Berliner Weisse w/melon",
|
135
|
+
"brewery": "Stickmen"
|
136
|
+
},
|
137
|
+
"13": {
|
138
|
+
"glass": "Nonic",
|
139
|
+
"prices": [
|
140
|
+
"$10.99"
|
141
|
+
],
|
142
|
+
"fill": 0.5564516129032258,
|
143
|
+
"added": "2016-06-26T22:54:47.116Z",
|
144
|
+
"beer": "Red Thistle Ale",
|
145
|
+
"style": "ESB ",
|
146
|
+
"brewery": "Golden Valley"
|
147
|
+
},
|
148
|
+
"14": {
|
149
|
+
"glass": "Nonic",
|
150
|
+
"prices": [
|
151
|
+
"$12.99"
|
152
|
+
],
|
153
|
+
"fill": 0.9112903225806451,
|
154
|
+
"added": "2016-07-01T20:26:18.446Z",
|
155
|
+
"beer": "Pathfinder",
|
156
|
+
"style": "Pale Ale w/ juniper berries",
|
157
|
+
"brewery": "Viking Braggot Co."
|
158
|
+
},
|
159
|
+
"16": {
|
160
|
+
"glass": "Nonic",
|
161
|
+
"prices": [
|
162
|
+
"$11.99"
|
163
|
+
],
|
164
|
+
"fill": 0.7915926583777383,
|
165
|
+
"added": "2016-07-01T20:27:49.17Z",
|
166
|
+
"beer": "Hop Slice",
|
167
|
+
"style": "Session IPA w/ Meyer Lemon",
|
168
|
+
"brewery": "Deschutes"
|
169
|
+
},
|
170
|
+
"17": {
|
171
|
+
"glass": "Nonic",
|
172
|
+
"prices": [
|
173
|
+
"$10.99"
|
174
|
+
],
|
175
|
+
"fill": 0.6096774193548387,
|
176
|
+
"added": "2016-07-02T18:06:05.805Z",
|
177
|
+
"beer": "Best Coast IPA",
|
178
|
+
"style": "American IPA ",
|
179
|
+
"brewery": "Ancestry"
|
180
|
+
},
|
181
|
+
"18": {
|
182
|
+
"glass": "Nonic",
|
183
|
+
"prices": [
|
184
|
+
"$13.99"
|
185
|
+
],
|
186
|
+
"fill": 0.7516129032258064,
|
187
|
+
"added": "2016-07-02T04:06:33.418Z",
|
188
|
+
"beer": "Here Comes Mango!",
|
189
|
+
"style": "American IPA w/Mango",
|
190
|
+
"brewery": "Belching Beaver"
|
191
|
+
},
|
192
|
+
"19": {
|
193
|
+
"glass": "Nonic",
|
194
|
+
"prices": [
|
195
|
+
"$10.99"
|
196
|
+
],
|
197
|
+
"fill": 0.6983870967741935,
|
198
|
+
"added": "2016-07-01T20:33:23.572Z",
|
199
|
+
"beer": "German IPA",
|
200
|
+
"style": "IPA w/ Kolsch yeast- Hops (Hull Melon, TNT)",
|
201
|
+
"brewery": "Ex Novo"
|
202
|
+
},
|
203
|
+
"20": {
|
204
|
+
"glass": "Nonic",
|
205
|
+
"prices": [
|
206
|
+
"$11.99"
|
207
|
+
],
|
208
|
+
"fill": 0.9290322580645162,
|
209
|
+
"added": "2016-07-01T20:33:02.911Z",
|
210
|
+
"beer": "Mosaic Eruption",
|
211
|
+
"style": "IPA - Hops (Mosaic, Amarillo, Centennial)",
|
212
|
+
"brewery": "Mazama"
|
213
|
+
},
|
214
|
+
"21": {
|
215
|
+
"glass": "Nonic",
|
216
|
+
"prices": [
|
217
|
+
"$11.99"
|
218
|
+
],
|
219
|
+
"fill": 0.485483870967742,
|
220
|
+
"added": "2016-07-01T02:12:35.077Z",
|
221
|
+
"beer": "IPA",
|
222
|
+
"style": "IPA ",
|
223
|
+
"brewery": "Buoy"
|
224
|
+
},
|
225
|
+
"23": {
|
226
|
+
"glass": "Nonic",
|
227
|
+
"prices": [
|
228
|
+
"$14.99"
|
229
|
+
],
|
230
|
+
"fill": 0.8334417696811971,
|
231
|
+
"added": "2016-07-06T23:18:58.71Z",
|
232
|
+
"beer": "Hop Venom",
|
233
|
+
"style": "Imperial IPA ",
|
234
|
+
"brewery": "Boneyard"
|
235
|
+
},
|
236
|
+
"24": {
|
237
|
+
"glass": "Nonic",
|
238
|
+
"prices": [
|
239
|
+
"$12.99"
|
240
|
+
],
|
241
|
+
"fill": 0.7161290322580646,
|
242
|
+
"added": "2016-07-01T20:39:35.813Z",
|
243
|
+
"beer": "Dynamic Duo",
|
244
|
+
"style": "Imperial IPA - Hops (Citra & Chinook)",
|
245
|
+
"brewery": "Ex Novo"
|
246
|
+
},
|
247
|
+
"26": {
|
248
|
+
"glass": "Nonic",
|
249
|
+
"prices": [
|
250
|
+
"$17.99"
|
251
|
+
],
|
252
|
+
"fill": 0.25384072580645134,
|
253
|
+
"added": "2016-04-23T21:30:18.772Z",
|
254
|
+
"beer": "Mach 10 Imperial IPA",
|
255
|
+
"style": "Imperial IPA ",
|
256
|
+
"brewery": "Bear Republic"
|
257
|
+
},
|
258
|
+
"27": {
|
259
|
+
"glass": "Nonic",
|
260
|
+
"prices": [
|
261
|
+
"$11.99"
|
262
|
+
],
|
263
|
+
"fill": 0.35107351984385177,
|
264
|
+
"added": "2016-06-04T22:23:41.909Z",
|
265
|
+
"beer": "Oatis Reddin'",
|
266
|
+
"style": "Imperial Red Ale w/ Oats",
|
267
|
+
"brewery": "Uptown Market"
|
268
|
+
},
|
269
|
+
"28": {
|
270
|
+
"glass": "Nonic",
|
271
|
+
"prices": [
|
272
|
+
"$13.99"
|
273
|
+
],
|
274
|
+
"fill": 0.6044242029928433,
|
275
|
+
"added": "2016-07-01T20:41:53.148Z",
|
276
|
+
"beer": "Pale Death",
|
277
|
+
"style": "Belgian-Style Imperial IPA ",
|
278
|
+
"brewery": "Double Mountain"
|
279
|
+
},
|
280
|
+
"29": {
|
281
|
+
"glass": "Nonic",
|
282
|
+
"prices": [
|
283
|
+
"$37.99"
|
284
|
+
],
|
285
|
+
"fill": 0.46447806354009075,
|
286
|
+
"added": "2016-07-01T20:42:20.775Z",
|
287
|
+
"beer": "El Duque do Porto",
|
288
|
+
"style": "Belgian Golden Strong - Barrel Aged (Port)",
|
289
|
+
"brewery": "Mazama"
|
290
|
+
},
|
291
|
+
"30": {
|
292
|
+
"glass": "Nonic",
|
293
|
+
"prices": [
|
294
|
+
"$13.99"
|
295
|
+
],
|
296
|
+
"fill": 0.3937802419354839,
|
297
|
+
"added": "2016-07-06T23:24:17.67Z",
|
298
|
+
"beer": "Dubbel Entendre",
|
299
|
+
"style": "Belgian-Style Dubbel ",
|
300
|
+
"brewery": "Sound Brewery"
|
301
|
+
},
|
302
|
+
"31": {
|
303
|
+
"glass": "Nonic",
|
304
|
+
"prices": [
|
305
|
+
"$11.99"
|
306
|
+
],
|
307
|
+
"fill": 0.05768145161290268,
|
308
|
+
"added": "2016-05-21T04:52:52.174Z",
|
309
|
+
"beer": "Cole Porter",
|
310
|
+
"style": "American Porter ",
|
311
|
+
"brewery": "Magnolia"
|
312
|
+
},
|
313
|
+
"32": {
|
314
|
+
"glass": "Nonic",
|
315
|
+
"prices": [
|
316
|
+
"$12.99"
|
317
|
+
],
|
318
|
+
"fill": 0.6983870967741935,
|
319
|
+
"added": "2016-06-04T22:24:03.931Z",
|
320
|
+
"beer": "Breakfast Stout",
|
321
|
+
"style": "Oatmeal Stout ",
|
322
|
+
"brewery": "Barley Brown's"
|
323
|
+
},
|
324
|
+
"33": {
|
325
|
+
"glass": "Nonic",
|
326
|
+
"prices": [
|
327
|
+
"$11.99"
|
328
|
+
],
|
329
|
+
"fill": 0.8935483870967742,
|
330
|
+
"added": "2016-07-03T22:13:17.392Z",
|
331
|
+
"beer": "Coconut Vanilla Porter",
|
332
|
+
"style": "Porter ",
|
333
|
+
"brewery": "Ex Novo"
|
334
|
+
},
|
335
|
+
"34": {
|
336
|
+
"glass": "Nonic",
|
337
|
+
"prices": [
|
338
|
+
"$14.99"
|
339
|
+
],
|
340
|
+
"fill": 0.36096822995461425,
|
341
|
+
"added": "2016-06-30T01:23:57.242Z",
|
342
|
+
"beer": "Gingerade",
|
343
|
+
"style": "Kombucha w/ fresh pressed ginger"
|
344
|
+
},
|
345
|
+
"35": {
|
346
|
+
"glass": "Nonic",
|
347
|
+
"prices": [
|
348
|
+
"$14.99"
|
349
|
+
],
|
350
|
+
"fill": 0.14196671709531,
|
351
|
+
"added": "2016-06-26T22:55:28.298Z",
|
352
|
+
"beer": "Hibiscus No. 7",
|
353
|
+
"style": "Kombucha"
|
354
|
+
},
|
355
|
+
"36": {
|
356
|
+
"glass": "Nonic",
|
357
|
+
"prices": [
|
358
|
+
"$14.99"
|
359
|
+
],
|
360
|
+
"fill": 0.9290322580645162,
|
361
|
+
"added": "2016-07-03T18:26:23.523Z",
|
362
|
+
"beer": "Bad Apple",
|
363
|
+
"style": "Dry Cider "
|
364
|
+
},
|
365
|
+
"38": {
|
366
|
+
"glass": "Nonic",
|
367
|
+
"prices": [
|
368
|
+
"$20.99"
|
369
|
+
],
|
370
|
+
"fill": 0.30472012102874424,
|
371
|
+
"added": "2016-06-03T22:30:28.034Z",
|
372
|
+
"beer": "Sunny Cider",
|
373
|
+
"style": "Ginger Lemon "
|
374
|
+
},
|
375
|
+
"39": {
|
376
|
+
"glass": "Nonic",
|
377
|
+
"prices": [
|
378
|
+
"$12.99"
|
379
|
+
],
|
380
|
+
"fill": 0.34255040322580627,
|
381
|
+
"added": "2016-06-23T00:29:10.849Z",
|
382
|
+
"beer": "Wholesome Apple",
|
383
|
+
"style": "Hard Cider "
|
384
|
+
}
|
385
|
+
}
|
386
|
+
}
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Lita::Handlers::OnewheelBeerGrowlers, lita_handler: true do
|
4
|
+
it { is_expected.to route_command('growlers') }
|
5
|
+
it { is_expected.to route_command('growlers 4') }
|
6
|
+
it { is_expected.to route_command('growlers nitro') }
|
7
|
+
it { is_expected.to route_command('growlers CASK') }
|
8
|
+
it { is_expected.to route_command('growlers <$4') }
|
9
|
+
it { is_expected.to route_command('growlers < $4') }
|
10
|
+
it { is_expected.to route_command('growlers <=$4') }
|
11
|
+
it { is_expected.to route_command('growlers <= $4') }
|
12
|
+
it { is_expected.to route_command('growlers >4%') }
|
13
|
+
it { is_expected.to route_command('growlers > 4%') }
|
14
|
+
it { is_expected.to route_command('growlers >=4%') }
|
15
|
+
it { is_expected.to route_command('growlers >= 4%') }
|
16
|
+
it { is_expected.to route_command('growlersabvhigh') }
|
17
|
+
it { is_expected.to route_command('growlersabvlow') }
|
18
|
+
|
19
|
+
before do
|
20
|
+
mock = File.open('spec/fixtures/growlers.json').read
|
21
|
+
allow(RestClient).to receive(:get) { mock }
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'shows the taps' do
|
25
|
+
send_command 'growlers'
|
26
|
+
expect(replies.last).to eq("taps: 1) Ex Novo Star Spangled Lager 2) pFriem Helles 3) ColdFire German Pilsner 4) Drinking Horse Spring Wit 5) Upright Side Line 6) Flat Tail El Guapo 7) Flat Tail Dam Wild: Hops & Lemon Verbena 8) Sunriver Fuzztail 9) Victory Kirsch Gose 10) Double Mountain Little Red Pils 11) Fort George Spruce Budd Ale 12) Stickmen Kissed by Melons 13) Golden Valley Red Thistle Ale 14) Viking Braggot Co. Pathfinder 16) Deschutes Hop Slice 17) Ancestry Best Coast IPA 18) Belching Beaver Here Comes Mango! 19) Ex Novo German IPA 20) Mazama Mosaic Eruption 21) Buoy IPA 23) Boneyard Hop Venom 24) Ex Novo Dynamic Duo 26) Bear Republic Mach 10 Imperial IPA 27) Uptown Market Oatis Reddin' 28) Double Mountain Pale Death 29) Mazama El Duque do Porto 30) Sound Brewery Dubbel Entendre 31) Magnolia Cole Porter 32) Barley Brown's Breakfast Stout 33) Ex Novo Coconut Vanilla Porter 34) Gingerade 35) Hibiscus No. 7 36) Bad Apple 38) Sunny Cider 39) Wholesome Apple")
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'displays details for tap 4' do
|
30
|
+
send_command 'growlers 4'
|
31
|
+
expect(replies.last).to eq('Growlers tap 4) Spring Wit $12.99')
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'doesn\'t explode on 1' do
|
35
|
+
send_command 'growlers 1'
|
36
|
+
expect(replies.count).to eq(2)
|
37
|
+
expect(replies.last).to eq('Growlers tap 1) Star Spangled Lager $9.99')
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'searches for ipa' do
|
41
|
+
send_command 'growlers ipa'
|
42
|
+
expect(replies.last).to eq('Growlers tap 26) Mach 10 Imperial IPA $17.99')
|
43
|
+
end
|
44
|
+
|
45
|
+
# it 'searches for brown' do
|
46
|
+
# send_command 'growlers brown'
|
47
|
+
# expect(replies.last).to eq("Bailey's tap 22) GoodLife 29er - India Brown Ale 6.0%, 10oz - $3 | 20oz - $5 | 32oz Crowler - $8, 37% remaining")
|
48
|
+
# end
|
49
|
+
|
50
|
+
it 'searches for prices >$11' do
|
51
|
+
send_command 'growlers >$11'
|
52
|
+
expect(replies.count).to eq(29)
|
53
|
+
expect(replies[1]).to eq('Growlers tap 2) Helles $11.99')
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'runs a random beer through' do
|
57
|
+
send_command 'growlers roulette'
|
58
|
+
expect(replies.count).to eq(2)
|
59
|
+
expect(replies.last).to include('Growlers tap')
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'runs a random beer through' do
|
63
|
+
send_command 'growlers random'
|
64
|
+
expect(replies.count).to eq(2)
|
65
|
+
expect(replies.last).to include('Growlers tap')
|
66
|
+
end
|
67
|
+
|
68
|
+
# it 'searches with a space' do
|
69
|
+
# send_command 'growlers cider riot'
|
70
|
+
# expect(replies.last).to eq('Apex tap 10) Cider- NeverGiveAnInch -Rosé 6.9%, $5')
|
71
|
+
# end
|
72
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
require 'coveralls'
|
3
|
+
SimpleCov.formatters = [
|
4
|
+
SimpleCov::Formatter::HTMLFormatter,
|
5
|
+
Coveralls::SimpleCov::Formatter
|
6
|
+
]
|
7
|
+
SimpleCov.start { add_filter '/spec/' }
|
8
|
+
|
9
|
+
require 'lita-onewheel-beer-growlers'
|
10
|
+
require 'lita/rspec'
|
11
|
+
|
12
|
+
# A compatibility mode is provided for older plugins upgrading from Lita 3. Since this plugin
|
13
|
+
# was generated with Lita 4, the compatibility mode should be left disabled.
|
14
|
+
Lita.version_3_compatibility_mode = false
|
metadata
ADDED
@@ -0,0 +1,200 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lita-onewheel-beer-growlers
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Andrew Kreps
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-07-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: lita
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.7'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rest-client
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.8'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.8'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: sanitize
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '4.0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '4.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: lita-onewheel-beer-base
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: bundler
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.3'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.3'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '10.4'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '10.4'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rack-test
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.6'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.6'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rspec
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '3.0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '3.0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: simplecov
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0.10'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0.10'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: coveralls
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0.8'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0.8'
|
153
|
+
description: Lita interface to Growlers on Hawthorne's listings.
|
154
|
+
email:
|
155
|
+
- andrew.kreps@gmail.com
|
156
|
+
executables: []
|
157
|
+
extensions: []
|
158
|
+
extra_rdoc_files: []
|
159
|
+
files:
|
160
|
+
- ".gitignore"
|
161
|
+
- ".rspec"
|
162
|
+
- ".travis.yml"
|
163
|
+
- Gemfile
|
164
|
+
- README.md
|
165
|
+
- Rakefile
|
166
|
+
- lib/lita-onewheel-beer-growlers.rb
|
167
|
+
- lib/lita/handlers/onewheel_beer_growlers.rb
|
168
|
+
- lita-onewheel-beer-growlers.gemspec
|
169
|
+
- spec/fixtures/growlers.json
|
170
|
+
- spec/lita/handlers/onewheel_beer_growler_bar_spec.rb
|
171
|
+
- spec/spec_helper.rb
|
172
|
+
homepage: https://github.com/onewheelskyward/lita-onewheel-beer-growlers
|
173
|
+
licenses:
|
174
|
+
- MIT
|
175
|
+
metadata:
|
176
|
+
lita_plugin_type: handler
|
177
|
+
post_install_message:
|
178
|
+
rdoc_options: []
|
179
|
+
require_paths:
|
180
|
+
- lib
|
181
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
182
|
+
requirements:
|
183
|
+
- - ">="
|
184
|
+
- !ruby/object:Gem::Version
|
185
|
+
version: '0'
|
186
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
187
|
+
requirements:
|
188
|
+
- - ">="
|
189
|
+
- !ruby/object:Gem::Version
|
190
|
+
version: '0'
|
191
|
+
requirements: []
|
192
|
+
rubyforge_project:
|
193
|
+
rubygems_version: 2.5.1
|
194
|
+
signing_key:
|
195
|
+
specification_version: 4
|
196
|
+
summary: See above.
|
197
|
+
test_files:
|
198
|
+
- spec/fixtures/growlers.json
|
199
|
+
- spec/lita/handlers/onewheel_beer_growler_bar_spec.rb
|
200
|
+
- spec/spec_helper.rb
|