analytics-ruby 0.5.3 → 0.5.4

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.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- analytics-ruby (0.5.2)
4
+ analytics-ruby (0.5.4)
5
5
  faraday (>= 0.8, < 0.10)
6
6
  faraday_middleware (>= 0.8, < 0.10)
7
7
  multi_json (~> 1.0)
data/History.md CHANGED
@@ -1,3 +1,7 @@
1
+ 0.5.4 / 2013-12-31
2
+ ==================
3
+ * Add `requestId` fields to all requests for tracing.
4
+
1
5
  0.5.3 / 2013-12-31
2
6
  ==================
3
7
  * Allow the consumer thread to shut down so it won't remain live in hot deploy scenarios. This fixes the jruby memory leak by [@nirvdrum](https://github.com/nirvdrum)
@@ -12,7 +16,7 @@
12
16
 
13
17
  0.5.0 / 2013-10-03
14
18
  ==================
15
- * Removing global Analytics alias in favor of adding it to our config. NOTE: If you are upgrading from a previous version and want to continue using the `Analytics` namespace, you'll have to add `Analytics = AnalyticsRuby` to your config. See the [setup docs for more info](https://segment.io/libraries/ruby)
19
+ * Removing global Analytics alias in favor of adding it to our config. NOTE: If you are upgrading from a previous version and want to continue using the `Analytics` namespace, you'll have to add `Analytics = AnalyticsRuby` to your config. Otherwise you WILL NOT be sending analytics data. See the [setup docs for more info](https://segment.io/libraries/ruby)
16
20
 
17
21
  0.4.0 / 2013-08-30
18
22
  ==================
@@ -138,11 +138,8 @@ module AnalyticsRuby
138
138
  # :timestamp - Time of when the alias occured (optional)
139
139
  # :context - Hash of context (optional)
140
140
  def alias(options)
141
-
142
141
  check_secret
143
-
144
142
  Util.symbolize_keys! options
145
-
146
143
  from = options[:from].to_s
147
144
  to = options[:to].to_s
148
145
  timestamp = options[:timestamp] || Time.new
@@ -151,7 +148,6 @@ module AnalyticsRuby
151
148
  ensure_user from
152
149
  ensure_user to
153
150
  check_timestamp timestamp
154
-
155
151
  add_context context
156
152
 
157
153
  enqueue({
@@ -176,6 +172,9 @@ module AnalyticsRuby
176
172
  #
177
173
  # returns Boolean of whether the item was added to the queue.
178
174
  def enqueue(action)
175
+ # add our request id for tracing purposes
176
+ action[:requestId] = Util.uid
177
+
179
178
  queue_full = @queue.length >= @max_queue_size
180
179
  @queue << action unless queue_full
181
180
 
@@ -1,16 +1,26 @@
1
1
  module Util
2
+
3
+ # public: Return a new hash with keys converted from strings to symbols
4
+ #
2
5
  def self.symbolize_keys(hash)
3
6
  hash.inject({}) { |memo, (k,v)| memo[k.to_sym] = v; memo }
4
7
  end
5
8
 
9
+ # public: Convert hash keys from strings to symbols in place
10
+ #
6
11
  def self.symbolize_keys!(hash)
7
12
  hash.replace symbolize_keys hash
8
13
  end
9
14
 
15
+ # public: Return a new hash with keys as strings
16
+ #
10
17
  def self.stringify_keys(hash)
11
18
  hash.inject({}) { |memo, (k,v)| memo[k.to_s] = v; memo }
12
19
  end
13
20
 
21
+ # public: Returns a new hash with all the date values in the into iso8601
22
+ # strings
23
+ #
14
24
  def self.isoify_dates(hash)
15
25
  hash.inject({}) { |memo, (k, v)|
16
26
  memo[k] = v.respond_to?(:iso8601) ? v.iso8601 : v
@@ -18,7 +28,15 @@ module Util
18
28
  }
19
29
  end
20
30
 
31
+ # public: Converts all the date values in the into iso8601 strings in place
32
+ #
21
33
  def self.isoify_dates!(hash)
22
34
  hash.replace isoify_dates hash
23
35
  end
36
+
37
+ # public: Returns a uid string
38
+ #
39
+ def self.uid
40
+ (0..16).to_a.map{|x| rand(16).to_s(16)}.join
41
+ end
24
42
  end
@@ -1,3 +1,3 @@
1
1
  module AnalyticsRuby
2
- VERSION = '0.5.3'
2
+ VERSION = '0.5.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: analytics-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -109,7 +109,6 @@ executables: []
109
109
  extensions: []
110
110
  extra_rdoc_files: []
111
111
  files:
112
- - analytics-ruby-0.5.2.gem
113
112
  - analytics-ruby.gemspec
114
113
  - Gemfile
115
114
  - Gemfile.lock
Binary file