lita-onewheel-filmplot 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -0,0 +1,20 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ .idea
19
+ lita_config.rb
20
+ bin
data/.travis.yml ADDED
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.5.1
4
+ script: bundle exec rake
5
+ before_install:
6
+ - gem update --system
7
+ services:
8
+ - redis-server
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # lita-onewheel-filmplot
2
+
3
+ [![Build Status](https://travis-ci.org/onewheelskyward/lita-onewheel-filmplot.svg?branch=master)](https://travis-ci.org/onewheelskyward/lita-onewheel-filmplot)
4
+ [![Coverage Status](https://coveralls.io/repos/github/onewheelskyward/lita-onewheel-filmplot/badge.svg?branch=master)](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,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
@@ -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,3 @@
1
+ require "lita"
2
+
3
+ require "lita/handlers/onewheel_filmplot"
@@ -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