airship-ruby 1.1.4 → 1.1.5
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.
- checksums.yaml +4 -4
- data/airship-ruby.gemspec +1 -1
- data/lib/airship-ruby.rb +20 -4
- 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: 4ba8bb1d0a7ec6945ac66b4f62497df1f1243bbb
|
4
|
+
data.tar.gz: acef833736c39f744c3eb8205fac2dc5d6420279
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f603b44c73f6713c2731767575a61f77663f9e2b99b39385c1947e65be845b0db7f4880f79f45cfa3d30e187868e9d3e630a352eb16edf5c4b22e9e04f359350
|
7
|
+
data.tar.gz: aaa4a4301b68830d4944b3d3b28a184ac21e282250ec725fb45c184116794173fbb8c04ce16859b55573a24a1cb16cc68cbdcad8ca13cc7a2f99cd9446c713ca
|
data/airship-ruby.gemspec
CHANGED
data/lib/airship-ruby.rb
CHANGED
@@ -30,6 +30,9 @@ class Airship
|
|
30
30
|
"maxLength" => 250,
|
31
31
|
"minLength" => 1,
|
32
32
|
},
|
33
|
+
"is_anonymous" => {
|
34
|
+
"type" => "boolean",
|
35
|
+
},
|
33
36
|
"attributes" => {
|
34
37
|
"type" => "object",
|
35
38
|
"patternProperties" => {
|
@@ -185,6 +188,8 @@ class Airship
|
|
185
188
|
|
186
189
|
@initialization_lock = Concurrent::Semaphore.new(1)
|
187
190
|
@gate_stats_batch_lock = Concurrent::Semaphore.new(1)
|
191
|
+
|
192
|
+
@first_gate = true
|
188
193
|
end
|
189
194
|
|
190
195
|
def init
|
@@ -220,7 +225,7 @@ class Airship
|
|
220
225
|
object['type'] = 'User'
|
221
226
|
end
|
222
227
|
|
223
|
-
error = self._validate_nesting(object) || self._maybe_transform_id(object)
|
228
|
+
error = self._validate_nesting(object) || self._validate_anonymous(object) || self._maybe_transform_id(object)
|
224
229
|
|
225
230
|
if !error.nil?
|
226
231
|
puts error
|
@@ -284,7 +289,7 @@ class Airship
|
|
284
289
|
object['type'] = 'User'
|
285
290
|
end
|
286
291
|
|
287
|
-
error = self._validate_nesting(object) || self._maybe_transform_id(object)
|
292
|
+
error = self._validate_nesting(object) || self._validate_anonymous(object) || self._maybe_transform_id(object)
|
288
293
|
|
289
294
|
if !error.nil?
|
290
295
|
puts error
|
@@ -348,7 +353,7 @@ class Airship
|
|
348
353
|
object['type'] = 'User'
|
349
354
|
end
|
350
355
|
|
351
|
-
error = self._validate_nesting(object) || self._maybe_transform_id(object)
|
356
|
+
error = self._validate_nesting(object) || self._validate_anonymous(object) || self._maybe_transform_id(object)
|
352
357
|
|
353
358
|
if !error.nil?
|
354
359
|
puts error
|
@@ -513,7 +518,8 @@ class Airship
|
|
513
518
|
if !gate_stats.nil?
|
514
519
|
@gate_stats_batch.push(gate_stats)
|
515
520
|
end
|
516
|
-
if @gate_stats_batch.size > limit
|
521
|
+
if @gate_stats_batch.size > limit || (@first_gate && @gate_stats_batch.size > 0)
|
522
|
+
@first_gate = false
|
517
523
|
new_gate_stats_uploader_tasks = []
|
518
524
|
@gate_stats_uploader_tasks.each do |task|
|
519
525
|
if !task.fulfilled?
|
@@ -939,6 +945,16 @@ class Airship
|
|
939
945
|
end
|
940
946
|
end
|
941
947
|
|
948
|
+
def _validate_anonymous(object)
|
949
|
+
if object['is_anonymous'] == true && !object['group'].nil?
|
950
|
+
return 'An anonymous object cannot belong to a group'
|
951
|
+
end
|
952
|
+
|
953
|
+
if object['is_group'] === true && object['is_anonymous'] === true
|
954
|
+
return 'A group cannot be anonymous'
|
955
|
+
end
|
956
|
+
end
|
957
|
+
|
942
958
|
def _maybe_transform_id(object)
|
943
959
|
if object['id'].is_a?(Integer)
|
944
960
|
id_str = object['id'].to_s
|