clickstream 0.3.0 → 0.3.1
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/lib/clickstream/capture.rb +4 -4
- data/lib/clickstream/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b177f0fe0ef323f364ad0005eb6f408527819fc6
|
4
|
+
data.tar.gz: 99d44b508aebdccaa494c42e394de60dcbfd3108
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4240b6efdeb1c4b0460fff8bdf7d84506627043353562e4c1eabe4f8a4030dc4bb1a0f04fe3fd9602d57828f030c82286004e5ca47582fefae381160f99dd844
|
7
|
+
data.tar.gz: 65c19973f6c99d91062479290b82796939ca56d49c67eae935e643a65090312baa935bac411992387938e863995bae344ce5199934fa7df28c75d97a3ecb137d
|
data/lib/clickstream/capture.rb
CHANGED
@@ -10,6 +10,8 @@ module Clickstream
|
|
10
10
|
attr_reader :client, :filter_params, :filter_uri
|
11
11
|
|
12
12
|
FORMAT = %{[Clickstream #{Clickstream::VERSION}] [%s] %s - %s "%s%s %s\n}
|
13
|
+
COOKIE_NAME = 'clickstream.io'.freeze
|
14
|
+
COOKIE_REGEX = Regexp.new("#{COOKIE_NAME}=([^;]*)").freeze
|
13
15
|
|
14
16
|
def initialize(app, opts={})
|
15
17
|
@app = app
|
@@ -23,7 +25,6 @@ module Clickstream
|
|
23
25
|
@filter_params = opts[:filter_params] || []
|
24
26
|
@filter_uri = opts[:filter_uri] || []
|
25
27
|
|
26
|
-
@cookie_name = 'clickstream.io'
|
27
28
|
filter_params.concat(Rails.configuration.filter_parameters || []) if defined?(Rails)
|
28
29
|
|
29
30
|
Clickstream.logger = opts[:logger] if opts[:logger]
|
@@ -31,7 +32,6 @@ module Clickstream
|
|
31
32
|
raise ArgumentError, 'API key missing.' if api_key.nil?
|
32
33
|
|
33
34
|
@inspector = Clickstream::Inspector.new api_key, api_uri, crawlers, capture_crawlers, filter_params
|
34
|
-
@cookie_regex = Regexp.new "#{@cookie_name}="
|
35
35
|
|
36
36
|
@client = {}
|
37
37
|
Clickstream::APIClient.new(api_key, api_uri).handshake { |k, v| @client[k] = v}
|
@@ -96,7 +96,7 @@ module Clickstream
|
|
96
96
|
|
97
97
|
def extract_cookie(string)
|
98
98
|
return unless string
|
99
|
-
match = string.match(
|
99
|
+
match = string.match(COOKIE_REGEX)
|
100
100
|
match[1] if match && match.length > 1
|
101
101
|
end
|
102
102
|
|
@@ -104,7 +104,7 @@ module Clickstream
|
|
104
104
|
expires = Time.now+60*60
|
105
105
|
cookie = cookie.nil? ? {value: SecureRandom.uuid} : {value: cookie}
|
106
106
|
cookie[:expires] = expires
|
107
|
-
Rack::Utils.set_cookie_header!(headers,
|
107
|
+
Rack::Utils.set_cookie_header!(headers, COOKIE_NAME, cookie)
|
108
108
|
cookie[:value]
|
109
109
|
end
|
110
110
|
|
data/lib/clickstream/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clickstream
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jerome Touffe-Blin
|
@@ -70,7 +70,7 @@ files:
|
|
70
70
|
- lib/clickstream.rb
|
71
71
|
- LICENSE
|
72
72
|
- README.md
|
73
|
-
homepage: http://github.com/
|
73
|
+
homepage: http://github.com/clickstream/clickstream-rb
|
74
74
|
licenses:
|
75
75
|
- BSD
|
76
76
|
metadata: {}
|