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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 10b67c13eae597d9734339b612af2911162085a5
4
- data.tar.gz: f6ef3589fbbc65c2707d52eb60cf94cab521a420
3
+ metadata.gz: 4ba8bb1d0a7ec6945ac66b4f62497df1f1243bbb
4
+ data.tar.gz: acef833736c39f744c3eb8205fac2dc5d6420279
5
5
  SHA512:
6
- metadata.gz: 1a5cc2e58db4d1981f89e0b320191476bbf852bc5cf1cc629f22294e8f6d19a6b83ac2e50aafd426fe25071783dd2a34bbd63e204739ee98619f052dae7b801e
7
- data.tar.gz: 1fea8cf3b1654d14f01c5914282e7d489bd625d8fce038158864af36f2e2d5722b74eceaf3c49c82e2b3e8a8bb033894f34a574d7ffd6243c3d7eeeb48a782f9
6
+ metadata.gz: f603b44c73f6713c2731767575a61f77663f9e2b99b39385c1947e65be845b0db7f4880f79f45cfa3d30e187868e9d3e630a352eb16edf5c4b22e9e04f359350
7
+ data.tar.gz: aaa4a4301b68830d4944b3d3b28a184ac21e282250ec725fb45c184116794173fbb8c04ce16859b55573a24a1cb16cc68cbdcad8ca13cc7a2f99cd9446c713ca
data/airship-ruby.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "airship-ruby"
3
- s.version = "1.1.4"
3
+ s.version = "1.1.5"
4
4
  s.licenses = ["MIT"]
5
5
  s.summary = "Airship Ruby SDK"
6
6
  s.description = "Ruby SDK"
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: airship-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Airship Dev Team