blekko-search 0.0.3 → 0.0.4
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.
- data/README.md +3 -1
- data/lib/blekko-search/blekko.rb +4 -5
- data/lib/blekko-search/slashtag.rb +1 -1
- data/lib/blekko-search/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -4,6 +4,8 @@ Search the Internet (or parts of the Internet!) with ease. This gem is powered b
|
|
4
4
|
|
5
5
|
This gem is based on work done on [earmarkd.com](http://www.earmarkd.com) during [RailsRumble 2012](http://railsrumble.com).
|
6
6
|
|
7
|
+
For an example of what's possible, check out [Daring Firesearch](http://daringfiresearch.net), a search engine tribute to John Gruber's [Daring Fireball](http://daringfireball.net).
|
8
|
+
|
7
9
|
## Installation
|
8
10
|
|
9
11
|
Add this line to your application's ``Gemfile``:
|
@@ -44,7 +46,7 @@ Blekko allows for a maximum of 100 results per search, but if you'd like more, y
|
|
44
46
|
|
45
47
|
By default, the searches will be made 100 results at a time, but you can reduce the page size using the ``:page_size`` argument too.
|
46
48
|
|
47
|
-
Blekko requests that users of its API throttle searches to one per second.
|
49
|
+
Blekko requests that users of its API throttle searches to one per second. All ``Blekko`` instances that share an API key will have their requests throttled through the same queuee.
|
48
50
|
|
49
51
|
#### Results
|
50
52
|
Each result includes the attributes that blekko provides, plus a couple more:
|
data/lib/blekko-search/blekko.rb
CHANGED
@@ -11,7 +11,7 @@ class Blekko
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
attr_accessor :protocol, :api_key, :max_frequency_per_second, :username, :password, :login_cookie
|
14
|
+
attr_accessor :protocol, :api_key, :max_frequency_per_second, :username, :password, :login_cookie, :headers
|
15
15
|
|
16
16
|
def initialize(args={})
|
17
17
|
@api_key = args[:api_key]
|
@@ -45,10 +45,7 @@ class Blekko
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def headers
|
48
|
-
{
|
49
|
-
"Cookie" => login_cookie,
|
50
|
-
"User-Agent" => "blekko-search-#{BlekkoSearch::VERSION}"
|
51
|
-
}
|
48
|
+
@headers ||= {}
|
52
49
|
end
|
53
50
|
|
54
51
|
def login
|
@@ -56,6 +53,8 @@ class Blekko
|
|
56
53
|
Net::HTTP.start(login_uri.host, login_uri.port, use_ssl: true) do |http|
|
57
54
|
response = http.request Net::HTTP::Get.new login_uri.request_uri
|
58
55
|
self.login_cookie = response.get_fields('Set-Cookie').find { |c| c =~ /\AA=/ }
|
56
|
+
headers["Cookie"] = login_cookie
|
57
|
+
headers["User-Agent"] = "blekko-search-#{BlekkoSearch::VERSION}"
|
59
58
|
end
|
60
59
|
end
|
61
60
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blekko-search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-12-01 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Search and manage slashtags for blekko.com
|
15
15
|
email:
|