lita-onewheel-baileys 3.0.0 → 3.1.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: f5c55180908443a45a44ddb871d851f02e17024f
4
- data.tar.gz: 9b47445d6eeb64b0d93b00816e038beaca726be7
3
+ metadata.gz: d34d1d5d4fa37fa1630b87dc212ab62224c06c42
4
+ data.tar.gz: 1fdb5b6842ae02bda3ca748c9a772a2c874e4938
5
5
  SHA512:
6
- metadata.gz: 9f950435d66827c36660f97bda8d28007d9e56e80f2a24abf1f64c4d9f0706d1a7e124cdfe6869c5d6103c3355c853dd0cc6dcfc13eeab6213833b311315fbe2
7
- data.tar.gz: b814d0dd96ed8feda1daacad13c7c5b01421776e5e91dfca3a6def3631cda77174b18dc94a705afc68a034fc9e1ea349ddfa0ff3f4fcbb714d22fac78c07f2e5
6
+ metadata.gz: 572cd0047aeb1e8ec7fceb582cc3529e3ba4926bda1e7f2d2c29764c24cee84752674651c5351211f211651d1eba90570ff5573946e35e996255155862e2f6a9
7
+ data.tar.gz: 8813d374795a453d62694b51826d31224fef4b0b82f11bd5fc7f1188840b50cea053cd60856a35400aecb4dcb97f76aa2828f64558ce907c23eff089a1b6eccd
@@ -74,18 +74,19 @@ module Lita
74
74
  def taps_by_price(response)
75
75
  beers = get_baileys
76
76
  beers.each do |tap, datum|
77
- if datum[:abv].to_f == 0.0
78
- next
79
- end
77
+ # if datum[:prices][1][:cost].to_f == 0.0
78
+ # next
79
+ # end
80
+
80
81
  query = response.matches[0][0].strip
81
82
  # Search directly by tap number OR full text match.
82
- if (abv_matches = query.match(/([><])(\d+\.*\d*)/))
83
- direction = abv_matches.to_s.match(/[<>]/).to_s
84
- abv_requested = abv_matches.to_s.match(/\d+.*\d*/).to_s
85
- if direction == '>' and datum[:abv].to_f >= abv_requested.to_f
83
+ if (price_matches = query.match(/([><])\$(\d+\.*\d*)/))
84
+ direction = price_matches.to_s.match(/[<>]/).to_s
85
+ price_requested = price_matches.to_s.match(/\d+.*\d*/).to_s
86
+ if direction == '>' and datum[:prices][1][:cost].to_f >= price_requested.to_f
86
87
  send_response(tap, datum, response)
87
88
  end
88
- if direction == '<' and datum[:abv].to_f <= abv_requested.to_f
89
+ if direction == '<' and datum[:prices][1][:cost].to_f <= price_requested.to_f
89
90
  send_response(tap, datum, response)
90
91
  end
91
92
  end
@@ -106,7 +107,7 @@ module Lita
106
107
  def get_display_prices(prices)
107
108
  price_array = []
108
109
  prices.each do |p|
109
- price_array.push "#{p[:size]} - #{p[:cost]}"
110
+ price_array.push "#{p[:size]} - $#{p[:cost]}"
110
111
  end
111
112
  price_array.join ' | '
112
113
  end
@@ -186,7 +187,7 @@ module Lita
186
187
  prices_array = []
187
188
  price_points.each do |price|
188
189
  size = price.match /\d+(oz|cl)/
189
- dollars = price.match /\$\d+\.*\d*/
190
+ dollars = price.match(/\$\d+\.*\d*/).to_s.sub('$', '')
190
191
  crowler = price.match ' Crowler'
191
192
  size = size.to_s + crowler.to_s
192
193
  p = {size: size, cost: dollars}
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'lita-onewheel-baileys'
3
- spec.version = '3.0.0'
3
+ spec.version = '3.1.0'
4
4
  spec.authors = ['Andrew Kreps']
5
5
  spec.email = ['andrew.kreps@gmail.com']
6
6
  spec.description = %q{Lita interface to Bailey's Taproom listings.}
@@ -64,16 +64,18 @@ describe Lita::Handlers::OnewheelBaileys, lita_handler: true do
64
64
 
65
65
  it 'searches for prices > $6' do
66
66
  send_command 'taps >$6'
67
- # expect(replies.count).to eq(3)
68
- expect(replies[0]).to eq("")
69
- expect(replies[1]).to eq("")
70
- expect(replies.last).to eq("")
67
+ expect(replies.count).to eq(4)
68
+ 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")
69
+ 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")
70
+ expect(replies[2]).to eq("Bailey's tap 9) Hopworks Noggin’ Floggin’ - Barleywine 11.0%, 4oz - $3 | 12oz - $6 | 32oz Crowler - $13, 34% remaining")
71
+ 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")
71
72
  end
72
73
 
73
74
  it 'searches for prices < $4' do
74
75
  send_command 'taps <$4'
75
- # expect(replies.count).to eq(2)
76
- expect(replies[0]).to eq("Bailey's tap Cask 3) Machine House Crystal Maze - ESB 4.0%, 10oz $3 | 20oz $5, 57% remaining")
77
- 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")
76
+ expect(replies.count).to eq(3)
77
+ 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")
78
+ 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")
79
+ 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")
78
80
  end
79
81
  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.0.0
4
+ version: 3.1.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-03-22 00:00:00.000000000 Z
11
+ date: 2016-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lita