blekko-search 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
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. Use one ``Blekko`` instance with the default settings for all searching and slashtag management and that throttling will be taken care of for you.
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:
@@ -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
 
@@ -36,7 +36,7 @@ class Blekko
36
36
  end
37
37
  end
38
38
 
39
- def remove_urls!(target_urls)
39
+ def remove_urls!(*target_urls)
40
40
  blekko.request(remove_url(target_urls))
41
41
  true
42
42
  end
@@ -1,3 +1,3 @@
1
1
  module BlekkoSearch
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
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.3
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-10-19 00:00:00.000000000 Z
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: