clickstream 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a0a3540d2bb32230a701e96604bc9373f324a1c0
4
- data.tar.gz: cb89f0d5ebdc17d813de72850d600e3d2afdd558
3
+ metadata.gz: b177f0fe0ef323f364ad0005eb6f408527819fc6
4
+ data.tar.gz: 99d44b508aebdccaa494c42e394de60dcbfd3108
5
5
  SHA512:
6
- metadata.gz: e755219b1e4145876c81cbca82b7f6704e7a958c6cac1b667effd4a916a01dfbba7b723f1737f8f78082a744163f6bae36dcaa18e18c82606dbea483fd928bbd
7
- data.tar.gz: e26ed131e5ef6db5b7dec9cb0472dbe494d24fed6476f2e8d85d838feb059ca274fc803da50a13f42532165920dc544f4ed4568afe03b18f773ca962fe4c1c98
6
+ metadata.gz: 4240b6efdeb1c4b0460fff8bdf7d84506627043353562e4c1eabe4f8a4030dc4bb1a0f04fe3fd9602d57828f030c82286004e5ca47582fefae381160f99dd844
7
+ data.tar.gz: 65c19973f6c99d91062479290b82796939ca56d49c67eae935e643a65090312baa935bac411992387938e863995bae344ce5199934fa7df28c75d97a3ecb137d
@@ -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(/clickstream=([^;]*)/)
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, @cookie_name, cookie)
107
+ Rack::Utils.set_cookie_header!(headers, COOKIE_NAME, cookie)
108
108
  cookie[:value]
109
109
  end
110
110
 
@@ -1,3 +1,3 @@
1
1
  module Clickstream
2
- VERSION = '0.3.0'
2
+ VERSION = '0.3.1'
3
3
  end
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.0
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/jtblin/clickstream-rb
73
+ homepage: http://github.com/clickstream/clickstream-rb
74
74
  licenses:
75
75
  - BSD
76
76
  metadata: {}