onesignal 5.2.1.pre.beta1 → 5.3.0
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/CHANGELOG.md +8 -0
- data/README.md +33 -5
- data/docs/ApiKeyToken.md +28 -0
- data/docs/ApiKeyTokensListResponse.md +18 -0
- data/docs/BasicNotification.md +13 -1
- data/docs/BasicNotificationAllOf.md +13 -1
- data/docs/CopyTemplateRequest.md +18 -0
- data/docs/CreateApiKeyRequest.md +22 -0
- data/docs/CreateApiKeyResponse.md +20 -0
- data/docs/CreateTemplateRequest.md +32 -0
- data/docs/CustomEvent.md +26 -0
- data/docs/CustomEventsRequest.md +18 -0
- data/docs/DefaultApi.md +1132 -110
- data/docs/Notification.md +12 -0
- data/docs/NotificationWithMeta.md +12 -0
- data/docs/StartLiveActivityRequest.md +48 -0
- data/docs/StartLiveActivitySuccessResponse.md +18 -0
- data/docs/TemplateResource.md +28 -0
- data/docs/TemplatesListResponse.md +18 -0
- data/docs/UpdateApiKeyRequest.md +22 -0
- data/docs/UpdateTemplateRequest.md +30 -0
- data/lib/onesignal/api/default_api.rb +1043 -1
- data/lib/onesignal/api_client.rb +2 -2
- data/lib/onesignal/api_error.rb +1 -1
- data/lib/onesignal/configuration.rb +1 -1
- data/lib/onesignal/models/api_key_token.rb +300 -0
- data/lib/onesignal/models/api_key_tokens_list_response.rb +221 -0
- data/lib/onesignal/models/app.rb +1 -1
- data/lib/onesignal/models/basic_notification.rb +84 -6
- data/lib/onesignal/models/basic_notification_all_of.rb +84 -6
- data/lib/onesignal/models/basic_notification_all_of_android_background_layout.rb +1 -1
- data/lib/onesignal/models/button.rb +1 -1
- data/lib/onesignal/models/copy_template_request.rb +225 -0
- data/lib/onesignal/models/create_api_key_request.rb +273 -0
- data/lib/onesignal/models/create_api_key_response.rb +228 -0
- data/lib/onesignal/models/create_notification_success_response.rb +1 -1
- data/lib/onesignal/models/create_segment_conflict_response.rb +1 -1
- data/lib/onesignal/models/create_segment_success_response.rb +1 -1
- data/lib/onesignal/models/create_template_request.rb +307 -0
- data/lib/onesignal/models/create_user_conflict_response.rb +1 -1
- data/lib/onesignal/models/create_user_conflict_response_errors_inner.rb +1 -1
- data/lib/onesignal/models/create_user_conflict_response_errors_items_meta.rb +1 -1
- data/lib/onesignal/models/custom_event.rb +269 -0
- data/lib/onesignal/models/custom_events_request.rb +226 -0
- data/lib/onesignal/models/delivery_data.rb +1 -1
- data/lib/onesignal/models/export_events_success_response.rb +1 -1
- data/lib/onesignal/models/export_subscriptions_request_body.rb +1 -1
- data/lib/onesignal/models/export_subscriptions_success_response.rb +1 -1
- data/lib/onesignal/models/filter.rb +1 -1
- data/lib/onesignal/models/filter_expression.rb +1 -1
- data/lib/onesignal/models/generic_error.rb +1 -1
- data/lib/onesignal/models/generic_success_bool_response.rb +1 -1
- data/lib/onesignal/models/get_notification_history_request_body.rb +1 -1
- data/lib/onesignal/models/get_segments_success_response.rb +1 -1
- data/lib/onesignal/models/language_string_map.rb +1 -1
- data/lib/onesignal/models/notification.rb +80 -2
- data/lib/onesignal/models/notification_all_of.rb +1 -1
- data/lib/onesignal/models/notification_history_success_response.rb +1 -1
- data/lib/onesignal/models/notification_slice.rb +1 -1
- data/lib/onesignal/models/notification_target.rb +1 -1
- data/lib/onesignal/models/notification_with_meta.rb +80 -2
- data/lib/onesignal/models/notification_with_meta_all_of.rb +1 -1
- data/lib/onesignal/models/operator.rb +1 -1
- data/lib/onesignal/models/outcome_data.rb +1 -1
- data/lib/onesignal/models/outcomes_data.rb +1 -1
- data/lib/onesignal/models/platform_delivery_data.rb +1 -1
- data/lib/onesignal/models/platform_delivery_data_email_all_of.rb +1 -1
- data/lib/onesignal/models/platform_delivery_data_sms_all_of.rb +1 -1
- data/lib/onesignal/models/properties_body.rb +1 -1
- data/lib/onesignal/models/properties_deltas.rb +1 -1
- data/lib/onesignal/models/properties_object.rb +1 -1
- data/lib/onesignal/models/purchase.rb +1 -1
- data/lib/onesignal/models/rate_limit_error.rb +1 -1
- data/lib/onesignal/models/segment.rb +1 -1
- data/lib/onesignal/models/segment_data.rb +1 -1
- data/lib/onesignal/models/segment_notification_target.rb +1 -1
- data/lib/onesignal/models/start_live_activity_request.rb +454 -0
- data/lib/onesignal/models/start_live_activity_success_response.rb +219 -0
- data/lib/onesignal/models/subscription.rb +1 -1
- data/lib/onesignal/models/subscription_body.rb +1 -1
- data/lib/onesignal/models/subscription_notification_target.rb +1 -1
- data/lib/onesignal/models/template_resource.rb +302 -0
- data/lib/onesignal/models/templates_list_response.rb +221 -0
- data/lib/onesignal/models/transfer_subscription_request_body.rb +1 -1
- data/lib/onesignal/models/update_api_key_request.rb +273 -0
- data/lib/onesignal/models/update_live_activity_request.rb +1 -1
- data/lib/onesignal/models/update_live_activity_success_response.rb +1 -1
- data/lib/onesignal/models/update_template_request.rb +282 -0
- data/lib/onesignal/models/update_user_request.rb +1 -1
- data/lib/onesignal/models/user.rb +1 -1
- data/lib/onesignal/models/user_identity_body.rb +1 -1
- data/lib/onesignal/models/web_button.rb +1 -1
- data/lib/onesignal/version.rb +2 -2
- data/lib/onesignal.rb +15 -1
- data/onesignal.gemspec +1 -1
- data/spec/api/default_api_spec.rb +189 -1
- data/spec/api_client_spec.rb +1 -1
- data/spec/configuration_spec.rb +1 -1
- data/spec/models/api_key_token_spec.rb +68 -0
- data/spec/models/api_key_tokens_list_response_spec.rb +34 -0
- data/spec/models/app_spec.rb +1 -1
- data/spec/models/basic_notification_all_of_android_background_layout_spec.rb +1 -1
- data/spec/models/basic_notification_all_of_spec.rb +41 -1
- data/spec/models/basic_notification_spec.rb +41 -1
- data/spec/models/button_spec.rb +1 -1
- data/spec/models/copy_template_request_spec.rb +34 -0
- data/spec/models/create_api_key_request_spec.rb +50 -0
- data/spec/models/create_api_key_response_spec.rb +40 -0
- data/spec/models/create_notification_success_response_spec.rb +1 -1
- data/spec/models/create_segment_conflict_response_spec.rb +1 -1
- data/spec/models/create_segment_success_response_spec.rb +1 -1
- data/spec/models/create_template_request_spec.rb +76 -0
- data/spec/models/create_user_conflict_response_errors_inner_spec.rb +1 -1
- data/spec/models/create_user_conflict_response_errors_items_meta_spec.rb +1 -1
- data/spec/models/create_user_conflict_response_spec.rb +1 -1
- data/spec/models/custom_event_spec.rb +58 -0
- data/spec/models/custom_events_request_spec.rb +34 -0
- data/spec/models/delivery_data_spec.rb +1 -1
- data/spec/models/export_events_success_response_spec.rb +1 -1
- data/spec/models/export_subscriptions_request_body_spec.rb +1 -1
- data/spec/models/export_subscriptions_success_response_spec.rb +1 -1
- data/spec/models/filter_expression_spec.rb +1 -1
- data/spec/models/filter_spec.rb +1 -1
- data/spec/models/generic_error_spec.rb +1 -1
- data/spec/models/generic_success_bool_response_spec.rb +1 -1
- data/spec/models/get_notification_history_request_body_spec.rb +1 -1
- data/spec/models/get_segments_success_response_spec.rb +1 -1
- data/spec/models/language_string_map_spec.rb +1 -1
- data/spec/models/notification_all_of_spec.rb +1 -1
- data/spec/models/notification_history_success_response_spec.rb +1 -1
- data/spec/models/notification_slice_spec.rb +1 -1
- data/spec/models/notification_spec.rb +41 -1
- data/spec/models/notification_target_spec.rb +1 -1
- data/spec/models/notification_with_meta_all_of_spec.rb +1 -1
- data/spec/models/notification_with_meta_spec.rb +41 -1
- data/spec/models/operator_spec.rb +1 -1
- data/spec/models/outcome_data_spec.rb +1 -1
- data/spec/models/outcomes_data_spec.rb +1 -1
- data/spec/models/platform_delivery_data_email_all_of_spec.rb +1 -1
- data/spec/models/platform_delivery_data_sms_all_of_spec.rb +1 -1
- data/spec/models/platform_delivery_data_spec.rb +1 -1
- data/spec/models/properties_body_spec.rb +1 -1
- data/spec/models/properties_deltas_spec.rb +1 -1
- data/spec/models/properties_object_spec.rb +1 -1
- data/spec/models/purchase_spec.rb +1 -1
- data/spec/models/rate_limit_error_spec.rb +1 -1
- data/spec/models/segment_data_spec.rb +1 -1
- data/spec/models/segment_notification_target_spec.rb +1 -1
- data/spec/models/segment_spec.rb +1 -1
- data/spec/models/start_live_activity_request_spec.rb +128 -0
- data/spec/models/start_live_activity_success_response_spec.rb +34 -0
- data/spec/models/subscription_body_spec.rb +1 -1
- data/spec/models/subscription_notification_target_spec.rb +1 -1
- data/spec/models/subscription_spec.rb +1 -1
- data/spec/models/template_resource_spec.rb +68 -0
- data/spec/models/templates_list_response_spec.rb +34 -0
- data/spec/models/transfer_subscription_request_body_spec.rb +1 -1
- data/spec/models/update_api_key_request_spec.rb +50 -0
- data/spec/models/update_live_activity_request_spec.rb +1 -1
- data/spec/models/update_live_activity_success_response_spec.rb +1 -1
- data/spec/models/update_template_request_spec.rb +70 -0
- data/spec/models/update_user_request_spec.rb +1 -1
- data/spec/models/user_identity_body_spec.rb +1 -1
- data/spec/models/user_spec.rb +1 -1
- data/spec/models/web_button_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +58 -2
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 5.
|
|
6
|
+
The version of the OpenAPI document: 5.3.0
|
|
7
7
|
Contact: devrel@onesignal.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
OpenAPI Generator version: 6.0.0-SNAPSHOT
|
|
@@ -310,6 +310,9 @@ module OneSignal
|
|
|
310
310
|
# Channel: Email The email address the email is from. If not specified, will default to \"from email\" set in the OneSignal Dashboard Email Settings.
|
|
311
311
|
attr_accessor :email_from_address
|
|
312
312
|
|
|
313
|
+
# Channel: Email The email address where replies should be sent. If not specified, replies will go to the from address.
|
|
314
|
+
attr_accessor :email_reply_to_address
|
|
315
|
+
|
|
313
316
|
# Channel: Email The preheader text of the email. Preheader is the preview text displayed immediately after an email subject that provides additional context about the email content. If not specified, will default to null.
|
|
314
317
|
attr_accessor :email_preheader
|
|
315
318
|
|
|
@@ -330,6 +333,21 @@ module OneSignal
|
|
|
330
333
|
# Channel: All JSON object that can be used as a source of message personalization data for fields that support tag variable substitution. Push, SMS: Can accept up to 2048 bytes of valid JSON. Email: Can accept up to 10000 bytes of valid JSON. Example: {\"order_id\": 123, \"currency\": \"USD\", \"amount\": 25}
|
|
331
334
|
attr_accessor :custom_data
|
|
332
335
|
|
|
336
|
+
# Channel: Push Notifications Platform: Huawei Full path of the app entry activity class
|
|
337
|
+
attr_accessor :huawei_badge_class
|
|
338
|
+
|
|
339
|
+
# Channel: Push Notifications Platform: Huawei Accumulative badge number, which is an integer ranging from 1 to 99
|
|
340
|
+
attr_accessor :huawei_badge_add_num
|
|
341
|
+
|
|
342
|
+
# Channel: Push Notifications Platform: Huawei Badge number, which is an integer ranging from 0 to 99
|
|
343
|
+
attr_accessor :huawei_badge_set_num
|
|
344
|
+
|
|
345
|
+
# Channel: Push Notifications Platform: Huawei Category of the push notification for HMS classification.
|
|
346
|
+
attr_accessor :huawei_category
|
|
347
|
+
|
|
348
|
+
# Channel: Push Notifications Platform: Huawei A tag used for Huawei business intelligence and analytics.
|
|
349
|
+
attr_accessor :huawei_bi_tag
|
|
350
|
+
|
|
333
351
|
class EnumAttributeValidator
|
|
334
352
|
attr_reader :datatype
|
|
335
353
|
attr_reader :allowable_values
|
|
@@ -456,13 +474,19 @@ module OneSignal
|
|
|
456
474
|
:'email_body' => :'email_body',
|
|
457
475
|
:'email_from_name' => :'email_from_name',
|
|
458
476
|
:'email_from_address' => :'email_from_address',
|
|
477
|
+
:'email_reply_to_address' => :'email_reply_to_address',
|
|
459
478
|
:'email_preheader' => :'email_preheader',
|
|
460
479
|
:'disable_email_click_tracking' => :'disable_email_click_tracking',
|
|
461
480
|
:'include_unsubscribed' => :'include_unsubscribed',
|
|
462
481
|
:'sms_from' => :'sms_from',
|
|
463
482
|
:'sms_media_urls' => :'sms_media_urls',
|
|
464
483
|
:'filters' => :'filters',
|
|
465
|
-
:'custom_data' => :'custom_data'
|
|
484
|
+
:'custom_data' => :'custom_data',
|
|
485
|
+
:'huawei_badge_class' => :'huawei_badge_class',
|
|
486
|
+
:'huawei_badge_add_num' => :'huawei_badge_add_num',
|
|
487
|
+
:'huawei_badge_set_num' => :'huawei_badge_set_num',
|
|
488
|
+
:'huawei_category' => :'huawei_category',
|
|
489
|
+
:'huawei_bi_tag' => :'huawei_bi_tag'
|
|
466
490
|
}
|
|
467
491
|
end
|
|
468
492
|
|
|
@@ -575,13 +599,19 @@ module OneSignal
|
|
|
575
599
|
:'email_body' => :'String',
|
|
576
600
|
:'email_from_name' => :'String',
|
|
577
601
|
:'email_from_address' => :'String',
|
|
602
|
+
:'email_reply_to_address' => :'String',
|
|
578
603
|
:'email_preheader' => :'String',
|
|
579
604
|
:'disable_email_click_tracking' => :'Boolean',
|
|
580
605
|
:'include_unsubscribed' => :'Boolean',
|
|
581
606
|
:'sms_from' => :'String',
|
|
582
607
|
:'sms_media_urls' => :'Array<String>',
|
|
583
608
|
:'filters' => :'Array<FilterExpression>',
|
|
584
|
-
:'custom_data' => :'Object'
|
|
609
|
+
:'custom_data' => :'Object',
|
|
610
|
+
:'huawei_badge_class' => :'String',
|
|
611
|
+
:'huawei_badge_add_num' => :'Integer',
|
|
612
|
+
:'huawei_badge_set_num' => :'Integer',
|
|
613
|
+
:'huawei_category' => :'String',
|
|
614
|
+
:'huawei_bi_tag' => :'String'
|
|
585
615
|
}
|
|
586
616
|
end
|
|
587
617
|
|
|
@@ -665,12 +695,18 @@ module OneSignal
|
|
|
665
695
|
:'email_subject',
|
|
666
696
|
:'email_from_name',
|
|
667
697
|
:'email_from_address',
|
|
698
|
+
:'email_reply_to_address',
|
|
668
699
|
:'email_preheader',
|
|
669
700
|
:'disable_email_click_tracking',
|
|
670
701
|
:'sms_from',
|
|
671
702
|
:'sms_media_urls',
|
|
672
703
|
:'filters',
|
|
673
|
-
:'custom_data'
|
|
704
|
+
:'custom_data',
|
|
705
|
+
:'huawei_badge_class',
|
|
706
|
+
:'huawei_badge_add_num',
|
|
707
|
+
:'huawei_badge_set_num',
|
|
708
|
+
:'huawei_category',
|
|
709
|
+
:'huawei_bi_tag'
|
|
674
710
|
])
|
|
675
711
|
end
|
|
676
712
|
|
|
@@ -1129,6 +1165,10 @@ module OneSignal
|
|
|
1129
1165
|
self.email_from_address = attributes[:'email_from_address']
|
|
1130
1166
|
end
|
|
1131
1167
|
|
|
1168
|
+
if attributes.key?(:'email_reply_to_address')
|
|
1169
|
+
self.email_reply_to_address = attributes[:'email_reply_to_address']
|
|
1170
|
+
end
|
|
1171
|
+
|
|
1132
1172
|
if attributes.key?(:'email_preheader')
|
|
1133
1173
|
self.email_preheader = attributes[:'email_preheader']
|
|
1134
1174
|
end
|
|
@@ -1160,6 +1200,26 @@ module OneSignal
|
|
|
1160
1200
|
if attributes.key?(:'custom_data')
|
|
1161
1201
|
self.custom_data = attributes[:'custom_data']
|
|
1162
1202
|
end
|
|
1203
|
+
|
|
1204
|
+
if attributes.key?(:'huawei_badge_class')
|
|
1205
|
+
self.huawei_badge_class = attributes[:'huawei_badge_class']
|
|
1206
|
+
end
|
|
1207
|
+
|
|
1208
|
+
if attributes.key?(:'huawei_badge_add_num')
|
|
1209
|
+
self.huawei_badge_add_num = attributes[:'huawei_badge_add_num']
|
|
1210
|
+
end
|
|
1211
|
+
|
|
1212
|
+
if attributes.key?(:'huawei_badge_set_num')
|
|
1213
|
+
self.huawei_badge_set_num = attributes[:'huawei_badge_set_num']
|
|
1214
|
+
end
|
|
1215
|
+
|
|
1216
|
+
if attributes.key?(:'huawei_category')
|
|
1217
|
+
self.huawei_category = attributes[:'huawei_category']
|
|
1218
|
+
end
|
|
1219
|
+
|
|
1220
|
+
if attributes.key?(:'huawei_bi_tag')
|
|
1221
|
+
self.huawei_bi_tag = attributes[:'huawei_bi_tag']
|
|
1222
|
+
end
|
|
1163
1223
|
end
|
|
1164
1224
|
|
|
1165
1225
|
# Show invalid properties with the reasons. Usually used together with valid?
|
|
@@ -1181,6 +1241,8 @@ module OneSignal
|
|
|
1181
1241
|
aggregation_validator = EnumAttributeValidator.new('String', ["sum", "count"])
|
|
1182
1242
|
return false unless aggregation_validator.valid?(@aggregation)
|
|
1183
1243
|
return false if @app_id.nil?
|
|
1244
|
+
huawei_category_validator = EnumAttributeValidator.new('String', ["IM", "VOIP", "SUBSCRIPTION", "TRAVEL", "HEALTH", "WORK", "ACCOUNT", "EXPRESS", "FINANCE", "DEVICE_REMINDER", "MAIL", "MARKETING"])
|
|
1245
|
+
return false unless huawei_category_validator.valid?(@huawei_category)
|
|
1184
1246
|
true
|
|
1185
1247
|
end
|
|
1186
1248
|
|
|
@@ -1204,6 +1266,16 @@ module OneSignal
|
|
|
1204
1266
|
@aggregation = aggregation
|
|
1205
1267
|
end
|
|
1206
1268
|
|
|
1269
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
1270
|
+
# @param [Object] huawei_category Object to be assigned
|
|
1271
|
+
def huawei_category=(huawei_category)
|
|
1272
|
+
validator = EnumAttributeValidator.new('String', ["IM", "VOIP", "SUBSCRIPTION", "TRAVEL", "HEALTH", "WORK", "ACCOUNT", "EXPRESS", "FINANCE", "DEVICE_REMINDER", "MAIL", "MARKETING"])
|
|
1273
|
+
unless validator.valid?(huawei_category)
|
|
1274
|
+
fail ArgumentError, "invalid value for \"huawei_category\", must be one of #{validator.allowable_values}."
|
|
1275
|
+
end
|
|
1276
|
+
@huawei_category = huawei_category
|
|
1277
|
+
end
|
|
1278
|
+
|
|
1207
1279
|
# Checks equality by comparing each attribute.
|
|
1208
1280
|
# @param [Object] Object to be compared
|
|
1209
1281
|
def ==(o)
|
|
@@ -1310,13 +1382,19 @@ module OneSignal
|
|
|
1310
1382
|
email_body == o.email_body &&
|
|
1311
1383
|
email_from_name == o.email_from_name &&
|
|
1312
1384
|
email_from_address == o.email_from_address &&
|
|
1385
|
+
email_reply_to_address == o.email_reply_to_address &&
|
|
1313
1386
|
email_preheader == o.email_preheader &&
|
|
1314
1387
|
disable_email_click_tracking == o.disable_email_click_tracking &&
|
|
1315
1388
|
include_unsubscribed == o.include_unsubscribed &&
|
|
1316
1389
|
sms_from == o.sms_from &&
|
|
1317
1390
|
sms_media_urls == o.sms_media_urls &&
|
|
1318
1391
|
filters == o.filters &&
|
|
1319
|
-
custom_data == o.custom_data
|
|
1392
|
+
custom_data == o.custom_data &&
|
|
1393
|
+
huawei_badge_class == o.huawei_badge_class &&
|
|
1394
|
+
huawei_badge_add_num == o.huawei_badge_add_num &&
|
|
1395
|
+
huawei_badge_set_num == o.huawei_badge_set_num &&
|
|
1396
|
+
huawei_category == o.huawei_category &&
|
|
1397
|
+
huawei_bi_tag == o.huawei_bi_tag
|
|
1320
1398
|
end
|
|
1321
1399
|
|
|
1322
1400
|
# @see the `==` method
|
|
@@ -1328,7 +1406,7 @@ module OneSignal
|
|
|
1328
1406
|
# Calculates hash code according to all attributes.
|
|
1329
1407
|
# @return [Integer] Hash code
|
|
1330
1408
|
def hash
|
|
1331
|
-
[included_segments, excluded_segments, include_subscription_ids, include_email_tokens, include_phone_numbers, include_ios_tokens, include_wp_wns_uris, include_amazon_reg_ids, include_chrome_reg_ids, include_chrome_web_reg_ids, include_android_reg_ids, include_aliases, target_channel, id, value, name, aggregation, is_ios, is_android, is_huawei, is_any_web, is_chrome_web, is_firefox, is_safari, is_wp_wns, is_adm, is_chrome, app_id, external_id, idempotency_key, contents, headings, subtitle, data, huawei_msg_type, url, web_url, app_url, ios_attachments, template_id, content_available, mutable_content, target_content_identifier, big_picture, huawei_big_picture, adm_big_picture, chrome_big_picture, chrome_web_image, buttons, web_buttons, ios_category, android_channel_id, huawei_channel_id, existing_android_channel_id, huawei_existing_channel_id, android_background_layout, small_icon, huawei_small_icon, large_icon, huawei_large_icon, adm_small_icon, adm_large_icon, chrome_web_icon, chrome_web_badge, firefox_icon, chrome_icon, ios_sound, android_sound, huawei_sound, adm_sound, wp_wns_sound, android_led_color, huawei_led_color, android_accent_color, huawei_accent_color, android_visibility, huawei_visibility, ios_badge_type, ios_badge_count, collapse_id, web_push_topic, apns_alert, delayed_option, delivery_time_of_day, ttl, priority, apns_push_type_override, throttle_rate_per_minute, android_group, android_group_message, adm_group, adm_group_message, thread_id, summary_arg, summary_arg_count, ios_relevance_score, ios_interruption_level, email_subject, email_body, email_from_name, email_from_address, email_preheader, disable_email_click_tracking, include_unsubscribed, sms_from, sms_media_urls, filters, custom_data].hash
|
|
1409
|
+
[included_segments, excluded_segments, include_subscription_ids, include_email_tokens, include_phone_numbers, include_ios_tokens, include_wp_wns_uris, include_amazon_reg_ids, include_chrome_reg_ids, include_chrome_web_reg_ids, include_android_reg_ids, include_aliases, target_channel, id, value, name, aggregation, is_ios, is_android, is_huawei, is_any_web, is_chrome_web, is_firefox, is_safari, is_wp_wns, is_adm, is_chrome, app_id, external_id, idempotency_key, contents, headings, subtitle, data, huawei_msg_type, url, web_url, app_url, ios_attachments, template_id, content_available, mutable_content, target_content_identifier, big_picture, huawei_big_picture, adm_big_picture, chrome_big_picture, chrome_web_image, buttons, web_buttons, ios_category, android_channel_id, huawei_channel_id, existing_android_channel_id, huawei_existing_channel_id, android_background_layout, small_icon, huawei_small_icon, large_icon, huawei_large_icon, adm_small_icon, adm_large_icon, chrome_web_icon, chrome_web_badge, firefox_icon, chrome_icon, ios_sound, android_sound, huawei_sound, adm_sound, wp_wns_sound, android_led_color, huawei_led_color, android_accent_color, huawei_accent_color, android_visibility, huawei_visibility, ios_badge_type, ios_badge_count, collapse_id, web_push_topic, apns_alert, delayed_option, delivery_time_of_day, ttl, priority, apns_push_type_override, throttle_rate_per_minute, android_group, android_group_message, adm_group, adm_group_message, thread_id, summary_arg, summary_arg_count, ios_relevance_score, ios_interruption_level, email_subject, email_body, email_from_name, email_from_address, email_reply_to_address, email_preheader, disable_email_click_tracking, include_unsubscribed, sms_from, sms_media_urls, filters, custom_data, huawei_badge_class, huawei_badge_add_num, huawei_badge_set_num, huawei_category, huawei_bi_tag].hash
|
|
1332
1410
|
end
|
|
1333
1411
|
|
|
1334
1412
|
# Builds the object from hash
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 5.
|
|
6
|
+
The version of the OpenAPI document: 5.3.0
|
|
7
7
|
Contact: devrel@onesignal.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
OpenAPI Generator version: 6.0.0-SNAPSHOT
|
|
@@ -272,6 +272,9 @@ module OneSignal
|
|
|
272
272
|
# Channel: Email The email address the email is from. If not specified, will default to \"from email\" set in the OneSignal Dashboard Email Settings.
|
|
273
273
|
attr_accessor :email_from_address
|
|
274
274
|
|
|
275
|
+
# Channel: Email The email address where replies should be sent. If not specified, replies will go to the from address.
|
|
276
|
+
attr_accessor :email_reply_to_address
|
|
277
|
+
|
|
275
278
|
# Channel: Email The preheader text of the email. Preheader is the preview text displayed immediately after an email subject that provides additional context about the email content. If not specified, will default to null.
|
|
276
279
|
attr_accessor :email_preheader
|
|
277
280
|
|
|
@@ -292,6 +295,21 @@ module OneSignal
|
|
|
292
295
|
# Channel: All JSON object that can be used as a source of message personalization data for fields that support tag variable substitution. Push, SMS: Can accept up to 2048 bytes of valid JSON. Email: Can accept up to 10000 bytes of valid JSON. Example: {\"order_id\": 123, \"currency\": \"USD\", \"amount\": 25}
|
|
293
296
|
attr_accessor :custom_data
|
|
294
297
|
|
|
298
|
+
# Channel: Push Notifications Platform: Huawei Full path of the app entry activity class
|
|
299
|
+
attr_accessor :huawei_badge_class
|
|
300
|
+
|
|
301
|
+
# Channel: Push Notifications Platform: Huawei Accumulative badge number, which is an integer ranging from 1 to 99
|
|
302
|
+
attr_accessor :huawei_badge_add_num
|
|
303
|
+
|
|
304
|
+
# Channel: Push Notifications Platform: Huawei Badge number, which is an integer ranging from 0 to 99
|
|
305
|
+
attr_accessor :huawei_badge_set_num
|
|
306
|
+
|
|
307
|
+
# Channel: Push Notifications Platform: Huawei Category of the push notification for HMS classification.
|
|
308
|
+
attr_accessor :huawei_category
|
|
309
|
+
|
|
310
|
+
# Channel: Push Notifications Platform: Huawei A tag used for Huawei business intelligence and analytics.
|
|
311
|
+
attr_accessor :huawei_bi_tag
|
|
312
|
+
|
|
295
313
|
class EnumAttributeValidator
|
|
296
314
|
attr_reader :datatype
|
|
297
315
|
attr_reader :allowable_values
|
|
@@ -405,13 +423,19 @@ module OneSignal
|
|
|
405
423
|
:'email_body' => :'email_body',
|
|
406
424
|
:'email_from_name' => :'email_from_name',
|
|
407
425
|
:'email_from_address' => :'email_from_address',
|
|
426
|
+
:'email_reply_to_address' => :'email_reply_to_address',
|
|
408
427
|
:'email_preheader' => :'email_preheader',
|
|
409
428
|
:'disable_email_click_tracking' => :'disable_email_click_tracking',
|
|
410
429
|
:'include_unsubscribed' => :'include_unsubscribed',
|
|
411
430
|
:'sms_from' => :'sms_from',
|
|
412
431
|
:'sms_media_urls' => :'sms_media_urls',
|
|
413
432
|
:'filters' => :'filters',
|
|
414
|
-
:'custom_data' => :'custom_data'
|
|
433
|
+
:'custom_data' => :'custom_data',
|
|
434
|
+
:'huawei_badge_class' => :'huawei_badge_class',
|
|
435
|
+
:'huawei_badge_add_num' => :'huawei_badge_add_num',
|
|
436
|
+
:'huawei_badge_set_num' => :'huawei_badge_set_num',
|
|
437
|
+
:'huawei_category' => :'huawei_category',
|
|
438
|
+
:'huawei_bi_tag' => :'huawei_bi_tag'
|
|
415
439
|
}
|
|
416
440
|
end
|
|
417
441
|
|
|
@@ -511,13 +535,19 @@ module OneSignal
|
|
|
511
535
|
:'email_body' => :'String',
|
|
512
536
|
:'email_from_name' => :'String',
|
|
513
537
|
:'email_from_address' => :'String',
|
|
538
|
+
:'email_reply_to_address' => :'String',
|
|
514
539
|
:'email_preheader' => :'String',
|
|
515
540
|
:'disable_email_click_tracking' => :'Boolean',
|
|
516
541
|
:'include_unsubscribed' => :'Boolean',
|
|
517
542
|
:'sms_from' => :'String',
|
|
518
543
|
:'sms_media_urls' => :'Array<String>',
|
|
519
544
|
:'filters' => :'Array<FilterExpression>',
|
|
520
|
-
:'custom_data' => :'Object'
|
|
545
|
+
:'custom_data' => :'Object',
|
|
546
|
+
:'huawei_badge_class' => :'String',
|
|
547
|
+
:'huawei_badge_add_num' => :'Integer',
|
|
548
|
+
:'huawei_badge_set_num' => :'Integer',
|
|
549
|
+
:'huawei_category' => :'String',
|
|
550
|
+
:'huawei_bi_tag' => :'String'
|
|
521
551
|
}
|
|
522
552
|
end
|
|
523
553
|
|
|
@@ -599,12 +629,18 @@ module OneSignal
|
|
|
599
629
|
:'email_subject',
|
|
600
630
|
:'email_from_name',
|
|
601
631
|
:'email_from_address',
|
|
632
|
+
:'email_reply_to_address',
|
|
602
633
|
:'email_preheader',
|
|
603
634
|
:'disable_email_click_tracking',
|
|
604
635
|
:'sms_from',
|
|
605
636
|
:'sms_media_urls',
|
|
606
637
|
:'filters',
|
|
607
|
-
:'custom_data'
|
|
638
|
+
:'custom_data',
|
|
639
|
+
:'huawei_badge_class',
|
|
640
|
+
:'huawei_badge_add_num',
|
|
641
|
+
:'huawei_badge_set_num',
|
|
642
|
+
:'huawei_category',
|
|
643
|
+
:'huawei_bi_tag'
|
|
608
644
|
])
|
|
609
645
|
end
|
|
610
646
|
|
|
@@ -979,6 +1015,10 @@ module OneSignal
|
|
|
979
1015
|
self.email_from_address = attributes[:'email_from_address']
|
|
980
1016
|
end
|
|
981
1017
|
|
|
1018
|
+
if attributes.key?(:'email_reply_to_address')
|
|
1019
|
+
self.email_reply_to_address = attributes[:'email_reply_to_address']
|
|
1020
|
+
end
|
|
1021
|
+
|
|
982
1022
|
if attributes.key?(:'email_preheader')
|
|
983
1023
|
self.email_preheader = attributes[:'email_preheader']
|
|
984
1024
|
end
|
|
@@ -1010,6 +1050,26 @@ module OneSignal
|
|
|
1010
1050
|
if attributes.key?(:'custom_data')
|
|
1011
1051
|
self.custom_data = attributes[:'custom_data']
|
|
1012
1052
|
end
|
|
1053
|
+
|
|
1054
|
+
if attributes.key?(:'huawei_badge_class')
|
|
1055
|
+
self.huawei_badge_class = attributes[:'huawei_badge_class']
|
|
1056
|
+
end
|
|
1057
|
+
|
|
1058
|
+
if attributes.key?(:'huawei_badge_add_num')
|
|
1059
|
+
self.huawei_badge_add_num = attributes[:'huawei_badge_add_num']
|
|
1060
|
+
end
|
|
1061
|
+
|
|
1062
|
+
if attributes.key?(:'huawei_badge_set_num')
|
|
1063
|
+
self.huawei_badge_set_num = attributes[:'huawei_badge_set_num']
|
|
1064
|
+
end
|
|
1065
|
+
|
|
1066
|
+
if attributes.key?(:'huawei_category')
|
|
1067
|
+
self.huawei_category = attributes[:'huawei_category']
|
|
1068
|
+
end
|
|
1069
|
+
|
|
1070
|
+
if attributes.key?(:'huawei_bi_tag')
|
|
1071
|
+
self.huawei_bi_tag = attributes[:'huawei_bi_tag']
|
|
1072
|
+
end
|
|
1013
1073
|
end
|
|
1014
1074
|
|
|
1015
1075
|
# Show invalid properties with the reasons. Usually used together with valid?
|
|
@@ -1024,6 +1084,8 @@ module OneSignal
|
|
|
1024
1084
|
def valid?
|
|
1025
1085
|
aggregation_validator = EnumAttributeValidator.new('String', ["sum", "count"])
|
|
1026
1086
|
return false unless aggregation_validator.valid?(@aggregation)
|
|
1087
|
+
huawei_category_validator = EnumAttributeValidator.new('String', ["IM", "VOIP", "SUBSCRIPTION", "TRAVEL", "HEALTH", "WORK", "ACCOUNT", "EXPRESS", "FINANCE", "DEVICE_REMINDER", "MAIL", "MARKETING"])
|
|
1088
|
+
return false unless huawei_category_validator.valid?(@huawei_category)
|
|
1027
1089
|
true
|
|
1028
1090
|
end
|
|
1029
1091
|
|
|
@@ -1037,6 +1099,16 @@ module OneSignal
|
|
|
1037
1099
|
@aggregation = aggregation
|
|
1038
1100
|
end
|
|
1039
1101
|
|
|
1102
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
1103
|
+
# @param [Object] huawei_category Object to be assigned
|
|
1104
|
+
def huawei_category=(huawei_category)
|
|
1105
|
+
validator = EnumAttributeValidator.new('String', ["IM", "VOIP", "SUBSCRIPTION", "TRAVEL", "HEALTH", "WORK", "ACCOUNT", "EXPRESS", "FINANCE", "DEVICE_REMINDER", "MAIL", "MARKETING"])
|
|
1106
|
+
unless validator.valid?(huawei_category)
|
|
1107
|
+
fail ArgumentError, "invalid value for \"huawei_category\", must be one of #{validator.allowable_values}."
|
|
1108
|
+
end
|
|
1109
|
+
@huawei_category = huawei_category
|
|
1110
|
+
end
|
|
1111
|
+
|
|
1040
1112
|
# Checks equality by comparing each attribute.
|
|
1041
1113
|
# @param [Object] Object to be compared
|
|
1042
1114
|
def ==(o)
|
|
@@ -1130,13 +1202,19 @@ module OneSignal
|
|
|
1130
1202
|
email_body == o.email_body &&
|
|
1131
1203
|
email_from_name == o.email_from_name &&
|
|
1132
1204
|
email_from_address == o.email_from_address &&
|
|
1205
|
+
email_reply_to_address == o.email_reply_to_address &&
|
|
1133
1206
|
email_preheader == o.email_preheader &&
|
|
1134
1207
|
disable_email_click_tracking == o.disable_email_click_tracking &&
|
|
1135
1208
|
include_unsubscribed == o.include_unsubscribed &&
|
|
1136
1209
|
sms_from == o.sms_from &&
|
|
1137
1210
|
sms_media_urls == o.sms_media_urls &&
|
|
1138
1211
|
filters == o.filters &&
|
|
1139
|
-
custom_data == o.custom_data
|
|
1212
|
+
custom_data == o.custom_data &&
|
|
1213
|
+
huawei_badge_class == o.huawei_badge_class &&
|
|
1214
|
+
huawei_badge_add_num == o.huawei_badge_add_num &&
|
|
1215
|
+
huawei_badge_set_num == o.huawei_badge_set_num &&
|
|
1216
|
+
huawei_category == o.huawei_category &&
|
|
1217
|
+
huawei_bi_tag == o.huawei_bi_tag
|
|
1140
1218
|
end
|
|
1141
1219
|
|
|
1142
1220
|
# @see the `==` method
|
|
@@ -1148,7 +1226,7 @@ module OneSignal
|
|
|
1148
1226
|
# Calculates hash code according to all attributes.
|
|
1149
1227
|
# @return [Integer] Hash code
|
|
1150
1228
|
def hash
|
|
1151
|
-
[id, value, name, aggregation, is_ios, is_android, is_huawei, is_any_web, is_chrome_web, is_firefox, is_safari, is_wp_wns, is_adm, is_chrome, app_id, external_id, idempotency_key, contents, headings, subtitle, data, huawei_msg_type, url, web_url, app_url, ios_attachments, template_id, content_available, mutable_content, target_content_identifier, big_picture, huawei_big_picture, adm_big_picture, chrome_big_picture, chrome_web_image, buttons, web_buttons, ios_category, android_channel_id, huawei_channel_id, existing_android_channel_id, huawei_existing_channel_id, android_background_layout, small_icon, huawei_small_icon, large_icon, huawei_large_icon, adm_small_icon, adm_large_icon, chrome_web_icon, chrome_web_badge, firefox_icon, chrome_icon, ios_sound, android_sound, huawei_sound, adm_sound, wp_wns_sound, android_led_color, huawei_led_color, android_accent_color, huawei_accent_color, android_visibility, huawei_visibility, ios_badge_type, ios_badge_count, collapse_id, web_push_topic, apns_alert, delayed_option, delivery_time_of_day, ttl, priority, apns_push_type_override, throttle_rate_per_minute, android_group, android_group_message, adm_group, adm_group_message, thread_id, summary_arg, summary_arg_count, ios_relevance_score, ios_interruption_level, email_subject, email_body, email_from_name, email_from_address, email_preheader, disable_email_click_tracking, include_unsubscribed, sms_from, sms_media_urls, filters, custom_data].hash
|
|
1229
|
+
[id, value, name, aggregation, is_ios, is_android, is_huawei, is_any_web, is_chrome_web, is_firefox, is_safari, is_wp_wns, is_adm, is_chrome, app_id, external_id, idempotency_key, contents, headings, subtitle, data, huawei_msg_type, url, web_url, app_url, ios_attachments, template_id, content_available, mutable_content, target_content_identifier, big_picture, huawei_big_picture, adm_big_picture, chrome_big_picture, chrome_web_image, buttons, web_buttons, ios_category, android_channel_id, huawei_channel_id, existing_android_channel_id, huawei_existing_channel_id, android_background_layout, small_icon, huawei_small_icon, large_icon, huawei_large_icon, adm_small_icon, adm_large_icon, chrome_web_icon, chrome_web_badge, firefox_icon, chrome_icon, ios_sound, android_sound, huawei_sound, adm_sound, wp_wns_sound, android_led_color, huawei_led_color, android_accent_color, huawei_accent_color, android_visibility, huawei_visibility, ios_badge_type, ios_badge_count, collapse_id, web_push_topic, apns_alert, delayed_option, delivery_time_of_day, ttl, priority, apns_push_type_override, throttle_rate_per_minute, android_group, android_group_message, adm_group, adm_group_message, thread_id, summary_arg, summary_arg_count, ios_relevance_score, ios_interruption_level, email_subject, email_body, email_from_name, email_from_address, email_reply_to_address, email_preheader, disable_email_click_tracking, include_unsubscribed, sms_from, sms_media_urls, filters, custom_data, huawei_badge_class, huawei_badge_add_num, huawei_badge_set_num, huawei_category, huawei_bi_tag].hash
|
|
1152
1230
|
end
|
|
1153
1231
|
|
|
1154
1232
|
# Builds the object from hash
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 5.
|
|
6
|
+
The version of the OpenAPI document: 5.3.0
|
|
7
7
|
Contact: devrel@onesignal.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
OpenAPI Generator version: 6.0.0-SNAPSHOT
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 5.
|
|
6
|
+
The version of the OpenAPI document: 5.3.0
|
|
7
7
|
Contact: devrel@onesignal.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
OpenAPI Generator version: 6.0.0-SNAPSHOT
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#OneSignal
|
|
3
|
+
|
|
4
|
+
#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 5.3.0
|
|
7
|
+
Contact: devrel@onesignal.com
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
OpenAPI Generator version: 6.0.0-SNAPSHOT
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module OneSignal
|
|
17
|
+
class CopyTemplateRequest
|
|
18
|
+
# Destination OneSignal App ID in UUID v4 format.
|
|
19
|
+
attr_accessor :target_app_id
|
|
20
|
+
|
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
22
|
+
def self.attribute_map
|
|
23
|
+
{
|
|
24
|
+
:'target_app_id' => :'target_app_id'
|
|
25
|
+
}
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Returns all the JSON keys this model knows about
|
|
29
|
+
def self.acceptable_attributes
|
|
30
|
+
attribute_map.values
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Attribute type mapping.
|
|
34
|
+
def self.openapi_types
|
|
35
|
+
{
|
|
36
|
+
:'target_app_id' => :'String'
|
|
37
|
+
}
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# List of attributes with nullable: true
|
|
41
|
+
def self.openapi_nullable
|
|
42
|
+
Set.new([
|
|
43
|
+
])
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Initializes the object
|
|
47
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
48
|
+
def initialize(attributes = {})
|
|
49
|
+
if (!attributes.is_a?(Hash))
|
|
50
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::CopyTemplateRequest` initialize method"
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
54
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
55
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
56
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::CopyTemplateRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
57
|
+
end
|
|
58
|
+
h[k.to_sym] = v
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if attributes.key?(:'target_app_id')
|
|
62
|
+
self.target_app_id = attributes[:'target_app_id']
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
67
|
+
# @return Array for valid properties with the reasons
|
|
68
|
+
def list_invalid_properties
|
|
69
|
+
invalid_properties = Array.new
|
|
70
|
+
if @target_app_id.nil?
|
|
71
|
+
invalid_properties.push('invalid value for "target_app_id", target_app_id cannot be nil.')
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
invalid_properties
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Check to see if the all the properties in the model are valid
|
|
78
|
+
# @return true if the model is valid
|
|
79
|
+
def valid?
|
|
80
|
+
return false if @target_app_id.nil?
|
|
81
|
+
true
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# Checks equality by comparing each attribute.
|
|
85
|
+
# @param [Object] Object to be compared
|
|
86
|
+
def ==(o)
|
|
87
|
+
return true if self.equal?(o)
|
|
88
|
+
self.class == o.class &&
|
|
89
|
+
target_app_id == o.target_app_id
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# @see the `==` method
|
|
93
|
+
# @param [Object] Object to be compared
|
|
94
|
+
def eql?(o)
|
|
95
|
+
self == o
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Calculates hash code according to all attributes.
|
|
99
|
+
# @return [Integer] Hash code
|
|
100
|
+
def hash
|
|
101
|
+
[target_app_id].hash
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Builds the object from hash
|
|
105
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
106
|
+
# @return [Object] Returns the model itself
|
|
107
|
+
def self.build_from_hash(attributes)
|
|
108
|
+
new.build_from_hash(attributes)
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# Builds the object from hash
|
|
112
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
113
|
+
# @return [Object] Returns the model itself
|
|
114
|
+
def build_from_hash(attributes)
|
|
115
|
+
return nil unless attributes.is_a?(Hash)
|
|
116
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
117
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
118
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
119
|
+
self.send("#{key}=", nil)
|
|
120
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
121
|
+
# check to ensure the input is an array given that the attribute
|
|
122
|
+
# is documented as an array but the input is not
|
|
123
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
124
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
125
|
+
end
|
|
126
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
127
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
self
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
# Deserializes the data based on type
|
|
135
|
+
# @param string type Data type
|
|
136
|
+
# @param string value Value to be deserialized
|
|
137
|
+
# @return [Object] Deserialized data
|
|
138
|
+
def _deserialize(type, value)
|
|
139
|
+
case type.to_sym
|
|
140
|
+
when :Time
|
|
141
|
+
Time.parse(value)
|
|
142
|
+
when :Date
|
|
143
|
+
Date.parse(value)
|
|
144
|
+
when :String
|
|
145
|
+
value.to_s
|
|
146
|
+
when :Integer
|
|
147
|
+
value.to_i
|
|
148
|
+
when :Float
|
|
149
|
+
value.to_f
|
|
150
|
+
when :Boolean
|
|
151
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
152
|
+
true
|
|
153
|
+
else
|
|
154
|
+
false
|
|
155
|
+
end
|
|
156
|
+
when :Object
|
|
157
|
+
# generic object (usually a Hash), return directly
|
|
158
|
+
value
|
|
159
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
160
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
161
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
162
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
163
|
+
k_type = Regexp.last_match[:k_type]
|
|
164
|
+
v_type = Regexp.last_match[:v_type]
|
|
165
|
+
{}.tap do |hash|
|
|
166
|
+
value.each do |k, v|
|
|
167
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
else # model
|
|
171
|
+
# models (e.g. Pet) or oneOf
|
|
172
|
+
klass = OneSignal.const_get(type)
|
|
173
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
# Returns the string representation of the object
|
|
178
|
+
# @return [String] String presentation of the object
|
|
179
|
+
def to_s
|
|
180
|
+
to_hash.to_s
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
184
|
+
# @return [Hash] Returns the object in the form of hash
|
|
185
|
+
def to_body
|
|
186
|
+
to_hash
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
# Returns the object in the form of hash
|
|
190
|
+
# @return [Hash] Returns the object in the form of hash
|
|
191
|
+
def to_hash
|
|
192
|
+
hash = {}
|
|
193
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
194
|
+
value = self.send(attr)
|
|
195
|
+
if value.nil?
|
|
196
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
197
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
hash[param] = _to_hash(value)
|
|
201
|
+
end
|
|
202
|
+
hash
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
# Outputs non-array value in the form of hash
|
|
206
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
207
|
+
# @param [Object] value Any valid value
|
|
208
|
+
# @return [Hash] Returns the value in the form of hash
|
|
209
|
+
def _to_hash(value)
|
|
210
|
+
if value.is_a?(Array)
|
|
211
|
+
value.compact.map { |v| _to_hash(v) }
|
|
212
|
+
elsif value.is_a?(Hash)
|
|
213
|
+
{}.tap do |hash|
|
|
214
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
215
|
+
end
|
|
216
|
+
elsif value.respond_to? :to_hash
|
|
217
|
+
value.to_hash
|
|
218
|
+
else
|
|
219
|
+
value
|
|
220
|
+
end
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
end
|