lita-onewheel-apex-bar 0.1.0 → 0.2.0

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: 8a423ba187d1852826ec870e60b59585471e8652
4
- data.tar.gz: 1e6f4129a28465b5b0f7a1181ea98a811baab29d
3
+ metadata.gz: a83b331a165402351c73118ad614ff7970befadd
4
+ data.tar.gz: 68e041d63b65d23a6249e03bcde090c686b482da
5
5
  SHA512:
6
- metadata.gz: 429e32ba40d64ad1b299172987aa475ecf2949f96ba16a1b689541c078700a48c37cfb2ff044f7b37d45e4513167f91bb88158140aa1496b06b2eb562afdbbd9
7
- data.tar.gz: bb445e5c6ef257234fe0455e6e40fbdd8f37193cf2babe61631ec81a9dc166c2db9dcbf9747e60100a78e934483605b94ee5303adbe619ac0ae380579a759013
6
+ metadata.gz: 5976e535235d22d15b75caa3c85b9788ee50fac4a9af65e61ac1fbeb032e649eb86d6c7708453ea5477888d0e2641dfc005a87edb120bfd7c3695be2c4467bfb
7
+ data.tar.gz: c8ad2ec20f502a458bd12cf5f4fdf797e55092ae2b0f6e878b05201804edecf4c5956e8eef4d6220821c9c46a1ef37c1f415981039ddcdbd31464c0af37d0f16
@@ -47,9 +47,9 @@ module Lita
47
47
  reply += "#{datum[:name]} "
48
48
  # reply += "- #{datum[:desc]}, "
49
49
  # reply += "Served in a #{datum[1]['glass']} glass. "
50
- # reply += "#{get_display_prices datum[:prices]}, "
51
50
  # reply += "#{datum[:remaining]}"
52
- reply += "#{datum[:abv]}%"
51
+ reply += "#{datum[:abv]}%, "
52
+ reply += "$#{datum[:price].to_s.sub '.0', ''}"
53
53
 
54
54
  Lita.logger.info "send_response: Replying with #{reply}"
55
55
 
@@ -92,7 +92,11 @@ module Lita
92
92
  # beer_desc = get_beer_desc(beer_node)
93
93
  abv = beer_node.css('td')[4].children.to_s
94
94
  full_text_search = "#{brewery} #{beer_name.to_s.gsub /(\d+|')/, ''}" # #{beer_desc.to_s.gsub /\d+\.*\d*%*/, ''}
95
- # prices = get_prices(beer_node)
95
+ price_node = beer_node.css('td')[1].children.to_s
96
+ price = (price_node.sub /\$/, '').to_f
97
+
98
+ Lita.logger.debug "Price #{price}"
99
+
96
100
  gimme_what_you_got[tap_name] = {
97
101
  # type: tap_type,
98
102
  # remaining: remaining,
@@ -100,7 +104,7 @@ module Lita
100
104
  name: beer_name.to_s,
101
105
  desc: beer_type.to_s,
102
106
  abv: abv.to_f,
103
- # prices: prices,
107
+ price: price,
104
108
  search: full_text_search
105
109
  }
106
110
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'lita-onewheel-apex-bar'
3
- spec.version = '0.1.0'
3
+ spec.version = '0.2.0'
4
4
  spec.authors = ['Andrew Kreps']
5
5
  spec.email = ['andrew.kreps@gmail.com']
