duckduckgo 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c33a5106893388b934bfde2c778a95dab6e932b1
4
- data.tar.gz: 0b417c2c2e6d282cfb1c75b8601840aaca370515
3
+ metadata.gz: 1ecc4fbee9739c27ddc4010278f3e2fdaac13a12
4
+ data.tar.gz: c238a8216a246c80dd4622f981e120e975cc9a10
5
5
  SHA512:
6
- metadata.gz: e0113f3c3c6abbbe679069c2c4e163a043bc095ff711d12fefb9ea50ed50b3e17c1df75e153963406dca8d2a522a202ed00a9e6e7b566d29240b141940b1b7d6
7
- data.tar.gz: db0975951bb73c4f55da6ad0d2e1a5e5095160b66fab957af8c7a7edbec723a799de84dc2b1250cf3a411c6a375cd1d719248430a535a9094b7e2b59e627f99d
6
+ metadata.gz: 9e36897c4d88b2882ed75e7636ef8184b2da0852a5213359b4ac0808728e52c028230275fcf139e4da01dfad84a7e9dceaf857012da7c395037f171b728f2001
7
+ data.tar.gz: 2225bc43e515e9b4819d69dc028a9827909606cbfb6fcbf7b5be92b1514153b0656410c42d732bb35d64dbd5417e1d759a0ebd1e68635219f7f22e5c085ff4b6
data/README.md CHANGED
@@ -28,7 +28,7 @@ Using this library is very simple. Here's an example:
28
28
 
29
29
  require 'duckduckgo'
30
30
 
31
- results = DuckDuckGo::search('Apples')
31
+ results = DuckDuckGo::search(:query => 'Apples')
32
32
  result = results.first
33
33
 
34
34
  result.uri
@@ -13,12 +13,14 @@ module DuckDuckGo
13
13
  ##
14
14
  # Searches DuckDuckGo for the given query string. This function returns an array of SearchResults.
15
15
  #
16
- # @param [String] query the query
16
+ # @param [Hash] hash a hash containing the query string and possibly other configuration settings.
17
17
  # @raise [Exception] if there is an error scraping DuckDuckGo for the search results.
18
- def self.search(query)
18
+ def self.search(hash)
19
+
19
20
  results = []
20
21
 
21
- html = open("#{RESOURCE_URL}#{CGI::escape(query)}")
22
+ raise 'Hash does not contain a query string.' unless hash.has_key?(:query)
23
+ html = open("#{RESOURCE_URL}#{CGI::escape(hash[:query])}")
22
24
 
23
25
  document = Nokogiri::HTML(html)
24
26
 
@@ -1,3 +1,3 @@
1
1
  module DuckDuckGo
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: duckduckgo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Soltys