deimos-ruby 2.1.2 → 2.1.4

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.
@@ -12,7 +12,8 @@ module Schemas
12
12
  attr_accessor :a_record_field
13
13
 
14
14
  # @override
15
- def initialize(a_record_field: nil)
15
+ def initialize(_from_message: false, a_record_field: nil)
16
+ @_from_message = _from_message
16
17
  super
17
18
  self.a_record_field = a_record_field
18
19
  end
@@ -45,13 +46,20 @@ module Schemas
45
46
  ### Primary Schema Class ###
46
47
  # Autogenerated Schema for Enum at com.my-namespace.AnEnum
47
48
  class AnEnum < Deimos::SchemaClass::Enum
48
- # @return ['sym1', 'sym2']
49
- attr_accessor :an_enum
50
-
51
49
  # @override
52
50
  def symbols
53
51
  %w(sym1 sym2)
54
52
  end
53
+
54
+
55
+ def sym1?
56
+ @value == 'sym1'
57
+ end
58
+
59
+ def sym2?
60
+ @value == 'sym2'
61
+ end
62
+
55
63
  end
56
64
  end
57
65
 
@@ -64,13 +72,20 @@ module Schemas
64
72
  ### Primary Schema Class ###
65
73
  # Autogenerated Schema for Enum at com.my-namespace.AnotherEnum
66
74
  class AnotherEnum < Deimos::SchemaClass::Enum
67
- # @return ['sym3', 'sym4']
68
- attr_accessor :another_enum
69
-
70
75
  # @override
71
76
  def symbols
72
77
  %w(sym3 sym4)
73
78
  end
79
+
80
+
81
+ def sym3?
82
+ @value == 'sym3'
83
+ end
84
+
85
+ def sym4?
86
+ @value == 'sym4'
87
+ end
88
+
74
89
  end
75
90
  end
76
91
 
@@ -89,7 +104,8 @@ module Schemas
89
104
  attr_accessor :response_id
90
105
 
91
106
  # @override
92
- def initialize(response_id: nil)
107
+ def initialize(_from_message: false, response_id: nil)
108
+ @_from_message = _from_message
93
109
  super
94
110
  self.response_id = response_id
95
111
  end
@@ -163,7 +179,7 @@ module Schemas
163
179
  end
164
180
 
165
181
  # @override
