analytics-ruby 2.2.4.pre → 2.2.4

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
- SHA256:
3
- metadata.gz: 276383d9b3932f6d39493e74cf48ec05fb6805050c4031acd77a245e9b6e6d4e
4
- data.tar.gz: ebe9076f70b26805478f40a3c45bbf5c13bdd8de6083081651cbc1a3476f6e4b
2
+ SHA1:
3
+ metadata.gz: c55bcf75a346892371de08be7d1a4d2057b10b72
4
+ data.tar.gz: 0fd78bf8fee24b6743427bcc3ff6af294226dce3
5
5
  SHA512:
6
- metadata.gz: 9d5ba302e4d25b5155a8d273d8e9d406bce39e5bb906f205afd58c86fcd816f90512fb7117b6a19c98a5b7bde3d1b8c8e8158465a3c04154e6bfee9ca406602f
7
- data.tar.gz: 7b935c07754a56217f8735161bab41920bcd4b8bea94359c8a0d5cd04e0b2bb2d63ff3aff478eb72f6978922b63c00d22027f24949d0badef6e7b659b573f5c6
6
+ metadata.gz: 35da9088d4cbefe1d2b7cf61886a8d4c959387b9126b497413e6f36bf36d433b4cc2c18530fdd5a5c1eb7cae73a3618b65664e788452374e2084ae871752b8a1
7
+ data.tar.gz: 8139a32f6b66a108104e26ab3759e78760dabed2d443ec3e01cc29f1616eb6159beab5d8bea5dc6431ae2cb39696970caddb16f43d2ec9b406dcf1a8dfc5b810
data/History.md CHANGED
@@ -1,6 +1,11 @@
1
- 2.2.4.pre / 2018-02-04
1
+ 2.2.4 / 2018-04-30
2
2
  ==================
3
3
 
