analytical 2.8.0 → 2.9.0

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.
@@ -107,6 +107,7 @@ These fine folks have contributed patches and new features to this project:
107
107
  * {Ablyamitov Ablyamit}[http://github.com/unlimit]
108
108
  * {Kurt Werle}[http://github.com/kwerle]
109
109
  * {Olivier Lauzon}[http://github.com/olauzon]
110
+ * {Chris Ricca}[https://github.com/ChrisRicca]
110
111
 
111
112
  Thanks guys!
112
113
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.8.0
1
+ 2.9.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{analytical}
8
- s.version = "2.8.0"
8
+ s.version = "2.9.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Joshua Krall", "Nathan Phelps", "Adam Anderson", "Kevin Menard", "Ablyamitov Ablyamit", "Kurt Werle", "Olivier Lauzon"]
12
- s.date = %q{2011-04-04}
12
+ s.date = %q{2011-04-20}
13
13
  s.description = %q{Gem for managing multiple analytics services in your rails app.}
14
14
  s.email = %q{josh@feefighters.com}
15
15
  s.extra_rdoc_files = [
@@ -32,7 +32,13 @@ module Analytical
32
32
  def track(*args)
33
33
  "_gaq.push(['_trackPageview'#{args.empty? ? ']' : ', "' + args.first + '"]'});"
34
34
  end
35
-
35
+
36
+ def event(name, *args)
37
+ data = args.first || nil
38
+ data_string = data ? ", '#{data.to_json}'" : ""
39
+ "_gaq.push(['_trackEvent', \"Event\", \"#{name}\"" + data_string + "]);"
40
+ end
41
+
36
42
  end
37
43
  end
38
44
  end
@@ -21,6 +21,17 @@ describe "Analytical::Modules::Google" do
21
21
  @api.track('pagename', {:some=>'data'}).should == "_gaq.push(['_trackPageview', \"pagename\"]);"
22
22
  end
23
23
  end
24
+ describe '#event' do
25
+ it 'should return the event javascript' do
26
+ @api = Analytical::Modules::Google.new :parent=>@parent, :key=>'abcdef'
27
+ @api.event('pagename').should == "_gaq.push(['_trackEvent', \"Event\", \"pagename\"]);"
28
+ end
29
+
30
+ it 'should include any passed in data' do
31
+ @api = Analytical::Modules::Google.new :parent=>@parent, :key=>'abcdef'
32
+ @api.event('pagename', {:some=>'data',:more=>'info'}).should == "_gaq.push(['_trackEvent', \"Event\", \"pagename\", '#{ {:some=>'data',:more=>'info'}.to_json }']);"
33
+ end
34
+ end
24
35
  describe '#init_javascript' do
25
36
  it 'should return the init javascript' do
26
37
  @api = Analytical::Modules::Google.new :parent=>@parent, :key=>'abcdef'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: analytical
3
3
  version: !ruby/object:Gem::Version
4
- hash: 47
4
+ hash: 43
5
5
  prerelease: false
6
6
  segments:
7
7
  - 2
8
- - 8
8
+ - 9
9
9
  - 0
10
- version: 2.8.0
10
+ version: 2.9.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Joshua Krall
@@ -21,7 +21,7 @@ autorequire:
21
21
  bindir: bin
22
22
  cert_chain: []
23
23
 
24
- date: 2011-04-04 00:00:00 -05:00
24
+ date: 2011-04-20 00:00:00 -05:00
25
25
  default_executable:
26
26
  dependencies:
27
27
  - !ruby/object:Gem::Dependency