166
- def initialize(a_string: nil,
182
+ def initialize(_from_message: false, a_string: nil,
167
183
  a_int: nil,
168
184
  a_long: nil,
169
185
  a_float: nil,
@@ -175,6 +191,7 @@ module Schemas
175
191
  timestamp: nil,
176
192
  message_id: nil,
177
193
  a_record: nil)
194
+ @_from_message = _from_message
178
195
  super
179
196
  self.a_string = a_string
180
197
  self.a_int = a_int
@@ -235,7 +252,8 @@ module Schemas
235
252
  attr_accessor :response_id
236
253
 
237
254
  # @override
238
- def initialize(response_id: nil)
255
+ def initialize(_from_message: false, response_id: nil)
256
+ @_from_message = _from_message
239
257
  super
240
258
  self.response_id = response_id
241
259
  end
@@ -276,8 +294,9 @@ module Schemas
276
294
  attr_accessor :some_int
277
295
 
278
296
  # @override
279
- def initialize(test_id: nil,
297
+ def initialize(_from_message: false, test_id: nil,
280
298
  some_int: nil)
299
+ @_from_message = _from_message
281
300
  super
282
301
  self.test_id = test_id
283
302
  self.some_int = some_int
@@ -324,10 +343,11 @@ module Schemas
324
343
  attr_accessor :some_optional_int
325
344
 
326
345
  # @override
327
- def initialize(some_int: nil,
346
+ def initialize(_from_message: false, some_int: nil,
328
347
  some_float: nil,
329
348
  some_string: nil,
330
349
  some_optional_int: nil)
350
+ @_from_message = _from_message
331
351
  super
332
352
  self.some_int = some_int
333
353
  self.some_float = some_float
@@ -393,11 +413,12 @@ module Schemas
393
413
  end
394
414
 
395
415
  # @override
396
- def initialize(test_id: nil,
416
+ def initialize(_from_message: false, test_id: nil,
397
417
  test_float: nil,
398
418
  test_array: nil,
399
419
  some_nested_record: nil,
400
420
  some_optional_record: nil)
421
+ @_from_message = _from_message
401
422
  super
402
423
  self.test_id = test_id
403
424
  self.test_float = test_float
@@ -416,6 +437,13 @@ module Schemas
416
437
  'com.my-namespace'
417
438
  end
418
439
 
440
+ def self.tombstone(key)
441
+ record = self.allocate
442
+ record.tombstone_key = key
443
+ record.test_id = key
444
+ record
445
+ end
446
+
419
447
  # @override
420
448
  def as_json(_opts={})
421
449
  {
@@ -439,30 +467,19 @@ module Schemas
439
467
  # Autogenerated Schema for Record at com.my-namespace.MySchema
440
468
  class MySchema < Deimos::SchemaClass::Record
441
469
 
442
- ### Attribute Readers ###
443
- # @return [MySchemaKey]
444
- attr_reader :payload_key
445
-
446
470
  ### Attribute Accessors ###
447
471
  # @return [String]
448
472
  attr_accessor :test_id
449
473
  # @return [Integer]
450
474
  attr_accessor :some_int
451
475
 
452
- ### Attribute Writers ###
453
- # @return [MySchemaKey]
454
- def payload_key=(value)
455
- @payload_key = MySchemaKey.initialize_from_value(value, from_message: self._from_message)
456
- end
457
-
458
476
  # @override
459
- def initialize(test_id: nil,
460
- some_int: nil,
461
- payload_key: nil)
477
+ def initialize(_from_message: false, test_id: nil,
478
+ some_int: nil)
479
+ @_from_message = _from_message
462
480
  super
463
481
  self.test_id = test_id
464
482
  self.some_int = some_int
465
- self.payload_key = payload_key
466
483
  end
467
484
 
468
485
  # @override
@@ -475,19 +492,11 @@ module Schemas
475
492
  'com.my-namespace'
476
493
  end
477
494
 
478
- def self.tombstone(key)
479
- record = self.allocate
480
- record.tombstone_key = MySchemaKey.initialize_from_value(key, from_message: self._from_message)
481
- record.payload_key = key
482
- record
483
- end
484
-
485
495
  # @override
486
496
  def as_json(_opts={})
487
497
  {
488
498
  'test_id' => @test_id,
489
- 'some_int' => @some_int,
490
- 'payload_key' => @payload_key&.as_json
499
+ 'some_int' => @some_int
491
500
  }
492
501
  end
493
502
  end
@@ -510,8 +519,9 @@ module Schemas
510
519
  attr_accessor :part_two
511
520
 
512
521
  # @override
513
- def initialize(part_one: nil,
522
+ def initialize(_from_message: false, part_one: nil,
514
523
  part_two: nil)
524
+ @_from_message = _from_message
515
525
  super
516
526
  self.part_one = part_one
517
527
  self.part_two = part_two
@@ -552,7 +562,8 @@ module Schemas
552
562
  attr_accessor :id
553
563
 
554
564
  # @override
555
- def initialize(id: nil)
565
+ def initialize(_from_message: false, id: nil)
566
+ @_from_message = _from_message
556
567
  super
557
568
  self.id = id
558
569
  end
@@ -591,7 +602,8 @@ module Schemas
591
602
  attr_accessor :test_id
592
603
 
593
604
  # @override
594
- def initialize(test_id: nil)
605
+ def initialize(_from_message: false, test_id: nil)
606
+ @_from_message = _from_message
595
607
  super
596
608
  self.test_id = test_id
597
609
  end
@@ -632,8 +644,9 @@ module Schemas
632
644
  attr_accessor :some_bool
633
645
 
634
646
  # @override
635
- def initialize(test_id: nil,
647
+ def initialize(_from_message: false, test_id: nil,
636
648
  some_bool: nil)
649
+ @_from_message = _from_message
637
650
  super
638
651
  self.test_id = test_id
639
652
  self.some_bool = some_bool
@@ -682,7 +695,8 @@ module Schemas
682
695
  end
683
696
 
684
697
  # @override
685
- def initialize(properties: {})
698
+ def initialize(_from_message: false, properties: {})
699
+ @_from_message = _from_message
686
700
  super
687
701
  self.properties = properties
688
702
  end
@@ -789,7 +803,7 @@ module Schemas
789
803
  end
790
804
 
791
805
  # @override
792
- def initialize(test_id: nil,
806
+ def initialize(_from_message: false, test_id: nil,
793
807
  test_float: nil,
794
808
  test_string_array: ["test"],
795
809
  test_int_array: [123],
@@ -802,6 +816,7 @@ module Schemas
802
816
  some_enum_array: nil,
803
817
  some_optional_enum: nil,
804
818
  some_enum_with_default: "sym6")
819
+ @_from_message = _from_message
805
820
  super
806
821
  self.test_id = test_id
807
822
  self.test_float = test_float
@@ -872,11 +887,12 @@ module Schemas
872
887
  attr_accessor :timestamp
873
888
 
874
889
  # @override
875
- def initialize(test_id: nil,
890
+ def initialize(_from_message: false, test_id: nil,
876
891
  updated_at: nil,
877
892
  some_int: nil,
878
893
  some_datetime_int: nil,
879
894
  timestamp: nil)
895
+ @_from_message = _from_message
880
896
  super
881
897
  self.test_id = test_id
882
898
  self.updated_at = updated_at
@@ -929,10 +945,11 @@ module Schemas
929
945
  attr_accessor :timestamp
930
946
 
931
947
  # @override
932
- def initialize(test_id: nil,
948
+ def initialize(_from_message: false, test_id: nil,
933
949
  some_int: nil,
934
950
  message_id: nil,
935
951
  timestamp: nil)
952
+ @_from_message = _from_message
936
953
  super
937
954
  self.test_id = test_id
938
955
  self.some_int = some_int
@@ -981,9 +998,10 @@ module Schemas
981
998
  attr_accessor :title
982
999
 
983
1000
  # @override
984
- def initialize(test_id: nil,
1001
+ def initialize(_from_message: false, test_id: nil,
985
1002
  some_int: nil,
986
1003
  title: nil)
1004
+ @_from_message = _from_message
987
1005
  super
988
1006
  self.test_id = test_id
989
1007
  self.some_int = some_int
@@ -1053,9 +1071,10 @@ module Schemas
1053
1071
  end
1054
1072
 
1055
1073
  # @override
1056
- def initialize(test_id: "",
1074
+ def initialize(_from_message: false, test_id: "",
1057
1075
  test_long: nil,
1058
1076
  test_union_type: nil)
1077
+ @_from_message = _from_message
1059
1078
  super
1060
1079
  self.test_id = test_id
1061
1080
  self.test_long = test_long
@@ -1106,11 +1125,12 @@ module Schemas
1106
1125
  attr_accessor :timestamp
1107
1126
 
1108
1127
  # @override
1109
- def initialize(id: nil,
1128
+ def initialize(_from_message: false, id: nil,
1110
1129
  test_id: nil,
1111
1130
  some_int: nil,
1112
1131
  message_id: nil,
1113
1132
  timestamp: nil)
1133
+ @_from_message = _from_message
1114
1134
  super
1115
1135
  self.id = id
1116
1136
  self.test_id = test_id
@@ -1157,7 +1177,8 @@ module Schemas
1157
1177
  attr_accessor :property
1158
1178
 
1159
1179
  # @override
1160
- def initialize(property: nil)
1180
+ def initialize(_from_message: false, property: nil)
1181
+ @_from_message = _from_message
1161
1182
  super
1162
1183
  self.property = property
1163
1184
  end
@@ -1198,8 +1219,9 @@ module Schemas
1198
1219
  attr_accessor :record1_id
1199
1220
 
1200
1221
  # @override
1201
- def initialize(record1_map: {},
1222
+ def initialize(_from_message: false, record1_map: {},
1202
1223
  record1_id: 0)
1224
+ @_from_message = _from_message
1203
1225
  super
1204
1226
  self.record1_map = record1_map
1205
1227
  self.record1_id = record1_id
@@ -1240,7 +1262,8 @@ module Schemas
1240
1262
  attr_accessor :record2_id
1241
1263
 
1242
1264
  # @override
1243
- def initialize(record2_id: "")
1265
+ def initialize(_from_message: false, record2_id: "")
1266
+ @_from_message = _from_message
1244
1267
  super
1245
1268
  self.record2_id = record2_id
1246
1269
  end
@@ -1279,7 +1302,8 @@ module Schemas
1279
1302
  attr_accessor :record3_id
1280
1303
 
1281
1304
  # @override
1282
- def initialize(record3_id: 0.0)
1305
+ def initialize(_from_message: false, record3_id: 0.0)
1306
+ @_from_message = _from_message
1283
1307
  super
1284
1308
  self.record3_id = record3_id
1285
1309
  end
@@ -1318,7 +1342,8 @@ module Schemas
1318
1342
  attr_accessor :record4_id
1319
1343
 
1320
1344
  # @override
1321
- def initialize(record4_id: 0)
1345
+ def initialize(_from_message: false, record4_id: 0)
1346
+ @_from_message = _from_message
1322
1347
  super
1323
1348
  self.record4_id = record4_id
1324
1349
  end
@@ -1357,7 +1382,8 @@ module Schemas
1357
1382
  attr_accessor :update_request_id
1358
1383
 
1359
1384
  # @override
1360
- def initialize(update_request_id: nil)
1385
+ def initialize(_from_message: false, update_request_id: nil)
1386
+ @_from_message = _from_message
1361
1387
  super
1362
1388
  self.update_request_id = update_request_id
1363
1389
  end
@@ -1396,7 +1422,8 @@ module Schemas
1396
1422
  attr_accessor :update_response_id
1397
1423
 
1398
1424
  # @override
1399
- def initialize(update_response_id: nil)
1425
+ def initialize(_from_message: false, update_response_id: nil)
1426
+ @_from_message = _from_message
1400
1427
  super
1401
1428
  self.update_response_id = update_response_id
1402
1429
  end
@@ -1451,7 +1478,7 @@ module Schemas
1451
1478
  attr_accessor :created_at
1452
1479
 
1453
1480
  # @override
1454
- def initialize(id: nil,
1481
+ def initialize(_from_message: false, id: nil,
1455
1482
  wibble_id: nil,
1456
1483
  name: nil,
1457
1484
  floop: nil,
@@ -1460,6 +1487,7 @@ module Schemas
1460
1487
  birthday_optional: nil,
1461
1488
  updated_at: nil,
1462
1489
  created_at: nil)
1490
+ @_from_message = _from_message
1463
1491
  super
1464
1492
  self.id = id
1465
1493
  self.wibble_id = wibble_id
@@ -1522,11 +1550,12 @@ module Schemas
1522
1550
  attr_accessor :created_at
1523
1551
 
1524
1552
  # @override
1525
- def initialize(id: nil,
1553
+ def initialize(_from_message: false, id: nil,
1526
1554
  widget_id: nil,
1527
1555
  name: nil,
1528
1556
  updated_at: nil,
1529
1557
  created_at: nil)
1558
+ @_from_message = _from_message
1530
1559
  super
1531
1560
  self.id = id
1532
1561
  self.widget_id = widget_id
@@ -1581,11 +1610,12 @@ module Schemas
1581
1610
  attr_accessor :created_at
1582
1611
 
1583
1612
  # @override
1584
- def initialize(id: nil,
1613
+ def initialize(_from_message: false, id: nil,
1585
1614
  widget_id: nil,
1586
1615
  model_id: nil,
1587
1616
  updated_at: nil,
1588
1617
  created_at: nil)
1618
+ @_from_message = _from_message
1589
1619
  super
1590
1620
  self.id = id
1591
1621
  self.widget_id = widget_id
@@ -1626,13 +1656,20 @@ module Schemas
1626
1656
  ### Primary Schema Class ###
1627
1657
  # Autogenerated Schema for Enum at com.my-namespace.YetAnotherEnum
1628
1658
  class YetAnotherEnum < Deimos::SchemaClass::Enum
1629
- # @return ['sym5', 'sym6']
1630
- attr_accessor :yet_another_enum
1631
-
1632
1659
  # @override
1633
1660
  def symbols
1634
1661
  %w(sym5 sym6)
1635
1662
  end
1663
+
1664
+
1665
+ def sym5?
1666
+ @value == 'sym5'
1667
+ end
1668
+
1669
+ def sym6?
1670
+ @value == 'sym6'
1671
+ end
1672
+
1636
1673
  end
1637
1674
  end
1638
1675