analytics-ruby 2.0.12 → 2.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +8 -13
- data/README.md +52 -0
- data/lib/segment/analytics/client.rb +0 -2
- data/lib/segment/analytics/version.rb +1 -1
- data/spec/segment/analytics/client_spec.rb +0 -8
- data/spec/segment/analytics_spec.rb +0 -8
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71d4951f83fc43ae93e330b35c97062bd9c8df64
|
4
|
+
data.tar.gz: 11e299db5daf757cba620a539fd827dd25a8436d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8439045c35184236fe21998035a6aa56b799b0d51246f7a52afc676511991eedb71001059ed81fc5f72f05debb1471ea4acc49cc9c4395f7844d010c35c9a95c
|
7
|
+
data.tar.gz: 3e5e394d1a0c569d37b8eccb85edc086ff6d7a94fb0eb8894764bafb57eaa01700ab7b2b64834052a17421e23b86396f8d9beca3fbcc67b824d6f2b4d615ea05
|
data/Gemfile.lock
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
analytics-ruby (2.0.
|
4
|
+
analytics-ruby (2.0.12)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: http://rubygems.org/
|
8
8
|
specs:
|
9
|
-
activesupport (3.2.
|
9
|
+
activesupport (3.2.21)
|
10
10
|
i18n (~> 0.6, >= 0.6.4)
|
11
11
|
multi_json (~> 1.0)
|
12
12
|
diff-lcs (1.2.5)
|
13
|
-
i18n (0.
|
14
|
-
multi_json (1.
|
13
|
+
i18n (0.7.0)
|
14
|
+
multi_json (1.11.1)
|
15
15
|
predicated (0.2.6)
|
16
|
-
rake (10.
|
16
|
+
rake (10.4.2)
|
17
17
|
rspec (2.14.1)
|
18
18
|
rspec-core (~> 2.14.0)
|
19
19
|
rspec-expectations (~> 2.14.0)
|
@@ -29,7 +29,6 @@ GEM
|
|
29
29
|
sexp_processor (~> 4.1)
|
30
30
|
sexp_processor (4.4.3)
|
31
31
|
thread_safe (0.3.4)
|
32
|
-
thread_safe (0.3.4-java)
|
33
32
|
tzinfo (1.2.1)
|
34
33
|
thread_safe (~> 0.1)
|
35
34
|
wrong (0.7.1)
|
@@ -38,15 +37,8 @@ GEM
|
|
38
37
|
ruby2ruby (>= 2.0.1)
|
39
38
|
ruby_parser (>= 3.0.1)
|
40
39
|
sexp_processor (>= 4.0)
|
41
|
-
wrong (0.7.1-java)
|
42
|
-
diff-lcs (~> 1.2.5)
|
43
|
-
predicated (~> 0.2.6)
|
44
|
-
ruby2ruby (>= 2.0.1)
|
45
|
-
ruby_parser (>= 3.0.1)
|
46
|
-
sexp_processor (>= 4.0)
|
47
40
|
|
48
41
|
PLATFORMS
|
49
|
-
java
|
50
42
|
ruby
|
51
43
|
|
52
44
|
DEPENDENCIES
|
@@ -56,3 +48,6 @@ DEPENDENCIES
|
|
56
48
|
rspec (~> 2.0)
|
57
49
|
tzinfo (= 1.2.1)
|
58
50
|
wrong (~> 0.0)
|
51
|
+
|
52
|
+
BUNDLED WITH
|
53
|
+
1.10.6
|
data/README.md
CHANGED
@@ -5,10 +5,62 @@ analytics-ruby
|
|
5
5
|
|
6
6
|
analytics-ruby is a ruby client for [Segment](https://segment.com)
|
7
7
|
|
8
|
+
## Install
|
9
|
+
|
10
|
+
Into Gemfile from rubygems.org:
|
11
|
+
```
|
12
|
+
gem 'analytics-ruby', :require => "segment"
|
13
|
+
```
|
14
|
+
|
15
|
+
Into environment gems from rubygems.org:
|
16
|
+
```
|
17
|
+
gem install 'analytics-ruby'
|
18
|
+
```
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
Create an instance of the Analytics object:
|
23
|
+
```
|
24
|
+
analytics = Segment::Analytics.new({
|
25
|
+
write_key: 'YOUR_WRITE_KEY'
|
26
|
+
})
|
27
|
+
```
|
28
|
+
|
29
|
+
Sample usage:
|
30
|
+
```
|
31
|
+
user = User.last
|
32
|
+
|
33
|
+
# Identify the user for the people section
|
34
|
+
analytics.identify(
|
35
|
+
{
|
36
|
+
user_id: user.id,
|
37
|
+
traits: {
|
38
|
+
email: user.email,
|
39
|
+
first_name: user.first_name,
|
40
|
+
last_name: user.last_name
|
41
|
+
}
|
42
|
+
}
|
43
|
+
)
|
44
|
+
|
45
|
+
# Track a user event
|
46
|
+
analytics.track(
|
47
|
+
{
|
48
|
+
user_id: user.id,
|
49
|
+
event: 'Created Account'
|
50
|
+
}
|
51
|
+
)
|
52
|
+
```
|
53
|
+
|
54
|
+
Refer to the section below for documenation on individual available calls.
|
55
|
+
|
8
56
|
## Documentation
|
9
57
|
|
10
58
|
Documentation is available at [segment.com/libraries/ruby](https://segment.com/libraries/ruby)
|
11
59
|
|
60
|
+
## Testing
|
61
|
+
|
62
|
+
You can use the `stub` option to Segment::Analytics.new to cause all requests to be stubbed, making it easier to test with this library.
|
63
|
+
|
12
64
|
## License
|
13
65
|
|
14
66
|
```
|
@@ -214,7 +214,6 @@ module Segment
|
|
214
214
|
timestamp = attrs[:timestamp] || Time.new
|
215
215
|
context = attrs[:context] || {}
|
216
216
|
|
217
|
-
fail ArgumentError, '.name must be a string' unless !name.empty?
|
218
217
|
fail ArgumentError, '.properties must be a hash' unless properties.is_a? Hash
|
219
218
|
isoify_dates! properties
|
220
219
|
|
@@ -255,7 +254,6 @@ module Segment
|
|
255
254
|
timestamp = attrs[:timestamp] || Time.new
|
256
255
|
context = attrs[:context] || {}
|
257
256
|
|
258
|
-
fail ArgumentError, '.name must be a string' if name.empty?
|
259
257
|
fail ArgumentError, '.properties must be a hash' unless properties.is_a? Hash
|
260
258
|
isoify_dates! properties
|
261
259
|
|
@@ -205,10 +205,6 @@ module Segment
|
|
205
205
|
expect { @client.page :name => 'foo' }.to raise_error(ArgumentError)
|
206
206
|
end
|
207
207
|
|
208
|
-
it 'should error without name' do
|
209
|
-
expect { @client.page :user_id => 1 }.to raise_error(ArgumentError)
|
210
|
-
end
|
211
|
-
|
212
208
|
it 'should not error with the required options' do
|
213
209
|
@client.page Queued::PAGE
|
214
210
|
end
|
@@ -227,10 +223,6 @@ module Segment
|
|
227
223
|
expect { @client.screen :name => 'foo' }.to raise_error(ArgumentError)
|
228
224
|
end
|
229
225
|
|
230
|
-
it 'should error without name' do
|
231
|
-
expect { A@client.screen :user_id => 1 }.to raise_error(ArgumentError)
|
232
|
-
end
|
233
|
-
|
234
226
|
it 'should not error with the required options' do
|
235
227
|
@client.screen Queued::SCREEN
|
236
228
|
end
|
@@ -67,10 +67,6 @@ module Segment
|
|
67
67
|
expect { analytics.page :name => 'foo' }.to raise_error(ArgumentError)
|
68
68
|
end
|
69
69
|
|
70
|
-
it 'should error without name' do
|
71
|
-
expect { analytics.page :user_id => 1 }.to raise_error(ArgumentError)
|
72
|
-
end
|
73
|
-
|
74
70
|
it 'should not error with the required options' do
|
75
71
|
analytics.page Queued::PAGE
|
76
72
|
sleep(1)
|
@@ -82,10 +78,6 @@ module Segment
|
|
82
78
|
expect { analytics.screen :name => 'foo' }.to raise_error(ArgumentError)
|
83
79
|
end
|
84
80
|
|
85
|
-
it 'should error without name' do
|
86
|
-
expect { analytics.screen :user_id => 1 }.to raise_error(ArgumentError)
|
87
|
-
end
|
88
|
-
|
89
81
|
it 'should not error with the required options' do
|
90
82
|
analytics.screen Queued::SCREEN
|
91
83
|
sleep(1)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: analytics-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Segment.io
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
133
|
version: '0'
|
134
134
|
requirements: []
|
135
135
|
rubyforge_project:
|
136
|
-
rubygems_version: 2.
|
136
|
+
rubygems_version: 2.4.5
|
137
137
|
signing_key:
|
138
138
|
specification_version: 4
|
139
139
|
summary: Segment.io analytics library
|