4
+ * Promote pre-release version to stable.
5
+
6
+ 2.2.4.pre / 2018-02-04
7
+ ======================
8
+
4
9
  * [Fix](https://github.com/segmentio/analytics-ruby/pull/147): Prevent 'batch
5
10
  size exceeded' errors by automatically batching
6
11
  items according to size
@@ -10,143 +10,84 @@ program :name, 'simulator.rb'
10
10
  program :version, '0.0.1'
11
11
  program :description, 'scripting simulator'
12
12
 
13
- # use an env var for write key, instead of a flag
14
- Analytics = Segment::Analytics.new({
15
- write_key: ENV['SEGMENT_WRITE_KEY'],
16
- on_error: Proc.new { |status, msg| print msg }
17
- })
18
-
19
- def toObject(str)
20
- return JSON.parse(str)
21
- end
22
-
23
- # high level
24
- # analytics <method> [options]
25
- # SEGMENT_WRITE_KEY=<write_key> ./analytics.rb <method> [options]
26
- # SEGMENT_WRITE_KEY=<write_key> ./analytics.rb track --event testing --user 1234 --anonymous 567 --properties '{"hello": "goodbye"}' --context '{"slow":"poke"}'
27
-
28
-
29
-
30
- # track
31
- command :track do |c|
32
- c.description = 'track a user event'
33
- c.option '--user <id>', String, 'the user id to send the event as'
34
- c.option '--event <event>', String, 'the event name to send with the event'
35
- c.option '--anonymous <id>', String, 'the anonymous user id to send the event as'
36
- c.option '--properties <data>', 'the event properties to send (JSON-encoded)'
37
- c.option '--context <data>', 'additional context for the event (JSON-encoded)'
38
-
39
- c.action do |args, options|
40
- Analytics.track({
41
- user_id: options.user,
42
- event: options.event,
43
- anonymous_id: options.anonymous,
44
- properties: toObject(options.properties),
45
- context: toObject(options.context)
46
- })
47
- Analytics.flush
13
+ def json_hash(str)
14
+ if str
15
+ return JSON.parse(str)
48
16
  end
49
-
50
17
  end
51
18
 
52
- # page
53
- command :page do |c|
54
- c.description = 'track a page view'
55
- c.option '--user <id>', String, 'the user id to send the event as'
56
- c.option '--anonymous <id>', String, 'the anonymous user id to send the event as'
57
- c.option '--name <name>', String, 'the page name'
58
- c.option '--properties <data>', 'the event properties to send (JSON-encoded)'
59
- c.option '--context <data>', 'additional context for the event (JSON-encoded)'
60
- c.option '--category <category>', 'the category of the page'
61
- c.action do |args, options|
62
- Analytics.page({
63
- user_id: options.user,
64
- anonymous_id: options.anonymous,
65
- name: options.name,
66
- properties: toObject(options.properties),
67
- context: toObject(options.context),
68
- category: options.category
69
- })
70
- Analytics.flush
71
- end
19
+ # analytics -method=<method> -segment-write-key=<segmentWriteKey> [options]
72
20
 
73
- end
21
+ default_command :send
74
22
 
75
- # identify
76
- command :identify do |c|
77
- c.description = 'identify a user'
78
- c.option '--user <id>', String, 'the user id to send the event as'
79
- c.option '--anonymous <id>', String, 'the anonymous user id to send the event as'
80
- c.option '--traits <data>', String, 'the user traits to send (JSON-encoded)'
81
- c.option '--context <data>', 'additional context for the event (JSON-encoded)'
82
- c.action do |args, options|
83
- Analytics.identify({
84
- user_id: options.user,
85
- anonymous_id: options.anonymous,
86
- traits: toObject(options.traits),
87
- context: toObject(options.context)
88
- })
89
- Analytics.flush
90
- end
23
+ command :send do |c|
24
+ c.description = 'send a segment message'
91
25
 
92
- end
26
+ c.option '--writeKey=<writeKey>', String, 'the Segment writeKey'
27
+ c.option '--type=<type>', String, 'The Segment message type'
93
28
 
94
- # screen
95
- command :screen do |c|
96
- c.description = 'track a screen view'
97
- c.option '--user <id>', String, 'the user id to send the event as'
98
- c.option '--anonymous <id>', String, 'the anonymous user id to send the event as'
99
- c.option '--name <name>', String, 'the screen name'
100
- c.option '--properties <data>', String, 'the event properties to send (JSON-encoded)'
101
- c.option '--context <data>', 'additional context for the event (JSON-encoded)'
102
- c.action do |args, options|
103
- Analytics.identify({
104
- user_id: options.user,
105
- anonymous_id: options.anonymous,
106
- name: option.name,
107
- traits: toObject(options.traits),
108
- properties: toObject(option.properties),
109
- context: toObject(options.context)
110
- })
111
- Analytics.flush
112
- end
29
+ c.option '--userId=<userId>', String, 'the user id to send the event as'
30
+ c.option '--anonymousId=<anonymousId>', String, 'the anonymous user id to send the event as'
31
+ c.option '--context=<context>', 'additional context for the event (JSON-encoded)'
113
32
 
114
- end
33
+ c.option '--event=<event>', String, 'the event name to send with the event'
34
+ c.option '--properties=<properties>', 'the event properties to send (JSON-encoded)'
115
35
 
36
+ c.option '--name=<name>', 'name of the screen or page to send with the message'
116
37
 
117
- # group
118
- command :group do |c|
119
- c.description = 'identify a group of users'
120
- c.option '--user <id>', String, 'the user id to send the event as'
121
- c.option '--anonymous <id>', String, 'the anonymous user id to send the event as'
122
- c.option '--group <id>', String, 'the group id to associate this user with'
123
- c.option '--traits <data>', String, 'attributes about the group (JSON-encoded)'
124
- c.option '--context <data>', 'additional context for the event (JSON-encoded)'
125
- c.action do |args, options|
126
- Analytics.group({
127
- user_id: options.user,
128
- anonymous_id: options.anonymous,
129
- group_id: options.group,
130
- traits: toObject(options.traits),
131
- context: toObject(options.context)
132
- })
133
- Analytics.flush
134
- end
38
+ c.option '--traits=<traits>', 'the identify/group traits to send (JSON-encoded)'
135
39
 
136
- end
40
+ c.option '--groupId=<groupId>', String, 'the group id'
137
41
 
138
- # alias
139
- command :alias do |c|
140
- c.description = 'remap a user to a new id'
141
- c.option '--user <id>', String, 'the user id to send the event as'
142
- c.option '--previous <id>', String, 'the previous user id (to add the alias for)'
143
42
  c.action do |args, options|
144
- Analytics.alias({
145
- user_id: options.user,
146
- previous_id: options.previous
147
- })
43
+ Analytics = Segment::Analytics.new({
44
+ write_key: options.writeKey,
45
+ on_error: Proc.new { |status, msg| print msg }
46
+ })
47
+
48
+ case options.type
49
+ when "track"
50
+ Analytics.track({
51
+ user_id: options.userId,
52
+ event: options.event,
53
+ anonymous_id: options.anonymousId,
54
+ properties: json_hash(options.properties),
55
+ context: json_hash(options.context)
56
+ })
57
+ when "page"
58
+ Analytics.page({
59
+ user_id: options.userId,
60
+ anonymous_id: options.anonymousId,
61
+ name: options.name,
62
+ properties: json_hash(options.properties),
63
+ context: json_hash(options.context)
64
+ })
65
+ when "screen"
66
+ Analytics.screen({
67
+ user_id: options.userId,
68
+ anonymous_id: options.anonymousId,
69
+ name: option.name,
70
+ traits: json_hash(options.traits),
71
+ properties: json_hash(option.properties)
72
+ })
73
+ when "identify"
74
+ Analytics.identify({
75
+ user_id: options.userId,
76
+ anonymous_id: options.anonymousId,
77
+ traits: json_hash(options.traits),
78
+ context: json_hash(options.context)
79
+ })
80
+ when "group"
81
+ Analytics.group({
82
+ user_id: options.userId,
83
+ anonymous_id: options.anonymousId,
84
+ group_id: options.groupId,
85
+ traits: json_hash(options.traits),
86
+ context: json_hash(options.context)
87
+ })
88
+ else
89
+ raise "Invalid Message Type #{options.type}"
90
+ end
148
91
  Analytics.flush
149
92
  end
150
-
151
93
  end
152
-
@@ -1,5 +1,5 @@
1
1
  module Segment
2
2
  class Analytics
3
- VERSION = '2.2.4.pre'
3
+ VERSION = '2.2.4'
4
4
  end
5
5
  end
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.2.4.pre
4
+ version: 2.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Segment.io
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-15 00:00:00.000000000 Z
11
+ date: 2018-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander
@@ -192,12 +192,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
192
192
  version: '0'
193
193
  required_rubygems_version: !ruby/object:Gem::Requirement
194
194
  requirements:
195
- - - ">"
195
+ - - ">="
196
196
  - !ruby/object:Gem::Version
197
- version: 1.3.1
197
+ version: '0'
198
198
  requirements: []
199
199
  rubyforge_project:
200
- rubygems_version: 2.7.5
200
+ rubygems_version: 2.6.14
201
201
  signing_key:
202
202
  specification_version: 4
203
203
  summary: Segment.io analytics library