Skip to content

Commit

Permalink
Added brewery + ibu fix
Browse files Browse the repository at this point in the history
  • Loading branch information
onewheelskyward committed Apr 12, 2017
1 parent 811c84d commit befb0ff
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions lib/lita/handlers/onewheel_beer_abvpub.rb
Expand Up @@ -45,7 +45,7 @@ def send_response(tap, datum, response)
reply = "Abvpub tap #{tap}) #{get_tap_type_text(datum[:type])}"
# reply += "#{datum[:brewery]} "
reply += "#{datum[:name]} "
reply += "- #{datum[:desc]}, "
reply += "- #{datum[:desc]}, " if datum[:desc]
# reply += "Served in a #{datum[1]['glass']} glass. "
# reply += "#{datum[:remaining]}"
reply += "#{datum[:abv]}%"
Expand Down Expand Up @@ -93,21 +93,21 @@ def parse_response(response)
abv.sub! /\%/, ''
end

ibu_node = /IBU \d+/.match(beer_node.css('span.abvABV').text)
ibu_node = /IBU: \d+/.match(beer_node.css('span.abvABV').text)
if ibu_node
ibu = ibu_node[0]
ibu.sub! /IBU /, ''
end

full_text_search = "#{brewery} #{beer_name.to_s.gsub /(\d+|')/, ''}" # #{beer_desc.to_s.gsub /\d+\.*\d*%*/, ''}
full_text_search = "#{brewery} #{beer_name.to_s.gsub /(\d+|')/, ''} #{beer_type}" # #{beer_desc.to_s.gsub /\d+\.*\d*%*/, ''}

# price_node = beer_node.css('td')[1].children.to_s
# price = (price_node.sub /\$/, '').to_f

gimme_what_you_got[tap_name] = {
# type: tap_type,
# remaining: remaining,
# brewery: brewery.to_s,
brewery: brewery.to_s,
name: beer_name.to_s,
abv: abv.to_f,
ibu: ibu.to_i,
Expand Down
2 changes: 1 addition & 1 deletion lita-onewheel-beer-abvpub.gemspec
@@ -1,6 +1,6 @@
Gem::Specification.new do |spec|
spec.name = 'lita-onewheel-beer-abvpub'
spec.version = '0.0.0'
spec.version = '0.0.1'
spec.authors = ['Andrew Kreps']
spec.email = ['andrew.kreps@gmail.com']
spec.description = %q{Lita interface to ABVPub's Barlistings.}
Expand Down
2 changes: 1 addition & 1 deletion spec/lita/handlers/onewheel_beer_abvpub_spec.rb
Expand Up @@ -23,7 +23,7 @@

it 'shows the taps' do
send_command 'abvpub'
expect(replies.last).to include('taps: 1) Pinot Gris 2) Apis')
expect(replies.last).to include('taps: 1) Persnickety Pinot Gris 2) Nectar Creek Apis')
end

it 'displays details for tap 4' do
Expand Down

0 comments on commit befb0ff

Please sign in to comment.