-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit abf3b4e
Showing
12 changed files
with
888 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
*.gem | ||
*.rbc | ||
.bundle | ||
.config | ||
.yardoc | ||
Gemfile.lock | ||
InstalledFiles | ||
_yardoc | ||
coverage | ||
doc/ | ||
lib/bundler/man | ||
pkg | ||
rdoc | ||
spec/reports | ||
test/tmp | ||
test/version_tmp | ||
tmp | ||
.idea | ||
lita_config.rb | ||
bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
language: ruby | ||
rvm: | ||
- 2.2.6 | ||
- 2.3.3 | ||
script: bundle exec rake | ||
before_install: | ||
- gem update --system | ||
services: | ||
- redis-server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
source 'https://rubygems.org' | ||
|
||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
lita-onewheel-duckduckgo | ||
-------------------- | ||
|
||
[![Build Status](https://travis-ci.org/onewheelskyward/lita-onewheel-duckduckgo.png?branch=master)](https://travis-ci.org/onewheelskyward/lita-onewheel-duckduckgo) | ||
[![Coverage Status](https://coveralls.io/repos/onewheelskyward/lita-onewheel-duckduckgo/badge.png)](https://coveralls.io/r/onewheelskyward/lita-onewheel-duckduckgo) | ||
|
||
Queries the Duck Duck Go Answers api for things. | ||
|
||
Installation | ||
------------ | ||
Add lita-onewheel-duckduckgo to your Lita instance's Gemfile: | ||
|
||
``` ruby | ||
gem "lita-onewheel-duckduckgo" | ||
``` | ||
|
||
Usage | ||
----- | ||
|
||
!duck go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
require 'bundler/gem_tasks' | ||
require 'rspec/core/rake_task' | ||
|
||
RSpec::Core::RakeTask.new(:spec) | ||
|
||
task default: :spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
require 'lita' | ||
|
||
require 'lita/handlers/onewheel_duckduckgo' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
require 'rest-client' | ||
|
||
module Lita | ||
module Handlers | ||
class OnewheelDuckDuckGo < Handler | ||
route /^duck\s+(.*)$/, :search, command: true | ||
|
||
def search(response) | ||
query = response.matches[0][0] | ||
Lita.logger.debug "Querying for #{query}" | ||
result = get_result(query) | ||
Lita.logger.debug "Result: #{result}" | ||
reply = "DuckDuckGo Result: #{result['Abstract'][0..250]}" | ||
Lita.logger.debug "Reply: #{reply}" | ||
response.reply reply | ||
end | ||
|
||
def get_result(query) | ||
result = RestClient.get("http://api.duckduckgo.com/?q=#{query}&format=json") | ||
end | ||
|
||
Lita.register_handler(self) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Gem::Specification.new do |spec| | ||
spec.name = 'lita-onewheel-duckduckgo' | ||
spec.version = '0.0.0' | ||
spec.authors = ['Andrew Kreps'] | ||
spec.email = ['andrew.kreps@gmail.com'] | ||
spec.description = 'Lita handler for Duck Duck Go\'s answers engine.' | ||
spec.summary = 'Duck Duck Goose' | ||
spec.homepage = 'https://github.com/onewheelskyward/lita-onewheel-duckduckgo' | ||
spec.license = 'MIT' | ||
spec.metadata = { 'lita_plugin_type' => 'handler' } | ||
|
||
spec.files = `git ls-files`.split($/) | ||
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } | ||
spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) | ||
spec.require_paths = ['lib'] | ||
|
||
spec.add_runtime_dependency 'lita', '~> 4' | ||
spec.add_runtime_dependency 'rest-client', '~> 1' | ||
|
||
spec.add_development_dependency 'bundler', '~> 1' | ||
spec.add_development_dependency 'rake', '~> 10' | ||
spec.add_development_dependency 'rack-test', '~> 0.6' | ||
spec.add_development_dependency 'rspec', '~> 3' | ||
spec.add_development_dependency 'simplecov', '~> 0.10' | ||
spec.add_development_dependency 'coveralls', '~> 0.8' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,221 @@ | ||
{ | ||
"DefinitionSource": "", | ||
"Heading": "DuckDuckGo", | ||
"ImageWidth": 340, | ||
"RelatedTopics": [ | ||
{ | ||
"Result": "<a href=\"https://duckduckgo.com/Names_Database\">Names Database</a> - The Names Database is a partially defunct social network, owned and operated by Classmates.com, a wholly owned subsidiary of United Online. The site does not appear to be significantly updated since 2008, and has many broken links and display issues.", | ||
"Icon": { | ||
"URL": "", | ||
"Height": "", | ||
"Width": "" | ||
}, | ||
"FirstURL": "https://duckduckgo.com/Names_Database", | ||
"Text": "Names Database - The Names Database is a partially defunct social network, owned and operated by Classmates.com, a wholly owned subsidiary of United Online. The site does not appear to be significantly updated since 2008, and has many broken links and display issues." | ||
}, | ||
{ | ||
"Result": "<a href=\"https://duckduckgo.com/c/Companies_based_in_Chester_County%2C_Pennsylvania\">Companies based in Chester County, Pennsylvania</a>", | ||
"Icon": { | ||
"URL": "", | ||
"Height": "", | ||
"Width": "" | ||
}, | ||
"FirstURL": "https://duckduckgo.com/c/Companies_based_in_Chester_County%2C_Pennsylvania", | ||
"Text": "Companies based in Chester County, Pennsylvania" | ||
}, | ||
{ | ||
"Result": "<a href=\"https://duckduckgo.com/c/Tor_hidden_services\">Tor hidden services</a>", | ||
"Icon": { | ||
"URL": "", | ||
"Height": "", | ||
"Width": "" | ||
}, | ||
"FirstURL": "https://duckduckgo.com/c/Tor_hidden_services", | ||
"Text": "Tor hidden services" | ||
}, | ||
{ | ||
"Result": "<a href=\"https://duckduckgo.com/c/Internet_privacy_software\">Internet privacy software</a>", | ||
"Icon": { | ||
"URL": "", | ||
"Height": "", | ||
"Width": "" | ||
}, | ||
"FirstURL": "https://duckduckgo.com/c/Internet_privacy_software", | ||
"Text": "Internet privacy software" | ||
}, | ||
{ | ||
"Result": "<a href=\"https://duckduckgo.com/c/Perl_software\">Perl software</a>", | ||
"Icon": { | ||
"URL": "", | ||
"Height": "", | ||
"Width": "" | ||
}, | ||
"FirstURL": "https://duckduckgo.com/c/Perl_software", | ||
"Text": "Perl software" | ||
}, | ||
{ | ||
"Result": "<a href=\"https://duckduckgo.com/c/Proprietary_cross-platform_software\">Proprietary cross-platform software</a>", | ||
"Icon": { | ||
"URL": "", | ||
"Height": "", | ||
"Width": "" | ||
}, | ||
"FirstURL": "https://duckduckgo.com/c/Proprietary_cross-platform_software", | ||
"Text": "Proprietary cross-platform software" | ||
}, | ||
{ | ||
"Result": "<a href=\"https://duckduckgo.com/c/Internet_search_engines\">Internet search engines</a>", | ||
"Icon": { | ||
"URL": "", | ||
"Height": "", | ||
"Width": "" | ||
}, | ||
"FirstURL": "https://duckduckgo.com/c/Internet_search_engines", | ||
"Text": "Internet search engines" | ||
}, | ||
{ | ||
"Result": "<a href=\"https://duckduckgo.com/c/Android_(operating_system)_software\">Android (operating system) software</a>", | ||
"Icon": { | ||
"URL": "", | ||
"Height": "", | ||
"Width": "" | ||
}, | ||
"FirstURL": "https://duckduckgo.com/c/Android_(operating_system)_software", | ||
"Text": "Android (operating system) software" | ||
} | ||
], | ||
"Entity": "website", | ||
"meta": { | ||
"maintainer": { | ||
"github": "duckduckgo" | ||
}, | ||
"perl_module": "DDG::Fathead::Wikipedia", | ||
"status": "live", | ||
"production_state": "online", | ||
"dev_date": null, | ||
"js_callback_name": "wikipedia", | ||
"signal_from": "wikipedia_fathead", | ||
"live_date": null, | ||
"src_id": 1, | ||
"src_options": { | ||
"skip_end": "0", | ||
"skip_abstract": 0, | ||
"skip_qr": "", | ||
"language": "en", | ||
"skip_icon": 0, | ||
"skip_image_name": 0, | ||
"directory": "", | ||
"min_abstract_length": "20", | ||
"skip_abstract_paren": 0, | ||
"is_wikipedia": 1, | ||
"source_skip": "", | ||
"is_fanon": 0, | ||
"is_mediawiki": 1, | ||
"src_info": "" | ||
}, | ||
"repo": "fathead", | ||
"developer": [ | ||
{ | ||
"url": "http://www.duckduckhack.com", | ||
"name": "DDG Team", | ||
"type": "ddg" | ||
} | ||
], | ||
"tab": "About", | ||
"producer": null, | ||
"unsafe": 0, | ||
"id": "wikipedia_fathead", | ||
"dev_milestone": "live", | ||
"topic": [ | ||
"productivity" | ||
], | ||
"name": "Wikipedia", | ||
"attribution": null, | ||
"created_date": null, | ||
"example_query": "nikola tesla", | ||
"description": "Wikipedia", | ||
"is_stackexchange": null, | ||
"designer": null, | ||
"src_domain": "en.wikipedia.org", | ||
"src_name": "Wikipedia", | ||
"blockgroup": null, | ||
"src_url": null | ||
}, | ||
"Type": "A", | ||
"Redirect": "", | ||
"DefinitionURL": "", | ||
"AbstractURL": "https://en.wikipedia.org/wiki/DuckDuckGo", | ||
"Definition": "", | ||
"AbstractSource": "Wikipedia", | ||
"Infobox": { | ||
"content": [ | ||
{ | ||
"data_type": "string", | ||
"sort_order": "1", | ||
"value": "The search engine that doesn't track you.", | ||
"label": "Slogan", | ||
"wiki_order": 1 | ||
}, | ||
{ | ||
"data_type": "string", | ||
"sort_order": "1", | ||
"value": "Web search engine", | ||
"label": "Type of site", | ||
"wiki_order": 3 | ||
}, | ||
{ | ||
"data_type": "string", | ||
"sort_order": "2", | ||
"value": "DuckDuckGo, Inc.", | ||
"label": "Owner", | ||
"wiki_order": 7 | ||
}, | ||
{ | ||
"data_type": "string", | ||
"sort_order": "3", | ||
"value": "Gabriel Weinberg", | ||
"label": "Created by", | ||
"wiki_order": 8 | ||
}, | ||
{ | ||
"data_type": "string", | ||
"sort_order": "3", | ||
"value": "September 25, 2008", | ||
"label": "Launched", | ||
"wiki_order": 9 | ||
}, | ||
{ | ||
"data_type": "string", | ||
"sort_order": "4", | ||
"value": "560 (December 16, 2016)", | ||
"label": "Alexa rank", | ||
"wiki_order": 10 | ||
} | ||
], | ||
"meta": [ | ||
{ | ||
"data_type": "string", | ||
"value": "DuckDuckGo", | ||
"label": "article_title" | ||
}, | ||
{ | ||
"data_type": "string", | ||
"value": "infobox website", | ||
"label": "template_name" | ||
}, | ||
{ | ||
"data_type": "string", | ||
"value": "website", | ||
"label": "formatting_rules" | ||
} | ||
] | ||
}, | ||
"Image": "https://duckduckgo.com/i/adad4e5c.png", | ||
"ImageIsLogo": 1, | ||
"Abstract": "DuckDuckGo is an Internet search engine that emphasizes protecting searchers' privacy and avoiding the filter bubble of personalized search results. DuckDuckGo distinguishes itself from other search engines by not profiling its users and by deliberately showing all users the same search results for a given search term. DuckDuckGo emphasizes getting information from the best sources rather than the most sources, generating its search results from key crowdsourced sites such as Wikipedia and from partnerships with other search engines like Yandex, Yahoo!, Bing, and Yummly.", | ||
"AbstractText": "DuckDuckGo is an Internet search engine that emphasizes protecting searchers' privacy and avoiding the filter bubble of personalized search results. DuckDuckGo distinguishes itself from other search engines by not profiling its users and by deliberately showing all users the same search results for a given search term. DuckDuckGo emphasizes getting information from the best sources rather than the most sources, generating its search results from key crowdsourced sites such as Wikipedia and from partnerships with other search engines like Yandex, Yahoo!, Bing, and Yummly.", | ||
"AnswerType": "", | ||
"ImageHeight": 270, | ||
"Answer": "", | ||
"Results": [] | ||
} |
Oops, something went wrong.