adsense_for_search 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/MIT-LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ Copyright (c) 2008 Tiago Rafael Godinho
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
data/README.rdoc ADDED
@@ -0,0 +1,4 @@
1
+ = Google AdSense for Search
2
+
3
+ A simple gem to use "Google AdSense for Search"
4
+
@@ -0,0 +1,53 @@
1
+ # encoding: utf-8
2
+
3
+ module AdSenseForSearch
4
+ module ViewHelper
5
+ def adsense_for_search(*options)
6
+ raise ArgumentError, "AdSense for search needs a query string" unless options.first
7
+
8
+ pageOptions = {
9
+ :pubId => 'pub',
10
+ :query => options.first
11
+ }
12
+
13
+ adblock1 = {
14
+ :container => 'adblock1',
15
+ :number => 3,
16
+ :width => 'auto',
17
+ :lines => 2,
18
+ :fontFamily => 'arial',
19
+ :fontSizeTitle => '14px',
20
+ :fontSizeDescription => '14px',
21
+ :fontSizeDomainLink => '14px'
22
+ }
23
+
24
+ adblock1.merge! options.last[:adblock1] if options.last.has_key? :adblock1
25
+
26
+ adblock2 = {
27
+ :container => 'adblock2',
28
+ :number => 4,
29
+ :width => '250px',
30
+ :lines => 3,
31
+ :fontFamily => 'arial',
32
+ :fontSizeTitle => '12px',
33
+ :fontSizeDescription => '12px',
34
+ :fontSizeDomainLink => '12px'
35
+ }
36
+
37
+ adblock2.merge! options.last[:adblock2] if options.last.has_key? :adblock2
38
+
39
+ js = ""
40
+ js << "var pageOptions = #{pageOptions.to_json};\n"
41
+ js << "\n var adblock1 = #{adblock1.to_json};\n" if options.last.has_key? :adblock1
42
+ js << "\n var adblock2 = #{adblock2.to_json};\n" if options.last.has_key? :adblock2
43
+ js << "\n new google.ads.search.Ads(pageOptions#{ ', adblock1' if options.last.has_key? :adblock1 }#{ ', adblock2' if options.last.has_key? :adblock2 });"
44
+
45
+ <<-javascript
46
+ <script type="text/javascript" charset="utf­8">
47
+ #{js}
48
+ </script>
49
+ javascript
50
+ end
51
+ end
52
+ end
53
+
@@ -0,0 +1,9 @@
1
+ require 'action_view'
2
+ require 'adsense_for_search'
3
+
4
+ module AdSenseForSearch
5
+ autoload :ViewHelper, 'adsense_for_search/view_helper'
6
+ end
7
+
8
+ ActionView::Base.send :include, AdSenseForSearch::ViewHelper
9
+
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: adsense_for_search
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Tiago Rafael Godinho
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-10-13 00:00:00 -03:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: rails
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 7
30
+ segments:
31
+ - 2
32
+ version: "2"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ description: A simple gem to use "Google AdSense for Search"
36
+ email: tiagogodinho3@gmail.com
37
+ executables: []
38
+
39
+ extensions: []
40
+
41
+ extra_rdoc_files: []
42
+
43
+ files:
44
+ - MIT-LICENSE
45
+ - README.rdoc
46
+ - lib/adsense_for_search/view_helper.rb
47
+ - lib/adsense_for_search.rb
48
+ has_rdoc: true
49
+ homepage:
50
+ licenses: []
51
+
52
+ post_install_message:
53
+ rdoc_options: []
54
+
55
+ require_paths:
56
+ - lib
57
+ required_ruby_version: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ hash: 3
63
+ segments:
64
+ - 0
65
+ version: "0"
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ hash: 3
72
+ segments:
73
+ - 0
74
+ version: "0"
75
+ requirements: []
76
+
77
+ rubyforge_project:
78
+ rubygems_version: 1.3.7
79
+ signing_key:
80
+ specification_version: 3
81
+ summary: ""
82
+ test_files: []
83
+