heap 0.2.0 → 0.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d744f1219db0c3007df69dd94f39c0b1850638bc
4
- data.tar.gz: 51dbfcc6932734701355ce03ae8e75dbbaa171d6
3
+ metadata.gz: 992e7bd97687607e875d6e2dac4707d7960e7291
4
+ data.tar.gz: a6427ae5dc85adf302fc2c93678645de9bf689b6
5
5
  SHA512:
6
- metadata.gz: 3fee957cce4f2c73d599457071c86a0a1bdc7d71f60cab29768c7390910d9222e51eb4c102284f8e685eee548fa84eb367f5d72f3744fd831302d4eeddf8530f
7
- data.tar.gz: a5eb712028103a1143b477d97115e9fb66c759dd2eed4f5fb0cbff5c6fa8f694b78560519e05168eaca5bbab592f1a1e97b7b1763b59cc8ca9ae9702a1254dfd
6
+ metadata.gz: 3324a105c31d73f7e4bea0133abac9bbd420b99d51b868b439b329095760c345d42b1161e8dae6db60f990b1863c8963a0826d7e165944934c072476df137625
7
+ data.tar.gz: fa93c36b25573134b8599296f774a2d44bfeb6e5d472fcd437dba328e17cbb65fccb6f46259527b1970fbcb10a9cda44b71736b8dc6857a1c3ee6064d19e3c3d
@@ -72,6 +72,16 @@ Example:
72
72
 
73
73
  Heap.identify("user@example.com", segment:'ruby developers', age: 25)
74
74
 
75
+ ### Advanced load configuration
76
+
77
+ When calling 'heap_analytics', you may set additional advanced configuration options (such as secure cookies, enabling SSL, and disabling text capture). The helper takes an optional argument:
78
+
79
+ * [Hash, optional] properties: A hash containing additional configuration options (Hashes with multiple levels are currently not supported)
80
+
81
+ Example:
82
+
83
+ <%= heap_analytics(forceSSL: true, secureCookie: true, disableTextCapture: true) %>
84
+
75
85
  ## Contributing to Heap
76
86
 
77
87
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
@@ -87,4 +97,3 @@ Example:
87
97
  The Heap gem is licensed under the MIT license. Copyright (c) 2014 Dennis de Reus. See LICENSE.txt for further details.
88
98
 
89
99
  The Heap gem is a personal project and not affiliated to heapanalytics.com
90
-
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.3.0
@@ -2,19 +2,20 @@
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.2.0 ruby lib
5
+ # stub: heap 0.3.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "heap"
9
- s.version = "0.2.0"
9
+ s.version = "0.3.0"
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 = "2015-04-04"
14
+ s.date = "2015-09-04"
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 = [
18
+ "CHANGELOG.mdown",
18
19
  "LICENSE.txt",
19
20
  "README.mdown"
20
21
  ]
@@ -40,7 +41,7 @@ Gem::Specification.new do |s|
40
41
  ]
41
42
  s.homepage = "https://github.com/HectorMalot/heap"
42
43
  s.licenses = ["MIT"]
43
- s.rubygems_version = "2.2.2"
44
+ s.rubygems_version = "2.4.6"
44
45
  s.summary = "Easy integration of heapanalytics into your ruby app"
45
46
 
46
47
  if s.respond_to? :specification_version then
@@ -2,10 +2,11 @@ require 'json'
2
2
 
3
3
  class Heap
4
4
  module ViewHelpers
5
- def heap_analytics
5
+ def heap_analytics(properties = {})
6
+ config = properties.map {|k,v| "#{k}: #{v}"}.join(", ") if properties.is_a? Hash
6
7
  heap_js_block %Q{
7
- 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])};
8
- heap.load("#{Heap.app_id}");
8
+ window.heap=window.heap||[],heap.load=function(e,t){window.heap.appid=e,window.heap.config=t=t||{};var n=t.forceSSL||"https:"===document.location.protocol,a=document.createElement("script");a.type="text/javascript",a.async=!0,a.src=(n?"https:":"http:")+"//cdn.heapanalytics.com/js/heap-"+e+".js";var o=document.getElementsByTagName("script")[0];o.parentNode.insertBefore(a,o);for(var r=function(e){return function(){heap.push([e].concat(Array.prototype.slice.call(arguments,0)))}},p=["clearEventProperties","identify","setEventProperties","track","unsetEventProperty"],c=0;c<p.length;c++)heap[p[c]]=r(p[c])};
9
+ heap.load("#{Heap.app_id}", {#{config}});
9
10
  }
10
11
  end
11
12
 
@@ -31,4 +31,17 @@ class HeapHelperTest < MiniTest::Test
31
31
 
32
32
  assert_equal js, %Q/heap.setEventProperties({"first":"first value","second":2,"third":true});/
33
33
  end
34
+
35
+ should "set load properties key-value pairs" do
36
+
37
+ Heap.app_id = '123'
38
+
39
+ js = heap_analytics({
40
+ forceSSL: true,
41
+ secureCookie: true,
42
+ disableTextCapture: true
43
+ })
44
+
45
+ assert_includes js, %Q/heap.load("123", {forceSSL: true, secureCookie: true, disableTextCapture: true});/
46
+ end
34
47
  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.2.0
4
+ version: 0.3.0
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: 2015-04-04 00:00:00.000000000 Z
11
+ date: 2015-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -113,6 +113,7 @@ email: dennisdereus@gmail.com
113
113
  executables: []
114
114
  extensions: []
115
115
  extra_rdoc_files:
116
+ - CHANGELOG.mdown
116
117
  - LICENSE.txt
117
118
  - README.mdown
118
119
  files:
@@ -154,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
155
  version: '0'
155
156
  requirements: []
156
157
  rubyforge_project:
157
- rubygems_version: 2.2.2
158
+ rubygems_version: 2.4.6
158
159
  signing_key:
159
160
  specification_version: 4
160
161
  summary: Easy integration of heapanalytics into your ruby app