meta_events 1.0.2 → 1.0.3

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
- ---
2
- SHA1:
3
- data.tar.gz: 463ed55b0baf280ad2558b526c2d06cd78dc5ef8
4
- metadata.gz: 4883769055fc1db0206a278ba5dc382cb2c711e3
5
- SHA512:
6
- data.tar.gz: 9dbe5bd43bf131c893c5b799afe3838775018a7dbcb8d349214ca8c126adc78ac9befcd428cfe068d708ae146dde01b5b32e26de4605bfaadeb34a2baa33cc08
7
- metadata.gz: cff9954c133137b9fa77cecec136029a0e39b76decbf17c7bc60f82189c8c67ebc8ccf0135c0faac8a4737c20a89f20feda4f4d45f74e55dbc8445b0af03735d
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b0e91bff1639de3f7c06814202408e65284d049e
4
+ data.tar.gz: 44e8e53c21fef0ed5d59264359e695f8f63735a9
5
+ SHA512:
6
+ metadata.gz: 347f0e4b5bb972dc9eb0ea40f636edc5a73c6f956def29db094beeb3c906d9bc88e58557163a40f114946e755f47e36d901d65ed9ec2ed02a5aa196fe0eb2003
7
+ data.tar.gz: 4afaffbe07364ff7f2c8601108c5e440dd0dccd69c5d46233671a076710b1d4998e44055beba7525b1a05ccad05352aec231b29458a4751cb6acd66b521e66ab
data/CHANGES.md ADDED
@@ -0,0 +1,7 @@
1
+ # `meta_events` Changelog
2
+
3
+ ## 1.0.3,
4
+
5
+ * Fixed an issue where the `TestReceiver`'s `Rails.logger` reference could happen before `Rails.logger` was actually loaded, causing an exception. (Thanks to [Jesse Rusak](https://github.com/jder)!)
6
+ * Fixed a minor documentation bug (Thanks to [Jesse Rusak](https://github.com/jder)!)
7
+ * Added Changelog.
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014 Andrew Geweke
1
+ Copyright (c) 2014 Swiftype, Inc.
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -11,6 +11,8 @@ particularly dependent on exact Ruby versions, and should be compatible with a b
11
11
 
12
12
  Current build status: ![Current Build Status](https://api.travis-ci.org/swiftype/meta_events.png?branch=master)
13
13
 
14
+ Brought to you by the folks at [Swiftype](https://www.swiftype.com/). First version written by [Andrew Geweke](https://www.github.com/ageweke).
15
+
14
16
  ### Background
15
17
 
16
18
  Sending user-centric events to (_e.g._) Mixpanel is far from difficult; it's a single method call. However, in a
@@ -90,8 +92,8 @@ uses this for doing geolocation of users:
90
92
 
91
93
  class ApplicationController < ActionController::Base
92
94
  ...
93
- def event_tracker
94
- @event_tracker ||= MetaEvents::Tracker.new(current_user.try(:id), request.remote_ip)
95
+ def meta_events_tracker
96
+ @meta_events_tracker ||= MetaEvents::Tracker.new(current_user.try(:id), request.remote_ip)
95
97
  end
96
98
  ...
97
99
  end
@@ -102,7 +104,7 @@ Now, from the controller, we can fire an event and pass a couple of properties:
102
104
  ...
103
105
  def create
104
106
  ...
105
- event_tracker.event!(:user, :signed_up, { :user_gender => @new_user.gender, :user_age => @new_user.age })
107
+ meta_events_tracker.event!(:user, :signed_up, { :user_gender => @new_user.gender, :user_age => @new_user.age })
106
108
  ...
107
109
  end
108
110
  ...
@@ -114,7 +116,7 @@ _event receivers_.
114
116
  ### Hooking Up Mixpanel and a Test Receiver
115
117
 
116
118
  An _event receiver_ is any object that responds to a method `#track(distinct_id, event_name, event_properties)`, where
117
- `distinct_id` is the distinct ID of the user, `event_name` is a `String` and `event_name` is a Hash mapping `String`
119
+ `distinct_id` is the distinct ID of the user, `event_name` is a `String` and `event_properties` is a Hash mapping `String`
118
120
  property names to simple scalar values &mdash; `true`, `false`, `nil`, numbers (all `Numeric`s, including both
119
121
  integers and floating-point numbers, are supported), `String`s (and `Symbol`s will be converted to `String`s
120
122
  transparently), and `Time` objects.
@@ -372,7 +374,7 @@ You could add these to every single call to `#event!`, but MetaEvents has a bett
372
374
 
373
375
  class ApplicationController < ActionController::Base
374
376
  ...
375
- def event_tracker
377
+ def meta_events_tracker
376
378
  implicit_properties = { }
377
379
  if current_user
378
380
  implicit_properties.merge!(
@@ -380,8 +382,8 @@ You could add these to every single call to `#event!`, but MetaEvents has a bett
380
382
  :user_age => current_user.age
381
383
  )
382
384
  end
383
- @event_tracker ||= MetaEvents::Tracker.new(current_user.try(:id), request.remote_ip,
384
- :implicit_properties => implicit_properties)
385
+ @meta_events_tracker ||= MetaEvents::Tracker.new(current_user.try(:id), request.remote_ip,
386
+ :implicit_properties => implicit_properties)
385
387
  end
386
388
  ...
387
389
  end
@@ -398,7 +400,7 @@ properties that are defined on it. For example, imagine we have an event trigger
398
400
  another user. We have at least three entities: the 'from' user, the 'to' user, and the message itself. If we really
399
401
  want to instrument this event properly, we're going to want something like this:
400
402
 
401
- event_tracker.event!(:user, :sent_message, {
403
+ meta_events_tracker.event!(:user, :sent_message, {
402
404
  :from_user_country => from_user.country,
403
405
  :from_user_state => from_user.state,
404
406
  :from_user_postcode => from_user.postcode,
@@ -462,7 +464,7 @@ automatically expanded and their names prefixed by the outer hash key. So let's
462
464
 
463
465
  Now, we can pass the exact same set of properties as the above example, by simply doing:
464
466
 
465
- event_tracker.event!(:user, :sent_message, {
467
+ meta_events_tracker.event!(:user, :sent_message, {
466
468
  :from_user => from_user.to_event_properties,
467
469
  :to_user => to_user.to_event_properties,
468
470
  :message => message.to_event_properties
@@ -476,7 +478,7 @@ And &mdash; tah-dah! &mdash; MetaEvents supports this syntax automatically. If y
476
478
  that object defines a method called `#to_event_properties`, then it will be called automatically, and replaced.
477
479
  Our code now looks like:
478
480
 
479
- event_tracker.event!(:user, :sent_message, { :from_user => from_user, :to_user => to_user, :message => message })
481
+ meta_events_tracker.event!(:user, :sent_message, { :from_user => from_user, :to_user => to_user, :message => message })
480
482
 
481
483
  ### How to Take the Most Advantage
482
484
 
@@ -9,7 +9,7 @@ module MetaEvents
9
9
  # This object is useful for watching and debugging events in development environments.
10
10
  class TestReceiver
11
11
  def initialize(target = nil, &block)
12
- @target = target || block || ::Rails.logger
12
+ @target = target || block || lambda { |string| ::Rails.logger.info(string) }
13
13
  end
14
14
 
15
15
  def track(distinct_id, event_name, properties)
@@ -1,3 +1,3 @@
1
1
  module MetaEvents
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
metadata CHANGED
@@ -1,82 +1,101 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: meta_events
3
- version: !ruby/object:Gem::Version
4
- version: 1.0.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.3
5
5
  platform: ruby
6
- authors:
6
+ authors:
7
7
  - Andrew Geweke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
-
12
- date: 2014-02-18 00:00:00 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
11
+ date: 2014-03-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
15
14
  name: json
16
- prerelease: false
17
- requirement: &id001 !ruby/object:Gem::Requirement
18
- requirements:
19
- - - ~>
20
- - !ruby/object:Gem::Version
21
- version: "1.0"
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
22
20
  type: :runtime
23
- version_requirements: *id001
24
- - !ruby/object:Gem::Dependency
25
- name: activesupport
26
21
  prerelease: false
27
- requirement: &id002 !ruby/object:Gem::Requirement
28
- requirements:
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: activesupport
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
29
31
  - - ">="
30
- - !ruby/object:Gem::Version
31
- version: "3.0"
32
- - - <
33
- - !ruby/object:Gem::Version
34
- version: "4.0"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.0'
34
+ - - "<="
35
+ - !ruby/object:Gem::Version
36
+ version: 4.99.99
35
37
  type: :runtime
36
- version_requirements: *id002
37
- - !ruby/object:Gem::Dependency
38
- name: bundler
39
38
  prerelease: false
40
- requirement: &id003 !ruby/object:Gem::Requirement
41
- requirements:
42
- - - ~>
43
- - !ruby/object:Gem::Version
44
- version: "1.5"
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '3.0'
44
+ - - "<="
45
+ - !ruby/object:Gem::Version
46
+ version: 4.99.99
47
+ - !ruby/object:Gem::Dependency
48
+ name: bundler
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '1.5'
45
54
  type: :development
46
- version_requirements: *id003
47
- - !ruby/object:Gem::Dependency
48
- name: rake
49
55
  prerelease: false
50
- requirement: &id004 !ruby/object:Gem::Requirement
51
- requirements:
52
- - &id006
53
- - ">="
54
- - !ruby/object:Gem::Version
55
- version: "0"
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '1.5'
61
+ - !ruby/object:Gem::Dependency
62
+ name: rake
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
56
68
  type: :development
57
- version_requirements: *id004
58
- - !ruby/object:Gem::Dependency
59
- name: rspec
60
69
  prerelease: false
61
- requirement: &id005 !ruby/object:Gem::Requirement
62
- requirements:
63
- - - ~>
64
- - !ruby/object:Gem::Version
65
- version: "2.14"
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ - !ruby/object:Gem::Dependency
76
+ name: rspec
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '2.14'
66
82
  type: :development
67
- version_requirements: *id005
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '2.14'
68
89
  description:
69
- email:
90
+ email:
70
91
  - ageweke@swiftype.com
71
92
  executables: []
72
-
73
93
  extensions: []
74
-
75
94
  extra_rdoc_files: []
76
-
77
- files:
78
- - .gitignore
79
- - .travis.yml
95
+ files:
96
+ - ".gitignore"
97
+ - ".travis.yml"
98
+ - CHANGES.md
80
99
  - Gemfile
81
100
  - LICENSE.txt
82
101
  - README.md
@@ -102,29 +121,31 @@ files:
102
121
  - spec/meta_events/tracker_spec.rb
103
122
  - vendor/assets/javascripts/meta_events.js.erb
104
123
  homepage: http://www.github.com/swiftype/meta_events
105
- licenses:
124
+ licenses:
106
125
  - MIT
107
126
  metadata: {}
108
-
109
127
  post_install_message:
110
128
  rdoc_options: []
111
-
112
- require_paths:
129
+ require_paths:
113
130
  - lib
114
- required_ruby_version: !ruby/object:Gem::Requirement
115
- requirements:
116
- - *id006
117
- required_rubygems_version: !ruby/object:Gem::Requirement
118
- requirements:
119
- - *id006
131
+ required_ruby_version: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
136
+ required_rubygems_version: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
120
141
  requirements: []
121
-
122
142
  rubyforge_project:
123
- rubygems_version: 2.0.14
143
+ rubygems_version: 2.2.1
124
144
  signing_key:
125
145
  specification_version: 4
126
- summary: Structured, documented, powerful event emitting library for Mixpanel and other such systems.
127
- test_files:
146
+ summary: Structured, documented, powerful event emitting library for Mixpanel and
147
+ other such systems.
148
+ test_files:
128
149
  - spec/meta_events/controller_methods_and_helpers_spec.rb
129
150
  - spec/meta_events/definition/category_spec.rb
130
151
  - spec/meta_events/definition/definition_set_spec.rb