heap 0.1.2 → 0.1.3
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.
- checksums.yaml +4 -4
- data/README.mdown +4 -0
- data/VERSION +1 -1
- data/heap.gemspec +5 -4
- data/lib/heap.rb +9 -1
- data/lib/heap/view_helpers.rb +3 -4
- data/test/helper.rb +2 -1
- data/test/test_heap.rb +11 -1
- data/test/test_view_helper.rb +10 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29e1017542b6783bbcb5bea44b19cba64c422c34
|
4
|
+
data.tar.gz: d082a1e537a141cc57d26cf3d604c95b08ae80ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13f9fbb1e5a7c4872f80e89062cbe448efe36c35e7ee463bece34b49b891d9a37990c9bf8c27563d0fc9ebe1757d284b10dac63e8525df08e34415c54b5994a6
|
7
|
+
data.tar.gz: 8c22f073fba35448e2fccf535ea75dd76348550ab3c1308b52f62402a78fa1100f316c2f2d898751dad895d7c8f9f1ec6ef93c31b9ac3e5b97e24b0da3a832c6
|
data/README.mdown
CHANGED
@@ -39,6 +39,10 @@ Example:
|
|
39
39
|
|
40
40
|
<%= heap_identify(current_user.email, name: current_user.name, role: current_user.role) if signed_in? %>
|
41
41
|
|
42
|
+
If you wish to use a different handle type, only `handle`/`email` are supported at the time of writing, you can set it using `Heap.default_handle_type = 'handle'`.
|
43
|
+
|
44
|
+
Default is set to `email`.
|
45
|
+
|
42
46
|
### Tracking server-side events
|
43
47
|
|
44
48
|
In case you want to track server-side events -- for example when sending a welcome e-mail to a new user --, you can do so using `Heap.event`. `Heap.event` takes 3 arguments:
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
data/heap.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: heap 0.1.
|
5
|
+
# stub: heap 0.1.3 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "heap"
|
9
|
-
s.version = "0.1.
|
9
|
+
s.version = "0.1.3"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Dennis de Reus"]
|
14
|
-
s.date = "
|
14
|
+
s.date = "2015-02-05"
|
15
15
|
s.description = "Easy integration of heapanalytics into your ruby app"
|
16
16
|
s.email = "dennisdereus@gmail.com"
|
17
17
|
s.extra_rdoc_files = [
|
@@ -34,7 +34,8 @@ Gem::Specification.new do |s|
|
|
34
34
|
"lib/heap/railtie.rb",
|
35
35
|
"lib/heap/view_helpers.rb",
|
36
36
|
"test/helper.rb",
|
37
|
-
"test/test_heap.rb"
|
37
|
+
"test/test_heap.rb",
|
38
|
+
"test/test_view_helper.rb"
|
38
39
|
]
|
39
40
|
s.homepage = "https://github.com/HectorMalot/heap"
|
40
41
|
s.licenses = ["MIT"]
|
data/lib/heap.rb
CHANGED
data/lib/heap/view_helpers.rb
CHANGED
@@ -3,18 +3,17 @@ class Heap
|
|
3
3
|
def heap_analytics
|
4
4
|
javascript_tag :type => "text/javascript" do
|
5
5
|
raw %Q{
|
6
|
-
window.heap=window.heap||[],heap.load=function(t,e){window.heap.appid=t,window.heap.config=e;var a=document.createElement("script");a.type="text/javascript",a.async=!0,a.src=("https:"===document.location.protocol?"https:":"http:")+"//cdn.heapanalytics.com/js/heap.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(a,n);for(var o=function(t){return function(){heap.push([t].concat(Array.prototype.slice.call(arguments,0)))}},p=["clearEventProperties","identify","setEventProperties","track","unsetEventProperty"],c=0;c<p.length;c++)heap[p[c]]=o(p[c])};
|
6
|
+
window.heap=window.heap||[],heap.load=function(t,e){window.heap.appid=t,window.heap.config=e;var a=document.createElement("script");a.type="text/javascript",a.async=!0,a.src=("https:"===document.location.protocol?"https:":"http:")+"//cdn.heapanalytics.com/js/heap-"+t+".js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(a,n);for(var o=function(t){return function(){heap.push([t].concat(Array.prototype.slice.call(arguments,0)))}},p=["clearEventProperties","identify","setEventProperties","track","unsetEventProperty"],c=0;c<p.length;c++)heap[p[c]]=o(p[c])};
|
7
7
|
heap.load("#{Heap.app_id}");
|
8
8
|
}.html_safe
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
def heap_identify(
|
12
|
+
def heap_identify(handle, properties = nil)
|
13
13
|
body = properties.map {|k,v| ", #{k}: \"#{v}\""}.join if properties.is_a? Hash
|
14
14
|
javascript_tag do
|
15
|
-
raw %Q{heap.identify({
|
15
|
+
raw %Q{heap.identify({#{Heap.default_handle_type}: "#{handle}" #{body}});}.html_safe
|
16
16
|
end
|
17
|
-
|
18
17
|
end
|
19
18
|
end
|
20
19
|
end
|
data/test/helper.rb
CHANGED
@@ -21,6 +21,7 @@ rescue Bundler::BundlerError => e
|
|
21
21
|
end
|
22
22
|
|
23
23
|
require 'heap'
|
24
|
+
require 'heap/view_helpers'
|
24
25
|
require 'minitest/autorun'
|
25
26
|
require 'shoulda'
|
26
27
|
require 'webmock/minitest'
|
@@ -28,4 +29,4 @@ require 'webmock/minitest'
|
|
28
29
|
class MiniTest::Test
|
29
30
|
end
|
30
31
|
|
31
|
-
MiniTest.autorun
|
32
|
+
MiniTest.autorun
|
data/test/test_heap.rb
CHANGED
@@ -22,4 +22,14 @@ class TestHeap < MiniTest::Test
|
|
22
22
|
result = Heap.identify('test@example.com', :property1 => 'hello', :property2 => 'world')
|
23
23
|
assert_equal result.to_s, "{}"
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
|
+
should "default to email handler" do
|
27
|
+
assert_equal Heap.default_handle_type, 'email'
|
28
|
+
end
|
29
|
+
|
30
|
+
should "allow to change the handler" do
|
31
|
+
Heap.default_handle_type = 'handle'
|
32
|
+
assert_equal Heap.default_handle_type, 'handle'
|
33
|
+
Heap.default_handle_type = nil
|
34
|
+
end
|
35
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: heap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dennis de Reus
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -132,6 +132,7 @@ files:
|
|
132
132
|
- lib/heap/view_helpers.rb
|
133
133
|
- test/helper.rb
|
134
134
|
- test/test_heap.rb
|
135
|
+
- test/test_view_helper.rb
|
135
136
|
homepage: https://github.com/HectorMalot/heap
|
136
137
|
licenses:
|
137
138
|
- MIT
|