oldskool-gcse 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/oldskool/gcse_handler.rb +6 -2
- metadata +4 -4
@@ -1,6 +1,6 @@
|
|
1
1
|
module Oldskool
|
2
2
|
class GcseHandler
|
3
|
-
include Utils
|
3
|
+
include Rack::Utils
|
4
4
|
|
5
5
|
def initialize(params, keyword, config)
|
6
6
|
@params = params
|
@@ -9,6 +9,10 @@ module Oldskool
|
|
9
9
|
self
|
10
10
|
end
|
11
11
|
|
12
|
+
def plugin_template(template)
|
13
|
+
File.read(File.expand_path("../../../views/#{template}.erb", __FILE__))
|
14
|
+
end
|
15
|
+
|
12
16
|
def handle_request(keyword, query)
|
13
17
|
gcse = GCSE.new(@config[:google_api_key], @keyword[:cx])
|
14
18
|
|
@@ -26,7 +30,7 @@ module Oldskool
|
|
26
30
|
{:title => "Images", :url => "http://google.com/search?q=%s&tbm=isch" % [escape_html query]},
|
27
31
|
{:title => "Videos", :url => "http://google.com/search?q=%s&tbm=vid" % [ escape_html query ]} ]
|
28
32
|
|
29
|
-
{:template => plugin_template(:gcse
|
33
|
+
{:template => plugin_template(:gcse), :gcse => gcse, :sidemenu => sidemenu}
|
30
34
|
end
|
31
35
|
end
|
32
36
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oldskool-gcse
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- R.I.Pienaar
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-01-
|
18
|
+
date: 2012-01-15 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|