sensors_analytics_sdk 1.5.0 → 1.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sensors_analytics_sdk.rb +10 -9
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d61ecc7feae4458ed05b347014b88534a986526
|
4
|
+
data.tar.gz: 38240f2a68545c09b9ad8dc2b32dff683fb2cd1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89e49fd968067427db7b85648ccceb309dcc684f329b33d59f034253195126044c4db28872016fc958bcfbb058df75edc96579ed21b016a12cf721a84d06e7da
|
7
|
+
data.tar.gz: 8895ebdc616efa15893decc7098d3bf3f405d80c8512d23c5ba537445b25ee59f852c10b8020d7a2c4169b75b56b5d9445cb9aeb1e715c135e0d759832e51b64
|
@@ -5,7 +5,7 @@ require 'zlib'
|
|
5
5
|
|
6
6
|
module SensorsAnalytics
|
7
7
|
|
8
|
-
VERSION = '1.5.
|
8
|
+
VERSION = '1.5.2'
|
9
9
|
|
10
10
|
KEY_PATTERN = /^((?!^distinct_id$|^original_id$|^time$|^properties$|^id$|^first_id$|^second_id$|^users$|^events$|^event$|^user_id$|^date$|^datetime$)[a-zA-Z_$][a-zA-Z\\d_$]{0,99})$/
|
11
11
|
|
@@ -142,6 +142,7 @@ module SensorsAnalytics
|
|
142
142
|
# 从事件属性中获取时间配置
|
143
143
|
event_time = _extract_time_from_properties(properties)
|
144
144
|
properties.delete(:$time)
|
145
|
+
properties.delete("$time")
|
145
146
|
|
146
147
|
event_properties = {}
|
147
148
|
if event_type == :track || event_type == :track_signup
|
@@ -241,18 +242,18 @@ module SensorsAnalytics
|
|
241
242
|
_assert_key_with_regex(:PropertyKey, key)
|
242
243
|
|
243
244
|
unless value.is_a?(Integer) || value.is_a?(Float) || value.is_a?(String) || value.is_a?(Symbol) || value.is_a?(Array) || value.is_a?(TrueClass) || value.is_a?(FalseClass) || value.is_a?(Time)
|
244
|
-
raise
|
245
|
+
raise IllegalDataError.new("The properties value must be an instance of Integer/Float/String/Array.")
|
245
246
|
end
|
246
247
|
|
247
248
|
# 属性为 Array 时,元素必须为 String 或 Symbol 类型
|
248
249
|
if value.is_a?(Array)
|
249
250
|
value.each do |element|
|
250
251
|
unless element.is_a?(String) || element.is_a?(Symbol)
|
251
|
-
raise
|
252
|
+
raise IllegalDataError.new("The properties value of PROFILE APPEND must be an instance of Array[String].")
|
252
253
|
end
|
253
254
|
# 元素的长度不能超过8192
|
254
255
|
unless element.length <= 8192
|
255
|
-
raise
|
256
|
+
raise IllegalDataError.new("The properties value is too long.")
|
256
257
|
end
|
257
258
|
end
|
258
259
|
end
|
@@ -260,25 +261,25 @@ module SensorsAnalytics
|
|
260
261
|
# 属性为 String 或 Symbol 时,长度不能超过8191
|
261
262
|
if value.is_a?(String) || value.is_a?(Symbol)
|
262
263
|
unless value.length <= 8192
|
263
|
-
raise
|
264
|
+
raise IllegalDataError.new("The properties value is too long.")
|
264
265
|
end
|
265
266
|
end
|
266
267
|
|
267
268
|
# profile_increment 的属性必须为数值类型
|
268
269
|
if event_type == :profile_increment
|
269
270
|
unless value.is_a?(Integer)
|
270
|
-
raise
|
271
|
+
raise IllegalDataError.new("The properties value of PROFILE INCREMENT must be an instance of Integer.")
|
271
272
|
end
|
272
273
|
end
|
273
274
|
|
274
275
|
# profile_append 的属性必须为数组类型,且数组元素必须为字符串
|
275
276
|
if event_type == :profile_append
|
276
277
|
unless value.is_a?(Array)
|
277
|
-
raise
|
278
|
+
raise IllegalDataError.new("The properties value of PROFILE INCREMENT must be an instance of Array[String].")
|
278
279
|
end
|
279
280
|
value.each do |element|
|
280
281
|
unless element.is_a?(String) || element.is_a?(Symbol)
|
281
|
-
raise
|
282
|
+
raise IllegalDataError.new("The properties value of PROFILE INCREMENT must be an instance of Array[String].")
|
282
283
|
end
|
283
284
|
end
|
284
285
|
end
|
@@ -295,7 +296,7 @@ module SensorsAnalytics
|
|
295
296
|
|
296
297
|
def request!(event_list, headers = {})
|
297
298
|
unless event_list.is_a?(Array) && headers.is_a?(Hash)
|
298
|
-
raise
|
299
|
+
raise IllegalDataError.new("The argument of 'request!' should be a Array.")
|
299
300
|
end
|
300
301
|
|
301
302
|
# GZip && Base64 encode
|