svix 1.60.1 → 1.61.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/Gemfile +5 -1
- data/Gemfile.lock +35 -21
- data/README.md +0 -7
- data/lib/svix/api/application.rb +96 -0
- data/lib/svix/api/authentication.rb +65 -0
- data/lib/svix/api/background_task.rb +39 -0
- data/lib/svix/api/endpoint.rb +202 -0
- data/lib/svix/api/environment.rb +39 -0
- data/lib/svix/api/event_type.rb +99 -0
- data/lib/svix/api/health.rb +21 -0
- data/lib/svix/api/integration.rb +91 -0
- data/lib/svix/api/message.rb +112 -0
- data/lib/svix/api/message_attempt.rb +123 -0
- data/lib/svix/api/operational_webhook_endpoint.rb +109 -0
- data/lib/svix/api/statistics.rb +36 -0
- data/lib/svix/api_error.rb +7 -17
- data/lib/svix/errors.rb +9 -9
- data/lib/svix/http_error_out.rb +18 -0
- data/lib/svix/http_validation_error.rb +18 -0
- data/lib/svix/internal.rb +0 -9
- data/lib/svix/models/aggregate_event_types_out.rb +32 -292
- data/lib/svix/models/app_portal_access_in.rb +31 -278
- data/lib/svix/models/app_portal_access_out.rb +27 -243
- data/lib/svix/models/app_usage_stats_in.rb +30 -234
- data/lib/svix/models/app_usage_stats_out.rb +31 -320
- data/lib/svix/models/application_in.rb +31 -298
- data/lib/svix/models/application_out.rb +37 -371
- data/lib/svix/models/application_patch.rb +31 -272
- data/lib/svix/models/application_token_expire_in.rb +28 -219
- data/lib/svix/models/background_task_out.rb +31 -307
- data/lib/svix/models/background_task_status.rb +14 -25
- data/lib/svix/models/background_task_type.rb +23 -26
- data/lib/svix/models/connector_in.rb +58 -385
- data/lib/svix/models/connector_kind.rb +28 -26
- data/lib/svix/models/dashboard_access_out.rb +27 -243
- data/lib/svix/models/endpoint_headers_in.rb +25 -202
- data/lib/svix/models/endpoint_headers_out.rb +30 -230
- data/lib/svix/models/endpoint_headers_patch_in.rb +28 -202
- data/lib/svix/models/endpoint_in.rb +61 -449
- data/lib/svix/models/endpoint_message_out.rb +48 -467
- data/lib/svix/models/endpoint_out.rb +67 -528
- data/lib/svix/models/endpoint_patch.rb +61 -383
- data/lib/svix/models/endpoint_secret_out.rb +25 -222
- data/lib/svix/models/endpoint_secret_rotate_in.rb +28 -212
- data/lib/svix/models/endpoint_stats.rb +31 -245
- data/lib/svix/models/endpoint_transformation_in.rb +30 -226
- data/lib/svix/models/endpoint_transformation_out.rb +30 -228
- data/lib/svix/models/endpoint_update.rb +58 -422
- data/lib/svix/models/environment_in.rb +31 -212
- data/lib/svix/models/environment_out.rb +35 -255
- data/lib/svix/models/event_example_in.rb +27 -261
- data/lib/svix/models/event_type_from_open_api.rb +35 -341
- data/lib/svix/models/event_type_import_open_api_in.rb +37 -228
- data/lib/svix/models/event_type_import_open_api_out.rb +28 -200
- data/lib/svix/models/event_type_import_open_api_out_data.rb +31 -211
- data/lib/svix/models/event_type_in.rb +37 -347
- data/lib/svix/models/event_type_out.rb +58 -389
- data/lib/svix/models/event_type_patch.rb +35 -289
- data/lib/svix/models/event_type_update.rb +35 -301
- data/lib/svix/models/expung_all_contents_out.rb +29 -292
- data/lib/svix/models/integration_in.rb +27 -239
- data/lib/svix/models/integration_key_out.rb +25 -200
- data/lib/svix/models/integration_out.rb +33 -324
- data/lib/svix/models/integration_update.rb +27 -239
- data/lib/svix/models/list_response_application_out.rb +34 -237
- data/lib/svix/models/list_response_background_task_out.rb +34 -237
- data/lib/svix/models/list_response_endpoint_message_out.rb +34 -237
- data/lib/svix/models/list_response_endpoint_out.rb +34 -237
- data/lib/svix/models/list_response_event_type_out.rb +34 -237
- data/lib/svix/models/list_response_integration_out.rb +34 -237
- data/lib/svix/models/list_response_message_attempt_out.rb +34 -237
- data/lib/svix/models/list_response_message_endpoint_out.rb +34 -237
- data/lib/svix/models/list_response_message_out.rb +34 -237
- data/lib/svix/models/list_response_operational_webhook_endpoint_out.rb +34 -237
- data/lib/svix/models/message_attempt_out.rb +64 -521
- data/lib/svix/models/message_attempt_trigger_type.rb +20 -28
- data/lib/svix/models/message_endpoint_out.rb +70 -557
- data/lib/svix/models/message_in.rb +58 -450
- data/lib/svix/models/message_out.rb +37 -414
- data/lib/svix/models/message_status.rb +24 -30
- data/lib/svix/models/operational_webhook_endpoint_headers_in.rb +28 -202
- data/lib/svix/models/operational_webhook_endpoint_headers_out.rb +30 -229
- data/lib/svix/models/operational_webhook_endpoint_in.rb +42 -380
- data/lib/svix/models/operational_webhook_endpoint_out.rb +64 -458
- data/lib/svix/models/operational_webhook_endpoint_secret_in.rb +28 -212
- data/lib/svix/models/operational_webhook_endpoint_secret_out.rb +28 -222
- data/lib/svix/models/operational_webhook_endpoint_update.rb +40 -353
- data/lib/svix/models/ordering.rb +15 -25
- data/lib/svix/models/recover_in.rb +28 -210
- data/lib/svix/models/recover_out.rb +29 -292
- data/lib/svix/models/replay_in.rb +28 -210
- data/lib/svix/models/replay_out.rb +29 -292
- data/lib/svix/models/status_code_class.rb +28 -32
- data/lib/svix/models/template_out.rb +70 -514
- data/lib/svix/svix.rb +50 -50
- data/lib/svix/svix_http_client.rb +110 -0
- data/lib/svix/util.rb +44 -25
- data/lib/svix/validation_error.rb +28 -0
- data/lib/svix/version.rb +1 -1
- data/lib/svix/webhook.rb +69 -65
- data/lib/svix.rb +51 -37
- data/svix.gemspec +1 -10
- metadata +22 -194
- data/lib/svix/api/application_api.rb +0 -772
- data/lib/svix/api/authentication_api.rb +0 -791
- data/lib/svix/api/background_tasks_api.rb +0 -191
- data/lib/svix/api/broadcast_api.rb +0 -93
- data/lib/svix/api/endpoint_api.rb +0 -2752
- data/lib/svix/api/environment_api.rb +0 -153
- data/lib/svix/api/environment_settings_api.rb +0 -79
- data/lib/svix/api/event_type_api.rb +0 -852
- data/lib/svix/api/events_api.rb +0 -102
- data/lib/svix/api/health_api.rb +0 -79
- data/lib/svix/api/inbound_api.rb +0 -209
- data/lib/svix/api/integration_api.rb +0 -707
- data/lib/svix/api/message_api.rb +0 -1192
- data/lib/svix/api/message_attempt_api.rb +0 -1245
- data/lib/svix/api/statistics_api.rb +0 -333
- data/lib/svix/api/stream_api.rb +0 -659
- data/lib/svix/api/stream_event_types_api.rb +0 -486
- data/lib/svix/api/transformation_template_api.rb +0 -967
- data/lib/svix/api/webhook_endpoint_api.rb +0 -748
- data/lib/svix/api_client.rb +0 -423
- data/lib/svix/application_api.rb +0 -35
- data/lib/svix/authentication_api.rb +0 -21
- data/lib/svix/background_tasks_api.rb +0 -17
- data/lib/svix/configuration.rb +0 -312
- data/lib/svix/endpoint_api.rb +0 -80
- data/lib/svix/event_type_api.rb +0 -37
- data/lib/svix/integration_api.rb +0 -38
- data/lib/svix/message_api.rb +0 -54
- data/lib/svix/message_attempt_api.rb +0 -51
- data/lib/svix/models/active_application_out.rb +0 -373
- data/lib/svix/models/active_endpoint_out.rb +0 -355
- data/lib/svix/models/aggregated_event_types.rb +0 -305
- data/lib/svix/models/application_message_failure.rb +0 -277
- data/lib/svix/models/application_message_id_pair.rb +0 -317
- data/lib/svix/models/application_stats.rb +0 -323
- data/lib/svix/models/application_stats_out.rb +0 -324
- data/lib/svix/models/attempt_statistics_data.rb +0 -229
- data/lib/svix/models/attempt_statistics_response.rb +0 -291
- data/lib/svix/models/auth_token_out.rb +0 -325
- data/lib/svix/models/azure_blob_storage_config.rb +0 -253
- data/lib/svix/models/background_task_finished_event.rb +0 -272
- data/lib/svix/models/background_task_finished_event2.rb +0 -331
- data/lib/svix/models/big_query_config.rb +0 -271
- data/lib/svix/models/border_radius_config.rb +0 -254
- data/lib/svix/models/border_radius_enum.rb +0 -43
- data/lib/svix/models/client_secret_jwt_params_in.rb +0 -297
- data/lib/svix/models/completion_choice.rb +0 -253
- data/lib/svix/models/completion_message.rb +0 -237
- data/lib/svix/models/count_out.rb +0 -258
- data/lib/svix/models/create_stream_in.rb +0 -232
- data/lib/svix/models/create_token_in.rb +0 -248
- data/lib/svix/models/custom_color_palette.rb +0 -295
- data/lib/svix/models/custom_strings_override.rb +0 -235
- data/lib/svix/models/custom_theme_override.rb +0 -223
- data/lib/svix/models/data.rb +0 -108
- data/lib/svix/models/data_any_of.rb +0 -240
- data/lib/svix/models/data_any_of1.rb +0 -223
- data/lib/svix/models/data_any_of2.rb +0 -241
- data/lib/svix/models/data_any_of3.rb +0 -223
- data/lib/svix/models/data_any_of4.rb +0 -240
- data/lib/svix/models/duration.rb +0 -275
- data/lib/svix/models/endpoint_created_event.rb +0 -272
- data/lib/svix/models/endpoint_created_event_data.rb +0 -410
- data/lib/svix/models/endpoint_deleted_event.rb +0 -272
- data/lib/svix/models/endpoint_deleted_event_data.rb +0 -410
- data/lib/svix/models/endpoint_disabled_event.rb +0 -272
- data/lib/svix/models/endpoint_disabled_event_data.rb +0 -451
- data/lib/svix/models/endpoint_disabled_trigger.rb +0 -40
- data/lib/svix/models/endpoint_enabled_event.rb +0 -272
- data/lib/svix/models/endpoint_enabled_event_data.rb +0 -410
- data/lib/svix/models/endpoint_mtls_config_in.rb +0 -233
- data/lib/svix/models/endpoint_mtls_config_out.rb +0 -215
- data/lib/svix/models/endpoint_oauth_config_in.rb +0 -350
- data/lib/svix/models/endpoint_oauth_config_out.rb +0 -315
- data/lib/svix/models/endpoint_transformation_simulate_in.rb +0 -330
- data/lib/svix/models/endpoint_transformation_simulate_out.rb +0 -296
- data/lib/svix/models/endpoint_updated_event.rb +0 -272
- data/lib/svix/models/endpoint_updated_event_data.rb +0 -410
- data/lib/svix/models/environment_settings_out.rb +0 -455
- data/lib/svix/models/event_in.rb +0 -258
- data/lib/svix/models/event_out.rb +0 -274
- data/lib/svix/models/event_stream_out.rb +0 -255
- data/lib/svix/models/event_type_example_out.rb +0 -221
- data/lib/svix/models/event_type_schema_in.rb +0 -221
- data/lib/svix/models/export_event_type_out.rb +0 -315
- data/lib/svix/models/font_size_config.rb +0 -230
- data/lib/svix/models/generate_in.rb +0 -221
- data/lib/svix/models/generate_out.rb +0 -287
- data/lib/svix/models/google_cloud_storage_config.rb +0 -239
- data/lib/svix/models/http_error_out.rb +0 -237
- data/lib/svix/models/http_validation_error.rb +0 -223
- data/lib/svix/models/hubspot_oauth_config_in.rb +0 -221
- data/lib/svix/models/inbound_path_params.rb +0 -277
- data/lib/svix/models/incoming_webhook_payload_out.rb +0 -235
- data/lib/svix/models/kafka_security_protocol_type.rb +0 -41
- data/lib/svix/models/list_response_active_application_out.rb +0 -261
- data/lib/svix/models/list_response_application_stats.rb +0 -261
- data/lib/svix/models/list_response_message_attempt_endpoint_out.rb +0 -261
- data/lib/svix/models/list_response_sink_out.rb +0 -261
- data/lib/svix/models/list_response_stream_event_type_out.rb +0 -261
- data/lib/svix/models/list_response_stream_out.rb +0 -261
- data/lib/svix/models/list_response_stream_sink_out.rb +0 -261
- data/lib/svix/models/list_response_template_out.rb +0 -261
- data/lib/svix/models/message_attempt_endpoint_out.rb +0 -545
- data/lib/svix/models/message_attempt_exhausted_event.rb +0 -272
- data/lib/svix/models/message_attempt_exhausted_event_data.rb +0 -482
- data/lib/svix/models/message_attempt_failed_data.rb +0 -293
- data/lib/svix/models/message_attempt_failing_event.rb +0 -272
- data/lib/svix/models/message_attempt_failing_event_data.rb +0 -482
- data/lib/svix/models/message_attempt_headers_out.rb +0 -263
- data/lib/svix/models/message_attempt_recovered_event.rb +0 -272
- data/lib/svix/models/message_attempt_recovered_event_data.rb +0 -482
- data/lib/svix/models/message_broadcast_in.rb +0 -423
- data/lib/svix/models/message_broadcast_out.rb +0 -315
- data/lib/svix/models/message_events_out.rb +0 -255
- data/lib/svix/models/message_precheck_in.rb +0 -288
- data/lib/svix/models/message_precheck_out.rb +0 -221
- data/lib/svix/models/message_raw_payload_out.rb +0 -221
- data/lib/svix/models/message_subscriber_auth_token_out.rb +0 -237
- data/lib/svix/models/o_auth_payload_in.rb +0 -237
- data/lib/svix/models/o_auth_payload_out.rb +0 -235
- data/lib/svix/models/oauth2_auth_method_in_out.rb +0 -41
- data/lib/svix/models/oauth2_grant_type_in_out.rb +0 -40
- data/lib/svix/models/oauth_jws_signing_algorithm.rb +0 -39
- data/lib/svix/models/one_time_token_in.rb +0 -221
- data/lib/svix/models/one_time_token_out.rb +0 -221
- data/lib/svix/models/polling_endpoint_message_out.rb +0 -454
- data/lib/svix/models/polling_endpoint_out.rb +0 -255
- data/lib/svix/models/redshift_config.rb +0 -317
- data/lib/svix/models/retry_schedule_in_out.rb +0 -216
- data/lib/svix/models/rotate_poller_token_in.rb +0 -280
- data/lib/svix/models/rotated_url_out.rb +0 -221
- data/lib/svix/models/s3_config.rb +0 -269
- data/lib/svix/models/sink_http_config.rb +0 -242
- data/lib/svix/models/sink_in.rb +0 -108
- data/lib/svix/models/sink_in_one_of.rb +0 -287
- data/lib/svix/models/sink_in_one_of1.rb +0 -319
- data/lib/svix/models/sink_in_one_of2.rb +0 -325
- data/lib/svix/models/sink_in_one_of3.rb +0 -271
- data/lib/svix/models/sink_in_one_of4.rb +0 -255
- data/lib/svix/models/sink_otel_v1_config.rb +0 -221
- data/lib/svix/models/sink_out.rb +0 -108
- data/lib/svix/models/sink_payload_format.rb +0 -39
- data/lib/svix/models/sink_secret_out.rb +0 -233
- data/lib/svix/models/sink_status.rb +0 -41
- data/lib/svix/models/sink_status_in.rb +0 -40
- data/lib/svix/models/sink_transform_in.rb +0 -248
- data/lib/svix/models/sink_transformation_out.rb +0 -226
- data/lib/svix/models/snowflake_config.rb +0 -287
- data/lib/svix/models/statistics_period.rb +0 -40
- data/lib/svix/models/stream_event_type_in.rb +0 -262
- data/lib/svix/models/stream_event_type_out.rb +0 -294
- data/lib/svix/models/stream_event_type_patch.rb +0 -254
- data/lib/svix/models/stream_in.rb +0 -287
- data/lib/svix/models/stream_out.rb +0 -350
- data/lib/svix/models/stream_patch.rb +0 -261
- data/lib/svix/models/stream_portal_access_in.rb +0 -293
- data/lib/svix/models/stream_sink_in.rb +0 -111
- data/lib/svix/models/stream_sink_in_one_of.rb +0 -271
- data/lib/svix/models/stream_sink_in_one_of1.rb +0 -271
- data/lib/svix/models/stream_sink_in_one_of2.rb +0 -271
- data/lib/svix/models/stream_sink_in_one_of3.rb +0 -271
- data/lib/svix/models/stream_sink_in_one_of4.rb +0 -271
- data/lib/svix/models/stream_sink_in_one_of5.rb +0 -271
- data/lib/svix/models/stream_sink_in_one_of6.rb +0 -271
- data/lib/svix/models/stream_sink_in_one_of7.rb +0 -271
- data/lib/svix/models/stream_sink_out.rb +0 -111
- data/lib/svix/models/stream_sink_patch.rb +0 -111
- data/lib/svix/models/template_patch.rb +0 -382
- data/lib/svix/models/template_update.rb +0 -402
- data/lib/svix/models/transformation_http_method.rb +0 -41
- data/lib/svix/models/transformation_simulate_in.rb +0 -330
- data/lib/svix/models/transformation_simulate_out.rb +0 -296
- data/lib/svix/models/validation_error.rb +0 -259
- data/lib/svix/statistics_api.rb +0 -17
@@ -1,223 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
#Svix API
|
3
|
-
|
4
|
-
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
5
|
-
|
6
|
-
The version of the OpenAPI document: 1.1.1
|
7
|
-
|
8
|
-
Generated by: https://openapi-generator.tech
|
9
|
-
Generator version: 7.9.0
|
10
|
-
|
11
|
-
=end
|
12
|
-
|
13
|
-
require 'date'
|
14
|
-
require 'time'
|
15
|
-
|
16
|
-
module Svix
|
17
|
-
class CustomThemeOverride
|
18
|
-
attr_accessor :border_radius
|
19
|
-
|
20
|
-
attr_accessor :font_size
|
21
|
-
|
22
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
23
|
-
def self.attribute_map
|
24
|
-
{
|
25
|
-
:'border_radius' => :'borderRadius',
|
26
|
-
:'font_size' => :'fontSize'
|
27
|
-
}
|
28
|
-
end
|
29
|
-
|
30
|
-
# Returns all the JSON keys this model knows about
|
31
|
-
def self.acceptable_attributes
|
32
|
-
attribute_map.values
|
33
|
-
end
|
34
|
-
|
35
|
-
# Attribute type mapping.
|
36
|
-
def self.openapi_types
|
37
|
-
{
|
38
|
-
:'border_radius' => :'BorderRadiusConfig',
|
39
|
-
:'font_size' => :'FontSizeConfig'
|
40
|
-
}
|
41
|
-
end
|
42
|
-
|
43
|
-
# List of attributes with nullable: true
|
44
|
-
def self.openapi_nullable
|
45
|
-
Set.new([
|
46
|
-
])
|
47
|
-
end
|
48
|
-
|
49
|
-
# Initializes the object
|
50
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
51
|
-
def initialize(attributes = {})
|
52
|
-
if (!attributes.is_a?(Hash))
|
53
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `Svix::CustomThemeOverride` initialize method"
|
54
|
-
end
|
55
|
-
|
56
|
-
# check to see if the attribute exists and convert string to symbol for hash key
|
57
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
58
|
-
if (!self.class.attribute_map.key?(k.to_sym))
|
59
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `Svix::CustomThemeOverride`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
60
|
-
end
|
61
|
-
h[k.to_sym] = v
|
62
|
-
}
|
63
|
-
|
64
|
-
if attributes.key?(:'border_radius')
|
65
|
-
self.border_radius = attributes[:'border_radius']
|
66
|
-
end
|
67
|
-
|
68
|
-
if attributes.key?(:'font_size')
|
69
|
-
self.font_size = attributes[:'font_size']
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
74
|
-
# @return Array for valid properties with the reasons
|
75
|
-
def list_invalid_properties
|
76
|
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
77
|
-
invalid_properties = Array.new
|
78
|
-
invalid_properties
|
79
|
-
end
|
80
|
-
|
81
|
-
# Check to see if the all the properties in the model are valid
|
82
|
-
# @return true if the model is valid
|
83
|
-
def valid?
|
84
|
-
warn '[DEPRECATED] the `valid?` method is obsolete'
|
85
|
-
true
|
86
|
-
end
|
87
|
-
|
88
|
-
# Checks equality by comparing each attribute.
|
89
|
-
# @param [Object] Object to be compared
|
90
|
-
def ==(o)
|
91
|
-
return true if self.equal?(o)
|
92
|
-
self.class == o.class &&
|
93
|
-
border_radius == o.border_radius &&
|
94
|
-
font_size == o.font_size
|
95
|
-
end
|
96
|
-
|
97
|
-
# @see the `==` method
|
98
|
-
# @param [Object] Object to be compared
|
99
|
-
def eql?(o)
|
100
|
-
self == o
|
101
|
-
end
|
102
|
-
|
103
|
-
# Calculates hash code according to all attributes.
|
104
|
-
# @return [Integer] Hash code
|
105
|
-
def hash
|
106
|
-
[border_radius, font_size].hash
|
107
|
-
end
|
108
|
-
|
109
|
-
# Builds the object from hash
|
110
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
111
|
-
# @return [Object] Returns the model itself
|
112
|
-
def self.build_from_hash(attributes)
|
113
|
-
return nil unless attributes.is_a?(Hash)
|
114
|
-
attributes = attributes.transform_keys(&:to_sym)
|
115
|
-
transformed_hash = {}
|
116
|
-
openapi_types.each_pair do |key, type|
|
117
|
-
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
118
|
-
transformed_hash["#{key}"] = nil
|
119
|
-
elsif type =~ /\AArray<(.*)>/i
|
120
|
-
# check to ensure the input is an array given that the attribute
|
121
|
-
# is documented as an array but the input is not
|
122
|
-
if attributes[attribute_map[key]].is_a?(Array)
|
123
|
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
124
|
-
end
|
125
|
-
elsif !attributes[attribute_map[key]].nil?
|
126
|
-
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
127
|
-
end
|
128
|
-
end
|
129
|
-
new(transformed_hash)
|
130
|
-
end
|
131
|
-
|
132
|
-
# Deserializes the data based on type
|
133
|
-
# @param string type Data type
|
134
|
-
# @param string value Value to be deserialized
|
135
|
-
# @return [Object] Deserialized data
|
136
|
-
def self._deserialize(type, value)
|
137
|
-
case type.to_sym
|
138
|
-
when :Time
|
139
|
-
Time.parse(value)
|
140
|
-
when :Date
|
141
|
-
Date.parse(value)
|
142
|
-
when :String
|
143
|
-
value.to_s
|
144
|
-
when :Integer
|
145
|
-
value.to_i
|
146
|
-
when :Float
|
147
|
-
value.to_f
|
148
|
-
when :Boolean
|
149
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
150
|
-
true
|
151
|
-
else
|
152
|
-
false
|
153
|
-
end
|
154
|
-
when :Object
|
155
|
-
# generic object (usually a Hash), return directly
|
156
|
-
value
|
157
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
158
|
-
inner_type = Regexp.last_match[:inner_type]
|
159
|
-
value.map { |v| _deserialize(inner_type, v) }
|
160
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
161
|
-
k_type = Regexp.last_match[:k_type]
|
162
|
-
v_type = Regexp.last_match[:v_type]
|
163
|
-
{}.tap do |hash|
|
164
|
-
value.each do |k, v|
|
165
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
166
|
-
end
|
167
|
-
end
|
168
|
-
else # model
|
169
|
-
# models (e.g. Pet) or oneOf
|
170
|
-
klass = Svix.const_get(type)
|
171
|
-
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
172
|
-
end
|
173
|
-
end
|
174
|
-
|
175
|
-
# Returns the string representation of the object
|
176
|
-
# @return [String] String presentation of the object
|
177
|
-
def to_s
|
178
|
-
to_hash.to_s
|
179
|
-
end
|
180
|
-
|
181
|
-
# to_body is an alias to to_hash (backward compatibility)
|
182
|
-
# @return [Hash] Returns the object in the form of hash
|
183
|
-
def to_body
|
184
|
-
to_hash
|
185
|
-
end
|
186
|
-
|
187
|
-
# Returns the object in the form of hash
|
188
|
-
# @return [Hash] Returns the object in the form of hash
|
189
|
-
def to_hash
|
190
|
-
hash = {}
|
191
|
-
self.class.attribute_map.each_pair do |attr, param|
|
192
|
-
value = self.send(attr)
|
193
|
-
if value.nil?
|
194
|
-
is_nullable = self.class.openapi_nullable.include?(attr)
|
195
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
196
|
-
end
|
197
|
-
|
198
|
-
hash[param] = _to_hash(value)
|
199
|
-
end
|
200
|
-
hash
|
201
|
-
end
|
202
|
-
|
203
|
-
# Outputs non-array value in the form of hash
|
204
|
-
# For object, use to_hash. Otherwise, just return the value
|
205
|
-
# @param [Object] value Any valid value
|
206
|
-
# @return [Hash] Returns the value in the form of hash
|
207
|
-
def _to_hash(value)
|
208
|
-
if value.is_a?(Array)
|
209
|
-
value.compact.map { |v| _to_hash(v) }
|
210
|
-
elsif value.is_a?(Hash)
|
211
|
-
{}.tap do |hash|
|
212
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
213
|
-
end
|
214
|
-
elsif value.respond_to? :to_hash
|
215
|
-
value.to_hash
|
216
|
-
else
|
217
|
-
value
|
218
|
-
end
|
219
|
-
end
|
220
|
-
|
221
|
-
end
|
222
|
-
|
223
|
-
end
|
data/lib/svix/models/data.rb
DELETED
@@ -1,108 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
#Svix API
|
3
|
-
|
4
|
-
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
5
|
-
|
6
|
-
The version of the OpenAPI document: 1.1.1
|
7
|
-
|
8
|
-
Generated by: https://openapi-generator.tech
|
9
|
-
Generator version: 7.9.0
|
10
|
-
|
11
|
-
=end
|
12
|
-
|
13
|
-
require 'date'
|
14
|
-
require 'time'
|
15
|
-
|
16
|
-
module Svix
|
17
|
-
# A copy of [`backgroundtask::Data`], but serialized with camelCase fields for customers.
|
18
|
-
module Data
|
19
|
-
class << self
|
20
|
-
# List of class defined in anyOf (OpenAPI v3)
|
21
|
-
def openapi_any_of
|
22
|
-
[
|
23
|
-
:'DataAnyOf',
|
24
|
-
:'DataAnyOf1',
|
25
|
-
:'DataAnyOf2',
|
26
|
-
:'DataAnyOf3',
|
27
|
-
:'DataAnyOf4'
|
28
|
-
]
|
29
|
-
end
|
30
|
-
|
31
|
-
# Builds the object
|
32
|
-
# @param [Mixed] Data to be matched against the list of anyOf items
|
33
|
-
# @return [Object] Returns the model or the data itself
|
34
|
-
def build(data)
|
35
|
-
# Go through the list of anyOf items and attempt to identify the appropriate one.
|
36
|
-
# Note:
|
37
|
-
# - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
|
38
|
-
# due to the way the deserialization is made in the base_object template (it just casts without verifying).
|
39
|
-
# - TODO: scalar values are de facto behaving as if they were nullable.
|
40
|
-
# - TODO: logging when debugging is set.
|
41
|
-
openapi_any_of.each do |klass|
|
42
|
-
begin
|
43
|
-
next if klass == :AnyType # "nullable: true"
|
44
|
-
typed_data = find_and_cast_into_type(klass, data)
|
45
|
-
return typed_data if typed_data
|
46
|
-
rescue # rescue all errors so we keep iterating even if the current item lookup raises
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
openapi_any_of.include?(:AnyType) ? data : nil
|
51
|
-
end
|
52
|
-
|
53
|
-
private
|
54
|
-
|
55
|
-
SchemaMismatchError = Class.new(StandardError)
|
56
|
-
|
57
|
-
# Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
|
58
|
-
def find_and_cast_into_type(klass, data)
|
59
|
-
return if data.nil?
|
60
|
-
|
61
|
-
case klass.to_s
|
62
|
-
when 'Boolean'
|
63
|
-
return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
|
64
|
-
when 'Float'
|
65
|
-
return data if data.instance_of?(Float)
|
66
|
-
when 'Integer'
|
67
|
-
return data if data.instance_of?(Integer)
|
68
|
-
when 'Time'
|
69
|
-
return Time.parse(data)
|
70
|
-
when 'Date'
|
71
|
-
return Date.parse(data)
|
72
|
-
when 'String'
|
73
|
-
return data if data.instance_of?(String)
|
74
|
-
when 'Object' # "type: object"
|
75
|
-
return data if data.instance_of?(Hash)
|
76
|
-
when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
|
77
|
-
if data.instance_of?(Array)
|
78
|
-
sub_type = Regexp.last_match[:sub_type]
|
79
|
-
return data.map { |item| find_and_cast_into_type(sub_type, item) }
|
80
|
-
end
|
81
|
-
when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
|
82
|
-
if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
|
83
|
-
sub_type = Regexp.last_match[:sub_type]
|
84
|
-
return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
|
85
|
-
end
|
86
|
-
else # model
|
87
|
-
const = Svix.const_get(klass)
|
88
|
-
if const
|
89
|
-
if const.respond_to?(:openapi_any_of) # nested anyOf model
|
90
|
-
model = const.build(data)
|
91
|
-
return model if model
|
92
|
-
else
|
93
|
-
# raise if data contains keys that are not known to the model
|
94
|
-
raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
|
95
|
-
model = const.build_from_hash(data)
|
96
|
-
return model if model
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
raise # if no match by now, raise
|
102
|
-
rescue
|
103
|
-
raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
end
|
@@ -1,240 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
#Svix API
|
3
|
-
|
4
|
-
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
5
|
-
|
6
|
-
The version of the OpenAPI document: 1.1.1
|
7
|
-
|
8
|
-
Generated by: https://openapi-generator.tech
|
9
|
-
Generator version: 7.9.0
|
10
|
-
|
11
|
-
=end
|
12
|
-
|
13
|
-
require 'date'
|
14
|
-
require 'time'
|
15
|
-
|
16
|
-
module Svix
|
17
|
-
class DataAnyOf
|
18
|
-
attr_accessor :messages_sent
|
19
|
-
|
20
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
-
def self.attribute_map
|
22
|
-
{
|
23
|
-
:'messages_sent' => :'messages_sent'
|
24
|
-
}
|
25
|
-
end
|
26
|
-
|
27
|
-
# Returns all the JSON keys this model knows about
|
28
|
-
def self.acceptable_attributes
|
29
|
-
attribute_map.values
|
30
|
-
end
|
31
|
-
|
32
|
-
# Attribute type mapping.
|
33
|
-
def self.openapi_types
|
34
|
-
{
|
35
|
-
:'messages_sent' => :'Integer'
|
36
|
-
}
|
37
|
-
end
|
38
|
-
|
39
|
-
# List of attributes with nullable: true
|
40
|
-
def self.openapi_nullable
|
41
|
-
Set.new([
|
42
|
-
])
|
43
|
-
end
|
44
|
-
|
45
|
-
# Initializes the object
|
46
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
47
|
-
def initialize(attributes = {})
|
48
|
-
if (!attributes.is_a?(Hash))
|
49
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `Svix::DataAnyOf` initialize method"
|
50
|
-
end
|
51
|
-
|
52
|
-
# check to see if the attribute exists and convert string to symbol for hash key
|
53
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
54
|
-
if (!self.class.attribute_map.key?(k.to_sym))
|
55
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `Svix::DataAnyOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
56
|
-
end
|
57
|
-
h[k.to_sym] = v
|
58
|
-
}
|
59
|
-
|
60
|
-
if attributes.key?(:'messages_sent')
|
61
|
-
self.messages_sent = attributes[:'messages_sent']
|
62
|
-
else
|
63
|
-
self.messages_sent = nil
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
68
|
-
# @return Array for valid properties with the reasons
|
69
|
-
def list_invalid_properties
|
70
|
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
71
|
-
invalid_properties = Array.new
|
72
|
-
if @messages_sent.nil?
|
73
|
-
invalid_properties.push('invalid value for "messages_sent", messages_sent cannot be nil.')
|
74
|
-
end
|
75
|
-
|
76
|
-
if @messages_sent < 0
|
77
|
-
invalid_properties.push('invalid value for "messages_sent", must be greater than or equal to 0.')
|
78
|
-
end
|
79
|
-
|
80
|
-
invalid_properties
|
81
|
-
end
|
82
|
-
|
83
|
-
# Check to see if the all the properties in the model are valid
|
84
|
-
# @return true if the model is valid
|
85
|
-
def valid?
|
86
|
-
warn '[DEPRECATED] the `valid?` method is obsolete'
|
87
|
-
return false if @messages_sent.nil?
|
88
|
-
return false if @messages_sent < 0
|
89
|
-
true
|
90
|
-
end
|
91
|
-
|
92
|
-
# Custom attribute writer method with validation
|
93
|
-
# @param [Object] messages_sent Value to be assigned
|
94
|
-
def messages_sent=(messages_sent)
|
95
|
-
if messages_sent.nil?
|
96
|
-
fail ArgumentError, 'messages_sent cannot be nil'
|
97
|
-
end
|
98
|
-
|
99
|
-
if messages_sent < 0
|
100
|
-
fail ArgumentError, 'invalid value for "messages_sent", must be greater than or equal to 0.'
|
101
|
-
end
|
102
|
-
|
103
|
-
@messages_sent = messages_sent
|
104
|
-
end
|
105
|
-
|
106
|
-
# Checks equality by comparing each attribute.
|
107
|
-
# @param [Object] Object to be compared
|
108
|
-
def ==(o)
|
109
|
-
return true if self.equal?(o)
|
110
|
-
self.class == o.class &&
|
111
|
-
messages_sent == o.messages_sent
|
112
|
-
end
|
113
|
-
|
114
|
-
# @see the `==` method
|
115
|
-
# @param [Object] Object to be compared
|
116
|
-
def eql?(o)
|
117
|
-
self == o
|
118
|
-
end
|
119
|
-
|
120
|
-
# Calculates hash code according to all attributes.
|
121
|
-
# @return [Integer] Hash code
|
122
|
-
def hash
|
123
|
-
[messages_sent].hash
|
124
|
-
end
|
125
|
-
|
126
|
-
# Builds the object from hash
|
127
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
128
|
-
# @return [Object] Returns the model itself
|
129
|
-
def self.build_from_hash(attributes)
|
130
|
-
return nil unless attributes.is_a?(Hash)
|
131
|
-
attributes = attributes.transform_keys(&:to_sym)
|
132
|
-
transformed_hash = {}
|
133
|
-
openapi_types.each_pair do |key, type|
|
134
|
-
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
135
|
-
transformed_hash["#{key}"] = nil
|
136
|
-
elsif type =~ /\AArray<(.*)>/i
|
137
|
-
# check to ensure the input is an array given that the attribute
|
138
|
-
# is documented as an array but the input is not
|
139
|
-
if attributes[attribute_map[key]].is_a?(Array)
|
140
|
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
141
|
-
end
|
142
|
-
elsif !attributes[attribute_map[key]].nil?
|
143
|
-
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
144
|
-
end
|
145
|
-
end
|
146
|
-
new(transformed_hash)
|
147
|
-
end
|
148
|
-
|
149
|
-
# Deserializes the data based on type
|
150
|
-
# @param string type Data type
|
151
|
-
# @param string value Value to be deserialized
|
152
|
-
# @return [Object] Deserialized data
|
153
|
-
def self._deserialize(type, value)
|
154
|
-
case type.to_sym
|
155
|
-
when :Time
|
156
|
-
Time.parse(value)
|
157
|
-
when :Date
|
158
|
-
Date.parse(value)
|
159
|
-
when :String
|
160
|
-
value.to_s
|
161
|
-
when :Integer
|
162
|
-
value.to_i
|
163
|
-
when :Float
|
164
|
-
value.to_f
|
165
|
-
when :Boolean
|
166
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
167
|
-
true
|
168
|
-
else
|
169
|
-
false
|
170
|
-
end
|
171
|
-
when :Object
|
172
|
-
# generic object (usually a Hash), return directly
|
173
|
-
value
|
174
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
175
|
-
inner_type = Regexp.last_match[:inner_type]
|
176
|
-
value.map { |v| _deserialize(inner_type, v) }
|
177
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
178
|
-
k_type = Regexp.last_match[:k_type]
|
179
|
-
v_type = Regexp.last_match[:v_type]
|
180
|
-
{}.tap do |hash|
|
181
|
-
value.each do |k, v|
|
182
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
183
|
-
end
|
184
|
-
end
|
185
|
-
else # model
|
186
|
-
# models (e.g. Pet) or oneOf
|
187
|
-
klass = Svix.const_get(type)
|
188
|
-
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
189
|
-
end
|
190
|
-
end
|
191
|
-
|
192
|
-
# Returns the string representation of the object
|
193
|
-
# @return [String] String presentation of the object
|
194
|
-
def to_s
|
195
|
-
to_hash.to_s
|
196
|
-
end
|
197
|
-
|
198
|
-
# to_body is an alias to to_hash (backward compatibility)
|
199
|
-
# @return [Hash] Returns the object in the form of hash
|
200
|
-
def to_body
|
201
|
-
to_hash
|
202
|
-
end
|
203
|
-
|
204
|
-
# Returns the object in the form of hash
|
205
|
-
# @return [Hash] Returns the object in the form of hash
|
206
|
-
def to_hash
|
207
|
-
hash = {}
|
208
|
-
self.class.attribute_map.each_pair do |attr, param|
|
209
|
-
value = self.send(attr)
|
210
|
-
if value.nil?
|
211
|
-
is_nullable = self.class.openapi_nullable.include?(attr)
|
212
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
213
|
-
end
|
214
|
-
|
215
|
-
hash[param] = _to_hash(value)
|
216
|
-
end
|
217
|
-
hash
|
218
|
-
end
|
219
|
-
|
220
|
-
# Outputs non-array value in the form of hash
|
221
|
-
# For object, use to_hash. Otherwise, just return the value
|
222
|
-
# @param [Object] value Any valid value
|
223
|
-
# @return [Hash] Returns the value in the form of hash
|
224
|
-
def _to_hash(value)
|
225
|
-
if value.is_a?(Array)
|
226
|
-
value.compact.map { |v| _to_hash(v) }
|
227
|
-
elsif value.is_a?(Hash)
|
228
|
-
{}.tap do |hash|
|
229
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
230
|
-
end
|
231
|
-
elsif value.respond_to? :to_hash
|
232
|
-
value.to_hash
|
233
|
-
else
|
234
|
-
value
|
235
|
-
end
|
236
|
-
end
|
237
|
-
|
238
|
-
end
|
239
|
-
|
240
|
-
end
|