6
6
  spec.description = %q{Lita interface to Apex Bar's listings.}
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.add_runtime_dependency 'rest-client', '~> 1.8'
19
19
  spec.add_runtime_dependency 'nokogiri', '~> 1.6'
20
20
  spec.add_runtime_dependency 'sanitize', '~> 4.0'
21
- spec.add_runtime_dependency 'lita-onewheel-beer-base', '~> 1'
21
+ spec.add_runtime_dependency 'lita-onewheel-beer-base', '~> 2'
22
22
 
23
23
  spec.add_development_dependency 'bundler', '~> 1.3'
24
24
 
@@ -28,23 +28,23 @@ describe Lita::Handlers::OnewheelApexBar, lita_handler: true do
28
28
 
29
29
  it 'displays details for tap 4' do
30
30
  send_command 'apex 4'
31
- expect(replies.last).to eq('Apex tap 4) Blind Pig - IPA 6.1%')
31
+ expect(replies.last).to eq('Apex tap 4) Blind Pig - IPA 6.1%, $6')
32
32
  end
33
33
 
34
34
  it 'doesn\'t explode on 1' do
35
35
  send_command 'apex 1'
36
36
  expect(replies.count).to eq(1)
37
- expect(replies.last).to eq('Apex tap 1) Aktien Helles Lager 5.3%')
37
+ expect(replies.last).to eq('Apex tap 1) Aktien Helles Lager 5.3%, $5')
38
38
  end
39
39
 
40
40
  it 'gets nitro' do
41
41
  send_command 'apex nitro'
42
- expect(replies.last).to eq('Apex tap 30) Nitro- Stout 4.1%')
42
+ expect(replies.last).to eq('Apex tap 30) Nitro- Stout 4.1%, $4')
43
43
  end
44
44
 
45
45
  it 'searches for ipa' do
46
46
  send_command 'apex ipa'
47
- expect(replies.last).to eq('Apex tap 50) WFO - IPA 7.5%')
47
+ expect(replies.last).to eq('Apex tap 50) WFO - IPA 7.5%, $5')
48
48
  end
49
49
 
50
50
  # it 'searches for brown' do
@@ -55,123 +55,101 @@ describe Lita::Handlers::OnewheelApexBar, lita_handler: true do
55
55
  it 'searches for abv >9%' do
56
56
  send_command 'apex >9%'
57
57
  expect(replies.count).to eq(8)
58
- 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")
59
- expect(replies[1]).to eq("Bailey's tap 9) Hopworks Noggin’ Floggin’ - Barleywine 11.0%, 4oz - $3 | 12oz - $6 | 32oz Crowler - $13, 34% remaining")
60
- expect(replies[2]).to eq("Bailey's tap 18) Knee Deep Hop Surplus - Triple IPA 10.0%, 4oz - $2 | 12oz - $4 | 32oz Crowler - $10, 25% remaining")
61
- expect(replies[3]).to eq("Bailey's tap 20) Knee Deep Dark Horse - Imperial Stout 12.0%, 4oz - $2 | 12oz - $4 | 32oz Crowler - $10, 39% remaining")
58
+ expect(replies[0]).to eq('Apex tap 2) Armored Fist - Big,Black&Hoppy 10.0%, $5')
59
+ expect(replies[1]).to eq('Apex tap 3) Barrel Aged Old Thunderpussy 10.8%, $5')
60
+ expect(replies.last).to eq('Apex tap 46) Sump - Imp Coffee Stout 10.5%, $5')
62
61
  end
63
62
 
64
63
  it 'searches for abv > 9%' do
65
64
  send_command 'apex > 9%'
66
- expect(replies.count).to eq(4)
67
- 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")
68
- expect(replies[1]).to eq("Bailey's tap 9) Hopworks Noggin’ Floggin’ - Barleywine 11.0%, 4oz - $3 | 12oz - $6 | 32oz Crowler - $13, 34% remaining")
69
- expect(replies[2]).to eq("Bailey's tap 18) Knee Deep Hop Surplus - Triple IPA 10.0%, 4oz - $2 | 12oz - $4 | 32oz Crowler - $10, 25% remaining")
70
- expect(replies[3]).to eq("Bailey's tap 20) Knee Deep Dark Horse - Imperial Stout 12.0%, 4oz - $2 | 12oz - $4 | 32oz Crowler - $10, 39% remaining")
65
+ expect(replies.count).to eq(8)
66
+ expect(replies[0]).to eq('Apex tap 2) Armored Fist - Big,Black&Hoppy 10.0%, $5')
67
+ expect(replies[1]).to eq('Apex tap 3) Barrel Aged Old Thunderpussy 10.8%, $5')
68
+ expect(replies.last).to eq('Apex tap 46) Sump - Imp Coffee Stout 10.5%, $5')
71
69
  end
72
70
 
73
71
  it 'searches for abv >= 9%' do
74
72
  send_command 'apex >= 9%'
75
- expect(replies.count).to eq(5)
76
- 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")
77
- expect(replies[1]).to eq("Bailey's tap 9) Hopworks Noggin’ Floggin’ - Barleywine 11.0%, 4oz - $3 | 12oz - $6 | 32oz Crowler - $13, 34% remaining")
78
- expect(replies[2]).to eq("Bailey's tap 18) Knee Deep Hop Surplus - Triple IPA 10.0%, 4oz - $2 | 12oz - $4 | 32oz Crowler - $10, 25% remaining")
79
- expect(replies[3]).to eq("Bailey's tap 20) Knee Deep Dark Horse - Imperial Stout 12.0%, 4oz - $2 | 12oz - $4 | 32oz Crowler - $10, 39% remaining")
80
- expect(replies.last).to eq("Bailey's tap 24) Oakshire Perfect Storm - Imperial IPA 9.0%, 10oz - $4 | 20oz - $6 | 32oz Crowler - $10, 61% remaining")
73
+ expect(replies.count).to eq(10)
74
+ expect(replies[0]).to eq('Apex tap 2) Armored Fist - Big,Black&Hoppy 10.0%, $5')
75
+ expect(replies.last).to eq('Apex tap 46) Sump - Imp Coffee Stout 10.5%, $5')
81
76
  end
82
77
 
83
78
  it 'searches for abv <4.1%' do
84
79
  send_command 'apex <4.1%'
85
80
  expect(replies.count).to eq(2)
86
- expect(replies[0]).to eq("Bailey's tap 3) (Cask) Machine House Crystal Maze - ESB 4.0%, 10oz - $3 | 20oz - $5, 57% remaining")
87
- expect(replies.last).to eq("Bailey's tap 11) Lagunitas Copper Fusion Ale - Copper Ale 4.0%, 10oz - $3 | 20oz - $5 | 32oz Crowler - $8, 19% remaining")
88
- end
89
-
90
- it 'searches for abv < 4.1%' do
91
- send_command 'apex < 4.1%'
92
- expect(replies.count).to eq(2)
93
- expect(replies[0]).to eq("Bailey's tap 3) (Cask) Machine House Crystal Maze - ESB 4.0%, 10oz - $3 | 20oz - $5, 57% remaining")
94
- expect(replies.last).to eq("Bailey's tap 11) Lagunitas Copper Fusion Ale - Copper Ale 4.0%, 10oz - $3 | 20oz - $5 | 32oz Crowler - $8, 19% remaining")
81
+ expect(replies[0]).to eq('Apex tap 15) Grapefruit Radler 2.5%, $5')
82
+ expect(replies.last).to eq('Apex tap 38) Prairie-Vous Francais - Saison   Just Tapped 3.9%, $5')
95
83
  end
96
84
 
97
85
  it 'searches for abv <= 4%' do
98
86
  send_command 'apex <= 4%'
99
87
  expect(replies.count).to eq(2)
100
- expect(replies[0]).to eq("Bailey's tap 3) (Cask) Machine House Crystal Maze - ESB 4.0%, 10oz - $3 | 20oz - $5, 57% remaining")
101
- expect(replies.last).to eq("Bailey's tap 11) Lagunitas Copper Fusion Ale - Copper Ale 4.0%, 10oz - $3 | 20oz - $5 | 32oz Crowler - $8, 19% remaining")
88
+ expect(replies[0]).to eq('Apex tap 15) Grapefruit Radler 2.5%, $5')
89
+ expect(replies.last).to eq('Apex tap 38) Prairie-Vous Francais - Saison   Just Tapped 3.9%, $5')
102
90
  end
103
91
 
104
- it 'searches for prices >$6' do
105
- send_command 'apex >$6'
106
- expect(replies.count).to eq(2)
107
- expect(replies[0]).to eq("Bailey's tap 1) Cider Riot! Plastic Paddy - Apple Cider w/ Irish tea 6.0%, 10oz - $4 | 20oz - $7 | 32oz Crowler - $10, 48% remaining")
108
- expect(replies[1]).to eq("Bailey's tap 4) Wild Ride Solidarity - Abbey Dubbel – Barrel Aged (Pinot Noir) 8.2%, 4oz - $4 | 12oz - $7, 26% remaining")
92
+ it 'searches for prices >$5' do
93
+ send_command 'apex >$5'
94
+ expect(replies.count).to eq(11)
95
+ expect(replies[0]).to eq('Apex tap 4) Blind Pig - IPA 6.1%, $6')
96
+ expect(replies[1]).to eq('Apex tap 21) Kristallweissbier 5.4%, $6')
109
97
  end
110
98
 
111
99
  it 'searches for prices >=$6' do
112
100
  send_command 'apex >=$6'
113
- expect(replies.count).to eq(4)
114
- expect(replies[0]).to eq("Bailey's tap 1) Cider Riot! Plastic Paddy - Apple Cider w/ Irish tea 6.0%, 10oz - $4 | 20oz - $7 | 32oz Crowler - $10, 48% remaining")
115
- expect(replies[1]).to eq("Bailey's tap 4) Wild Ride Solidarity - Abbey Dubbel – Barrel Aged (Pinot Noir) 8.2%, 4oz - $4 | 12oz - $7, 26% remaining")
116
- expect(replies[2]).to eq("Bailey's tap 9) Hopworks Noggin’ Floggin’ - Barleywine 11.0%, 4oz - $3 | 12oz - $6 | 32oz Crowler - $13, 34% remaining")
117
- expect(replies[3]).to eq("Bailey's tap 24) Oakshire Perfect Storm - Imperial IPA 9.0%, 10oz - $4 | 20oz - $6 | 32oz Crowler - $10, 61% remaining")
101
+ expect(replies.count).to eq(11)
102
+ expect(replies[0]).to eq('Apex tap 4) Blind Pig - IPA 6.1%, $6')
118
103
  end
119
104
 
120
105
  it 'searches for prices > $6' do
121
106
  send_command 'apex > $6'
122
- expect(replies.count).to eq(2)
123
- expect(replies[0]).to eq("Bailey's tap 1) Cider Riot! Plastic Paddy - Apple Cider w/ Irish tea 6.0%, 10oz - $4 | 20oz - $7 | 32oz Crowler - $10, 48% remaining")
124
- expect(replies[1]).to eq("Bailey's tap 4) Wild Ride Solidarity - Abbey Dubbel – Barrel Aged (Pinot Noir) 8.2%, 4oz - $4 | 12oz - $7, 26% remaining")
107
+ expect(replies.count).to eq(3)
108
+ expect(replies[0]).to eq('Apex tap 29) Nitro- Shake - Choco Porter 5.9%, $8')
125
109
  end
126
110
 
127
111
  it 'searches for prices <$4.1' do
128
112
  send_command 'apex <$4.1'
129
- expect(replies.count).to eq(3)
130
- 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")
131
- 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")
132
- 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")
113
+ expect(replies.count).to eq(4)
114
+ expect(replies[0]).to eq('Apex tap 8) Cheap, cold 4.7%, $3')
133
115
  end
134
116
 
135
117
  it 'searches for prices < $4.01' do
136
118
  send_command 'apex < $4.01'
137
- expect(replies.count).to eq(3)
138
- 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")
139
- 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")
140
- 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")
119
+ expect(replies.count).to eq(4)
120
+ expect(replies[0]).to eq('Apex tap 8) Cheap, cold 4.7%, $3')
141
121
  end
142
122
 
143
123
  it 'searches for prices <= $4.00' do
144
124
  send_command 'apex <= $4.00'
145
- expect(replies.count).to eq(3)
146
- 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")
147
- 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")
148
- 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")
125
+ expect(replies.count).to eq(4)
126
+ expect(replies[0]).to eq('Apex tap 8) Cheap, cold 4.7%, $3')
149
127
  end
150
128
 
151
129
  it 'runs a random beer through' do
152
130
  send_command 'apex roulette'
153
131
  expect(replies.count).to eq(1)
154
- expect(replies.last).to include("Bailey's tap")
132
+ expect(replies.last).to include('Apex tap')
155
133
  end
156
134
 
157
135
  it 'runs a random beer through' do
158
136
  send_command 'apex random'
159
137
  expect(replies.count).to eq(1)
160
- expect(replies.last).to include("Bailey's tap")
138
+ expect(replies.last).to include('Apex tap')
161
139
  end
162
140
 
163
141
  it 'searches with a space' do
164
- send_command 'apex zeus juice'
165
- expect(replies.last).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")
142
+ send_command 'apex cider riot'
143
+ expect(replies.last).to eq('Apex tap 10) Cider- NeverGiveAnInch -Rosé 6.9%, $5')
166
144
  end
167
145
 
168
146
  it 'displays low abv' do
169
147
  send_command 'apexabvhigh'
170
- 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")
148
+ expect(replies.last).to eq('Apex tap 31) Notorious - IIIPA 11.5%, $5')
171
149
  end
172
150
 
173
151
  it 'displays high abv' do
174
152
  send_command 'apexabvlow'
175
- expect(replies.last).to eq("Bailey's tap 3) (Cask) Machine House Crystal Maze - ESB 4.0%, 10oz - $3 | 20oz - $5, 57% remaining")
153
+ expect(replies.last).to eq('Apex tap 15) Grapefruit Radler 2.5%, $5')
176
154
  end
177
155
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-onewheel-apex-bar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kreps
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '1'
75
+ version: '2'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '1'
82
+ version: '2'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: bundler
85
85
  requirement: !ruby/object:Gem::Requirement