lita-onewheel-filmplot 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +20 -0
- data/.travis.yml +8 -0
- data/Gemfile +3 -0
- data/README.md +21 -0
- data/Rakefile +6 -0
- data/lib/lita/handlers/onewheel_filmplot.rb +34 -0
- data/lib/lita-onewheel-filmplot.rb +3 -0
- data/lita-onewheel-filmplot.gemspec +29 -0
- data/spec/fixtures/timecop.html +6394 -0
- data/spec/lita/handlers/onewheel_filmplot_spec.rb +21 -0
- data/spec/spec_helper.rb +14 -0
- metadata +185 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b5cab92a17d2631daf2a21e24f6c90047cedcf399238205248838b1246788ba7
|
4
|
+
data.tar.gz: 2d072db1cb88025f5020047e1cb2157aa00815532be2a5995da30c1387f49fb3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6af656589d19e14e07cfc9afd84553ada0a1e8b58dff6de2a9e0151f3322a9b37688c08807833310e0a1c5320d95c2c550e298c4b622b8979200ac9fcc8b99ed
|
7
|
+
data.tar.gz: fde06c912be3ffe05badaae8f0f9038a1dbe9b1fcf47adea751c3cd8813817533f7d57d847d0d643378c0311eea62da62966f51f5e19e445fa2fd80d69fff5b7
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# lita-onewheel-filmplot
|
2
|
+
|
3
|
+
[](https://travis-ci.org/onewheelskyward/lita-onewheel-filmplot)
|
4
|
+
[](https://coveralls.io/github/onewheelskyward/lita-onewheel-filmplot?branch=master)
|
5
|
+
|
6
|
+
# Installation
|
7
|
+
|
8
|
+
Add lita-onewheel-filmplot to your Lita instance's Gemfile:
|
9
|
+
|
10
|
+
`gem 'lita-onewheel-filmplot'`
|
11
|
+
|
12
|
+
# Configuration
|
13
|
+
|
14
|
+
n/a
|
15
|
+
|
16
|
+
# Usage
|
17
|
+
|
18
|
+
bot: filmplot timecop
|
19
|
+
|
20
|
+
^^ should return the plot of timecop.
|
21
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'rest-client'
|
2
|
+
require 'nokogiri'
|
3
|
+
|
4
|
+
module Lita
|
5
|
+
module Handlers
|
6
|
+
class OnewheelFilmplot < Handler
|
7
|
+
config :api_key
|
8
|
+
config :distance
|
9
|
+
config :mode, default: :irc
|
10
|
+
|
11
|
+
route /^filmplot\s+(.*)$/i,
|
12
|
+
:get_plot,
|
13
|
+
command: true,
|
14
|
+
help: { '!filmplot <title>' => 'Gives you rotten tomatoes\' film summary.' }
|
15
|
+
route /^plotline\s+(.*)$/i,
|
16
|
+
:get_plot,
|
17
|
+
command: true
|
18
|
+
|
19
|
+
def get_plot(response)
|
20
|
+
movie_slug = response.matches[0][0]
|
21
|
+
begin
|
22
|
+
r = RestClient.get("https://www.rottentomatoes.com/m/#{movie_slug}")
|
23
|
+
noko_doc = Nokogiri::HTML(r)
|
24
|
+
node = noko_doc.css('div#movieSynopsis')
|
25
|
+
response.reply node.text.strip
|
26
|
+
rescue RestClient::ResourceNotFound => e
|
27
|
+
response.reply "#{movie_slug} not found."
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
Lita.register_handler(OnewheelFilmplot)
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
Gem::Specification.new do |spec|
|
2
|
+
spec.name = 'lita-onewheel-filmplot'
|
3
|
+
spec.version = '0.0.0'
|
4
|
+
spec.authors = ['Andrew Kreps']
|
5
|
+
spec.email = ['andrew.kreps@gmail.com']
|
6
|
+
spec.description = 'Film plot retrieval bot.'
|
7
|
+
spec.summary = 'Reads the plot of a film from rotten tomatoes.'
|
8
|
+
spec.homepage = 'https://github.com/onewheelskyward/lita-onewheel-filmplot'
|
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.4'
|
18
|
+
|
19
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
20
|
+
spec.add_development_dependency 'rake', '~> 10.4'
|
21
|
+
spec.add_development_dependency 'rack-test', '~> 0.6'
|
22
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
23
|
+
spec.add_development_dependency 'simplecov', '~> 0.10'
|
24
|
+
spec.add_development_dependency 'coveralls', '~> 0.8'
|
25
|
+
|
26
|
+
spec.add_runtime_dependency 'rest-client', '~> 1.8'
|
27
|
+
spec.add_runtime_dependency 'nokogiri', '~> 1.8'
|
28
|
+
|
29
|
+
end
|