lita-onewheel-beer-upperlip 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 +19 -0
- data/.travis.yml +15 -0
- data/Gemfile +6 -0
- data/README.md +31 -0
- data/Rakefile +6 -0
- data/lib/lita/handlers/onewheel_beer_upperlip.rb +152 -0
- data/lib/lita-onewheel-beer-upperlip.rb +12 -0
- data/lita-onewheel-beer-upperlip.gemspec +31 -0
- data/spec/fixtures/upperlip.html +166 -0
- data/spec/lita/handlers/onewheel_beer_upperlip_spec.rb +28 -0
- data/spec/spec_helper.rb +14 -0
- metadata +213 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e26cafc7cc2f72180d5c844ab53bad27708089f6
|
4
|
+
data.tar.gz: b5df75fd1ee49b9db75484d02137611a7b67051e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7deb347f5e0045012a6ea0da4f5dc5c5a62eb74e85279c47fcbdb6284cbcab7820250f66888bac54afccaf03426ac76077e1a1e126cf16ffb6fdd4526f6a603c
|
7
|
+
data.tar.gz: d1b87bab5f5668243362069d5b0f37030f96dad04683db4deea6a0785319cbedf272ca56269d29339e4c4e8469740d9aefcacab6e0e89cfae20db5daf484029f
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
language: ruby
|
2
|
+
|
3
|
+
rvm:
|
4
|
+
- 2.3.1
|
5
|
+
|
6
|
+
script: bundle exec rspec -fp spec
|
7
|
+
|
8
|
+
# Travis CI has an outdated version of bundler on older versions of ruby.
|
9
|
+
# See bundler/bundler#3558 for more information
|
10
|
+
#before_install:
|
11
|
+
# - gem update --system
|
12
|
+
# - gem update bundler
|
13
|
+
|
14
|
+
services:
|
15
|
+
- redis-server
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# lita-onewheel-beer-upperlip
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/onewheelskyward/lita-onewheel-beer-upperlip.png?branch=master)](https://travis-ci.org/onewheelskyward/lita-onewheel-beer-upperlip)
|
4
|
+
[![Coverage Status](https://coveralls.io/repos/onewheelskyward/lita-onewheel-beer-upperlip/badge.png)](https://coveralls.io/r/onewheelskyward/lita-onewheel-beer-upperlip)
|
5
|
+
|
6
|
+
Searches Bailey's Taproom draft list for data and displays it in IRC.
|
7
|
+
|
8
|
+
http://theupperlip.net/draft/
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Add lita-onewheel-beer-upperlip to your Lita instance's Gemfile:
|
13
|
+
|
14
|
+
``` ruby
|
15
|
+
gem 'lita-onewheel-beer-upperlip'
|
16
|
+
```
|
17
|
+
|
18
|
+
## Usage
|
19
|
+
|
20
|
+
upperlip
|
21
|
+
|
22
|
+
upperlip 4
|
23
|
+
|
24
|
+
upperlip nitro
|
25
|
+
|
26
|
+
upperlip >(=)5%
|
27
|
+
|
28
|
+
upperlip <(=)$5
|
29
|
+
|
30
|
+
upperlip roulette|random
|
31
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,152 @@
|
|
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 OnewheelBeerUpperlip < OnewheelBeerBase
|
9
|
+
route /^upperlip$/i,
|
10
|
+
:upperlip_list,
|
11
|
+
command: true,
|
12
|
+
help: {'upperlip' => 'Display the current taps.'}
|
13
|
+
|
14
|
+
route /^upperlip ([\w ]+)$/i,
|
15
|
+
:taps_deets,
|
16
|
+
command: true,
|
17
|
+
help: {'upperlip 4' => 'Display the tap 4 deets.'}
|
18
|
+
|
19
|
+
route /^upperlip ([<>=\w.\s]+)%$/i,
|
20
|
+
:upperlip_by_abv,
|
21
|
+
command: true,
|
22
|
+
help: {'upperlip >4%' => 'Display beers over 4% ABV.'}
|
23
|
+
|
24
|
+
route /^upperlip (roulette|random)$/i,
|
25
|
+
:upperlip_by_random,
|
26
|
+
command: true,
|
27
|
+
help: {'upperlip roulette' => 'Can\'t decide? Let me do it for you!'}
|
28
|
+
|
29
|
+
route /^upperliplow$/i,
|
30
|
+
:upperlip_by_remaining,
|
31
|
+
command: true,
|
32
|
+
help: {'upperliplow' => 'Show me the kegs at <10% remaining, or the lowest one available.'}
|
33
|
+
|
34
|
+
route /^upperlipabvlow$/i,
|
35
|
+
:upperlip_low_abv,
|
36
|
+
command: true,
|
37
|
+
help: {'upperlipabvlow' => 'Show me the lowest abv keg.'}
|
38
|
+
|
39
|
+
route /^upperlipabvhigh$/i,
|
40
|
+
:upperlip_high_abv,
|
41
|
+
command: true,
|
42
|
+
help: {'upperlipabvhigh' => 'Show me the highest abv keg.'}
|
43
|
+
|
44
|
+
def upperlip_list(response)
|
45
|
+
# wakka wakka
|
46
|
+
beers = self.get_source
|
47
|
+
reply = "Bailey's Upperlip tap: "
|
48
|
+
beers.each do |tap, datum|
|
49
|
+
reply += "#{tap}) "
|
50
|
+
reply += get_tap_type_text(datum[:type])
|
51
|
+
reply += datum[:brewery].to_s + ' '
|
52
|
+
reply += (datum[:name].to_s.empty?)? '' : datum[:name].to_s + ' '
|
53
|
+
end
|
54
|
+
reply = reply.strip.sub /,\s*$/, ''
|
55
|
+
|
56
|
+
Lita.logger.info "Replying with #{reply}"
|
57
|
+
response.reply reply
|
58
|
+
end
|
59
|
+
|
60
|
+
def send_response(tap, datum, response)
|
61
|
+
reply = "Bailey's Upperlip tap #{tap}) #{get_tap_type_text(datum[:type])}"
|
62
|
+
reply += "#{datum[:brewery]} "
|
63
|
+
reply += "#{datum[:name]} "
|
64
|
+
reply += "- #{datum[:desc]}, "
|
65
|
+
# reply += "Served in a #{datum[1]['glass']} glass. "
|
66
|
+
reply += "#{datum[:remaining]}"
|
67
|
+
|
68
|
+
Lita.logger.info "send_response: Replying with #{reply}"
|
69
|
+
|
70
|
+
response.reply reply
|
71
|
+
end
|
72
|
+
|
73
|
+
def get_source
|
74
|
+
# https://visualizeapi.com/api/upperlip
|
75
|
+
Lita.logger.debug "get_source started"
|
76
|
+
unless (response = redis.get('page_response'))
|
77
|
+
Lita.logger.info 'No cached result found, fetching.'
|
78
|
+
response = RestClient.get('http://theupperlip.net/draft/')
|
79
|
+
redis.setex('page_response', 1800, response)
|
80
|
+
end
|
81
|
+
# response.gsub! '<div id="responsecontainer"">', ''
|
82
|
+
parse_response response
|
83
|
+
end
|
84
|
+
|
85
|
+
# This is the worker bee- decoding the html into our "standard" document.
|
86
|
+
# Future implementations could simply override this implementation-specific
|
87
|
+
# code to help this grow more widely.
|
88
|
+
def parse_response(response)
|
89
|
+
Lita.logger.debug "parse_response started."
|
90
|
+
gimme_what_you_got = {}
|
91
|
+
noko = Nokogiri.HTML response
|
92
|
+
tap = 0
|
93
|
+
noko.css('div#boxfielddata').each do |beer_node|
|
94
|
+
# gimme_what_you_got
|
95
|
+
tap = tap + 1
|
96
|
+
tap_name = get_tap_name(beer_node)
|
97
|
+
|
98
|
+
remaining = beer_node.attributes['title'].to_s
|
99
|
+
|
100
|
+
brewery = get_brewery(beer_node)
|
101
|
+
beer_name = beer_node.css('span i').first.children.to_s
|
102
|
+
beer_desc = get_beer_desc(beer_node)
|
103
|
+
abv = get_abv(beer_desc)
|
104
|
+
full_text_search = "#{brewery} #{beer_name} #{beer_desc.to_s.gsub /\d+\.*\d*%*/, ''}"
|
105
|
+
|
106
|
+
gimme_what_you_got[tap] = {
|
107
|
+
remaining: remaining,
|
108
|
+
brewery: brewery.to_s,
|
109
|
+
name: beer_name.to_s,
|
110
|
+
desc: beer_desc.to_s,
|
111
|
+
abv: abv.to_f,
|
112
|
+
search: full_text_search
|
113
|
+
}
|
114
|
+
end
|
115
|
+
gimme_what_you_got
|
116
|
+
end
|
117
|
+
|
118
|
+
def get_abv(beer_desc)
|
119
|
+
if (abv_matches = beer_desc.match(/\d+\.\d+%/))
|
120
|
+
abv_matches.to_s.sub '%', ''
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
# Return the desc of the beer, "Amber ale 6.9%"
|
125
|
+
def get_beer_desc(noko)
|
126
|
+
beer_desc = ''
|
127
|
+
if (beer_desc_matchdata = noko.to_s.gsub(/\n/, '').match(/(<br\s*\/*>)(.+%) /))
|
128
|
+
beer_desc = beer_desc_matchdata[2].gsub(/\s+/, ' ').strip
|
129
|
+
end
|
130
|
+
beer_desc
|
131
|
+
end
|
132
|
+
|
133
|
+
# Get the brewery from the node, return it or blank.
|
134
|
+
def get_brewery(noko)
|
135
|
+
brewery = ''
|
136
|
+
if (node = noko.css('span a').first)
|
137
|
+
brewery = node.children.to_s.gsub(/\n/, '')
|
138
|
+
brewery.gsub! /RBBA/, ''
|
139
|
+
brewery.strip!
|
140
|
+
end
|
141
|
+
brewery
|
142
|
+
end
|
143
|
+
|
144
|
+
# Returns 1, 2, Cask 3, Nitro 4...
|
145
|
+
def get_tap_name(noko)
|
146
|
+
noko.css('span').first.children.to_s
|
147
|
+
end
|
148
|
+
|
149
|
+
Lita.register_handler(self)
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
@@ -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_upperlip'
|
8
|
+
|
9
|
+
Lita::Handlers::OnewheelBeerUpperlip.template_root File.expand_path(
|
10
|
+
File.join('..', '..', 'templates'),
|
11
|
+
__FILE__
|
12
|
+
)
|
@@ -0,0 +1,31 @@
|
|
1
|
+
Gem::Specification.new do |spec|
|
2
|
+
spec.name = 'lita-onewheel-beer-upperlip'
|
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 Bailey's Upperlip Taproom listings.}
|
7
|
+
spec.summary = %q{See above.}
|
8
|
+
spec.homepage = 'https://github.com/onewheelskyward/lita-onewheel-beer-upperlip'
|
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'
|
18
|
+
spec.add_runtime_dependency 'rest-client', '~> 1.8'
|
19
|
+
spec.add_runtime_dependency 'nokogiri', '~> 1.6'
|
20
|
+
spec.add_runtime_dependency 'sanitize', '~> 4.0'
|
21
|
+
spec.add_runtime_dependency 'lita-onewheel-beer-base', '~> 2'
|
22
|
+
|
23
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
24
|
+
|
25
|
+
# spec.add_development_dependency 'pry-byebug', '~> 3.1'
|
26
|
+
spec.add_development_dependency 'rake', '~> 10.4'
|
27
|
+
spec.add_development_dependency 'rack-test', '~> 0.6'
|
28
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
29
|
+
spec.add_development_dependency 'simplecov', '~> 0.10'
|
30
|
+
spec.add_development_dependency 'coveralls', '~> 0.8'
|
31
|
+
end
|
@@ -0,0 +1,166 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<!--[if IE 8]>
|
3
|
+
<html class="ie8" lang="en-US">
|
4
|
+
<![endif]-->
|
5
|
+
<!--[if !(IE 8) ]><!-->
|
6
|
+
<html lang="en-US">
|
7
|
+
<!--<![endif]-->
|
8
|
+
<head>
|
9
|
+
<meta charset="UTF-8">
|
10
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
11
|
+
<title>Draft | The Upper Lip</title>
|
12
|
+
<link rel="profile" href="http://gmpg.org/xfn/11">
|
13
|
+
<link rel="pingback" href="http://theupperlip.net/xmlrpc.php">
|
14
|
+
<link rel="alternate" type="application/rss+xml" title="The Upper Lip » Feed" href="http://theupperlip.net/feed/" />
|
15
|
+
<link rel="alternate" type="application/rss+xml" title="The Upper Lip » Comments Feed" href="http://theupperlip.net/comments/feed/" />
|
16
|
+
<script type="text/javascript">
|
17
|
+
window._wpemojiSettings = {"baseUrl":"https:\/\/s.w.org\/images\/core\/emoji\/72x72\/","ext":".png","source":{"concatemoji":"http:\/\/theupperlip.net\/wp-includes\/js\/wp-emoji-release.min.js?ver=4.4.5"}};
|
18
|
+
!function(a,b,c){function d(a){var c,d,e,f=b.createElement("canvas"),g=f.getContext&&f.getContext("2d"),h=String.fromCharCode;return g&&g.fillText?(g.textBaseline="top",g.font="600 32px Arial","flag"===a?(g.fillText(h(55356,56806,55356,56826),0,0),f.toDataURL().length>3e3):"diversity"===a?(g.fillText(h(55356,57221),0,0),c=g.getImageData(16,16,1,1).data,g.fillText(h(55356,57221,55356,57343),0,0),c=g.getImageData(16,16,1,1).data,e=c[0]+","+c[1]+","+c[2]+","+c[3],d!==e):("simple"===a?g.fillText(h(55357,56835),0,0):g.fillText(h(55356,57135),0,0),0!==g.getImageData(16,16,1,1).data[0])):!1}function e(a){var c=b.createElement("script");c.src=a,c.type="text/javascript",b.getElementsByTagName("head")[0].appendChild(c)}var f,g;c.supports={simple:d("simple"),flag:d("flag"),unicode8:d("unicode8"),diversity:d("diversity")},c.DOMReady=!1,c.readyCallback=function(){c.DOMReady=!0},c.supports.simple&&c.supports.flag&&c.supports.unicode8&&c.supports.diversity||(g=function(){c.readyCallback()},b.addEventListener?(b.addEventListener("DOMContentLoaded",g,!1),a.addEventListener("load",g,!1)):(a.attachEvent("onload",g),b.attachEvent("onreadystatechange",function(){"complete"===b.readyState&&c.readyCallback()})),f=c.source||{},f.concatemoji?e(f.concatemoji):f.wpemoji&&f.twemoji&&(e(f.twemoji),e(f.wpemoji)))}(window,document,window._wpemojiSettings);
|
19
|
+
</script>
|
20
|
+
<style type="text/css">
|
21
|
+
img.wp-smiley,
|
22
|
+
img.emoji {
|
23
|
+
display: inline !important;
|
24
|
+
border: none !important;
|
25
|
+
box-shadow: none !important;
|
26
|
+
height: 1em !important;
|
27
|
+
width: 1em !important;
|
28
|
+
margin: 0 .07em !important;
|
29
|
+
vertical-align: -0.1em !important;
|
30
|
+
background: none !important;
|
31
|
+
padding: 0 !important;
|
32
|
+
}
|
33
|
+
</style>
|
34
|
+
<link rel='stylesheet' id='graphy-fonts-css' href='//fonts.googleapis.com/css?family=Lora%3A400%2C400italic%2C700%2C700italic%7CBitter%3A400&subset=latin%2Clatin-ext' type='text/css' media='all' />
|
35
|
+
<link rel='stylesheet' id='graphy-genericons-css' href='http://theupperlip.net/wp-content/themes/graphy/genericons/genericons.css?ver=3.0.3' type='text/css' media='all' />
|
36
|
+
<link rel='stylesheet' id='graphy-style-css' href='http://theupperlip.net/wp-content/themes/graphy/style.css?ver=4.4.5' type='text/css' media='all' />
|
37
|
+
<link rel='https://api.w.org/' href='http://theupperlip.net/wp-json/' />
|
38
|
+
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://theupperlip.net/xmlrpc.php?rsd" />
|
39
|
+
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://theupperlip.net/wp-includes/wlwmanifest.xml" />
|
40
|
+
<meta name="generator" content="WordPress 4.4.5" />
|
41
|
+
<link rel="canonical" href="http://theupperlip.net/draft/" />
|
42
|
+
<link rel='shortlink' href='http://theupperlip.net/?p=12' />
|
43
|
+
<link rel="alternate" type="application/json+oembed" href="http://theupperlip.net/wp-json/oembed/1.0/embed?url=http%3A%2F%2Ftheupperlip.net%2Fdraft%2F" />
|
44
|
+
<link rel="alternate" type="text/xml+oembed" href="http://theupperlip.net/wp-json/oembed/1.0/embed?url=http%3A%2F%2Ftheupperlip.net%2Fdraft%2F&format=xml" />
|
45
|
+
<style type="text/css">
|
46
|
+
.site-logo { margin-top: px; padding-bottom: px; }
|
47
|
+
.entry-content a, .entry-summary a, .comment-content a, .comment-respond a, .navigation a, .comment-navigation a, .current-menu-item > a { color:#000000; }
|
48
|
+
a:hover { color:; }
|
49
|
+
</style>
|
50
|
+
</head>
|
51
|
+
|
52
|
+
<body class="page page-id-12 page-template-default no-sidebar footer-0 has-avatars">
|
53
|
+
<div id="page" class="hfeed site">
|
54
|
+
|
55
|
+
<header id="masthead" class="site-header" role="banner">
|
56
|
+
<div class="site-branding">
|
57
|
+
<h1 class="site-logo"><a href="http://theupperlip.net/" rel="home"><img alt="The Upper Lip" src="http://theupperlip.net/wp-content/uploads/2016/07/upperliptulip_png300ppi.png" /></a></h1>
|
58
|
+
</div>
|
59
|
+
|
60
|
+
<div class="main-navigation-wrapper">
|
61
|
+
<nav id="site-navigation" class="main-navigation" role="navigation">
|
62
|
+
<h1 class="menu-toggle">Menu</h1>
|
63
|
+
<a class="skip-link screen-reader-text" href="#content">Skip to content</a>
|
64
|
+
<div class="menu-menu-1-container"><ul id="menu-menu-1" class="menu"><li id="menu-item-17" class="menu-item menu-item-type-post_type menu-item-object-page current-menu-item page_item page-item-12 current_page_item menu-item-17"><a href="http://theupperlip.net/draft/">Draft</a></li>
|
65
|
+
<li id="menu-item-16" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-16"><a href="http://theupperlip.net/bottles/">Bottles</a></li>
|
66
|
+
<li id="menu-item-164" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-164"><a href="http://theupperlip.net/events/">Events</a>
|
67
|
+
<ul class="sub-menu">
|
68
|
+
<li id="menu-item-203" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-203"><a href="http://theupperlip.net/private-event-reservations/">Private Events Rental</a></li>
|
69
|
+
</ul>
|
70
|
+
</li>
|
71
|
+
</ul></div> </nav><!-- #site-navigation -->
|
72
|
+
</div>
|
73
|
+
|
74
|
+
|
75
|
+
<script>
|
76
|
+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
77
|
+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
78
|
+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
79
|
+
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
80
|
+
|
81
|
+
ga('create', 'UA-73197702-1', 'auto');
|
82
|
+
ga('send', 'pageview');
|
83
|
+
|
84
|
+
</script>
|
85
|
+
</header><!-- #masthead -->
|
86
|
+
|
87
|
+
<div id="content" class="site-content">
|
88
|
+
|
89
|
+
<div id="primary" class="content-area">
|
90
|
+
<main id="main" class="site-main" role="main">
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
<article id="post-12" class="post-12 page type-page status-publish hentry">
|
95
|
+
<header class="entry-header">
|
96
|
+
<h1 class="entry-title">Draft</h1>
|
97
|
+
</header><!-- .entry-header -->
|
98
|
+
|
99
|
+
<div class="entry-content">
|
100
|
+
<div style="text-align: center;"><html><head><link href="/DigitalPour/digitalPour.css" rel="stylesheet" media="all" type="text/css" /></head><body>
|
101
|
+
<div id="datafieldcontainer">
|
102
|
+
<div id="responsecontainer">
|
103
|
+
<div id="boxfielddata" title="68% remaining" ><b><span><a href="http://http://www.block15.com/" target="_blank">Block 15</a> <i>Bloktoberfest</i></b></span><br />Marzen 5.4% <a href="http://maps.google.com/maps?q=Corvallis, OR" target="_blank">Corvallis, OR</a> <span></span>
|
104
|
+
<div><span style="position:relative;"></span></div>
|
105
|
+
</div>
|
106
|
+
</div>
|
107
|
+
<p></body></html>
|
108
|
+
<div id="responsecontainer">
|
109
|
+
<div id="boxfielddata" title="24% remaining" ><b><span><a href="http://www.elsegundobrewing.com" target="_blank">El Segundo</a> <i>Wet Hop Simcoe</i></b></span><br />Pale Ale w/ fresh hops- Hops (Simcoe) 6.1% <a href="http://maps.google.com/maps?q=El Segundo" target="_blank">El Segundo</a> <span></span>
|
110
|
+
<div><span style="position:relative;"></span></div>
|
111
|
+
</div>
|
112
|
+
</div>
|
113
|
+
<p></body></html>
|
114
|
+
<div id="responsecontainer">
|
115
|
+
<div id="boxfielddata" title="73% remaining" ><b><span><a href="http://http://www.block15.com/" target="_blank">Block 15</a> <i>Sticky Hands</i></b></span><br />Imperial IPA 8.1% <a href="http://maps.google.com/maps?q=Corvallis, OR" target="_blank">Corvallis, OR</a> <span></span>
|
116
|
+
<div><span style="position:relative;"></span></div>
|
117
|
+
</div>
|
118
|
+
</div>
|
119
|
+
<p></body></html>
|
120
|
+
<div id="responsecontainer">
|
121
|
+
<div id="boxfielddata" title="76% remaining" ><b><span></a>Blackberry Farm</a> <i>New World Cuvee</i></b></span><br />Dry Hopped Saison 6.3% <a href="http://maps.google.com/maps?q=Walland, TN" target="_blank">Walland, TN</a> <span></span>
|
122
|
+
<div><span style="position:relative;"><a href="/?page_id=7&so=brewery"><i>Available in bottles!</i></a></span></div>
|
123
|
+
</div>
|
124
|
+
</div>
|
125
|
+
<p></body></html>
|
126
|
+
<div id="responsecontainer">
|
127
|
+
<div id="boxfielddata" title="25% remaining" ><b><span></a>Phantom Carriage</a> <i>Broadacres Strawberry</i></b></span><br />Berliner Weisse 3.9% <a href="http://maps.google.com/maps?q=Carson, CA" target="_blank">Carson, CA</a> <span></span>
|
128
|
+
<div><span style="position:relative;"></span></div>
|
129
|
+
</div>
|
130
|
+
</div>
|
131
|
+
<p></body></html>
|
132
|
+
<div id="responsecontainer">
|
133
|
+
<div id="boxfielddata" title="58% remaining" ><b><span><a href="http://http://www.bestbelgianspecialbeers.be/main_eng.html" target="_blank">Bosteels</a> <i>Pauwel Kwak</i></b></span><br />Belgian Strong Pale Ale 8.4% <a href="http://maps.google.com/maps?q=Buggenhout, Belgium" target="_blank">Buggenhout, Belgium</a> <span></span>
|
134
|
+
<div><span style="position:relative;"></span></div>
|
135
|
+
</div>
|
136
|
+
</div>
|
137
|
+
</div>
|
138
|
+
<div id="shim"></div>
|
139
|
+
<div id="datafieldcontainer"></body></html></div>
|
140
|
+
</div>
|
141
|
+
</div><!-- .entry-content -->
|
142
|
+
</article><!-- #post-## -->
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
</main><!-- #main -->
|
147
|
+
</div><!-- #primary -->
|
148
|
+
|
149
|
+
|
150
|
+
</div><!-- #content -->
|
151
|
+
|
152
|
+
<footer id="colophon" class="site-footer" role="contentinfo">
|
153
|
+
<div class="site-info">
|
154
|
+
<div class="site-copyright">© 2016 <a href="http://theupperlip.net/" rel="home">The Upper Lip</a> | Mon-Thurs: 4-10PM Fri-Sat: Noon-Midnight Sun: Closed</div>
|
155
|
+
<!-- <div class="site-credit">Powered by <a href="http://wordpress.org/">WordPress</a> &
|
156
|
+
<a href="http://themegraphy.com/">Themegraphy</a></div>
|
157
|
+
</div> --><!-- .site-info -->
|
158
|
+
</footer><!-- #colophon -->
|
159
|
+
</div><!-- #page -->
|
160
|
+
|
161
|
+
<script type='text/javascript' src='http://theupperlip.net/wp-content/themes/graphy/js/navigation.js?ver=20140207'></script>
|
162
|
+
<script type='text/javascript' src='http://theupperlip.net/wp-content/themes/graphy/js/skip-link-focus-fix.js?ver=20130115'></script>
|
163
|
+
<script type='text/javascript' src='http://theupperlip.net/wp-includes/js/wp-embed.min.js?ver=4.4.5'></script>
|
164
|
+
|
165
|
+
</body>
|
166
|
+
</html>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Lita::Handlers::OnewheelBeerUpperlip, lita_handler: true do
|
4
|
+
it { is_expected.to route_command('upperlip') }
|
5
|
+
it { is_expected.to route_command('upperlip 4') }
|
6
|
+
it { is_expected.to route_command('upperlip nitro') }
|
7
|
+
it { is_expected.to route_command('upperlip CASK') }
|
8
|
+
|
9
|
+
before do
|
10
|
+
mock = File.open('spec/fixtures/upperlip.html').read
|
11
|
+
allow(RestClient).to receive(:get) { mock }
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'shows the upperlip' do
|
15
|
+
send_command 'upperlip'
|
16
|
+
expect(replies.last).to eq("Bailey's Upperlip tap: 1) Block 15 Bloktoberfest 2) El Segundo Wet Hop Simcoe 3) Block 15 Sticky Hands 4) <i>Available in bottles!</i> New World Cuvee 5) Broadacres Strawberry 6) Bosteels Pauwel Kwak")
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'displays details for tap 4' do
|
20
|
+
send_command 'upperlip 4'
|
21
|
+
expect(replies.last).to eq("Bailey's Upperlip tap 4) <i>Available in bottles!</i> New World Cuvee - Dry Hopped Saison 6.3%, 76% remaining")
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'searches for ipa' do
|
25
|
+
send_command 'upperlip ipa'
|
26
|
+
expect(replies.last).to eq("Bailey's Upperlip tap 3) Block 15 Sticky Hands - Imperial IPA 8.1%, 73% remaining")
|
27
|
+
end
|
28
|
+
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-upperlip'
|
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,213 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lita-onewheel-beer-upperlip
|
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-10-23 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'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4'
|
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: nokogiri
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.6'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.6'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: sanitize
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '4.0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '4.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: lita-onewheel-beer-base
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '2'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '2'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: bundler
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.3'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.3'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rake
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '10.4'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '10.4'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rack-test
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0.6'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0.6'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rspec
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '3.0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '3.0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: simplecov
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0.10'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0.10'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: coveralls
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0.8'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0.8'
|
167
|
+
description: Lita interface to Bailey's Upperlip Taproom listings.
|
168
|
+
email:
|
169
|
+
- andrew.kreps@gmail.com
|
170
|
+
executables: []
|
171
|
+
extensions: []
|
172
|
+
extra_rdoc_files: []
|
173
|
+
files:
|
174
|
+
- ".gitignore"
|
175
|
+
- ".travis.yml"
|
176
|
+
- Gemfile
|
177
|
+
- README.md
|
178
|
+
- Rakefile
|
179
|
+
- lib/lita-onewheel-beer-upperlip.rb
|
180
|
+
- lib/lita/handlers/onewheel_beer_upperlip.rb
|
181
|
+
- lita-onewheel-beer-upperlip.gemspec
|
182
|
+
- spec/fixtures/upperlip.html
|
183
|
+
- spec/lita/handlers/onewheel_beer_upperlip_spec.rb
|
184
|
+
- spec/spec_helper.rb
|
185
|
+
homepage: https://github.com/onewheelskyward/lita-onewheel-beer-upperlip
|
186
|
+
licenses:
|
187
|
+
- MIT
|
188
|
+
metadata:
|
189
|
+
lita_plugin_type: handler
|
190
|
+
post_install_message:
|
191
|
+
rdoc_options: []
|
192
|
+
require_paths:
|
193
|
+
- lib
|
194
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
195
|
+
requirements:
|
196
|
+
- - ">="
|
197
|
+
- !ruby/object:Gem::Version
|
198
|
+
version: '0'
|
199
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
200
|
+
requirements:
|
201
|
+
- - ">="
|
202
|
+
- !ruby/object:Gem::Version
|
203
|
+
version: '0'
|
204
|
+
requirements: []
|
205
|
+
rubyforge_project:
|
206
|
+
rubygems_version: 2.5.1
|
207
|
+
signing_key:
|
208
|
+
specification_version: 4
|
209
|
+
summary: See above.
|
210
|
+
test_files:
|
211
|
+
- spec/fixtures/upperlip.html
|
212
|
+
- spec/lita/handlers/onewheel_beer_upperlip_spec.rb
|
213
|
+
- spec/spec_helper.rb
|