svix 0.41.0 → 0.48.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +62 -8
  4. data/lib/svix/api/application_api.rb +23 -1
  5. data/lib/svix/api/authentication_api.rb +7 -1
  6. data/lib/svix/api/endpoint_api.rb +61 -18
  7. data/lib/svix/api/environment_api.rb +158 -0
  8. data/lib/svix/api/environment_settings_api.rb +82 -0
  9. data/lib/svix/api/event_type_api.rb +23 -1
  10. data/lib/svix/api/health_api.rb +6 -1
  11. data/lib/svix/api/integration_api.rb +627 -0
  12. data/lib/svix/api/message_api.rb +31 -3
  13. data/lib/svix/api/message_attempt_api.rb +359 -5
  14. data/lib/svix/api/organization_api.rb +152 -0
  15. data/lib/svix/api/organization_settings_api.rb +7 -7
  16. data/lib/svix/api/statistics_api.rb +7 -1
  17. data/lib/svix/api_client.rb +1 -1
  18. data/lib/svix/api_error.rb +1 -1
  19. data/lib/svix/configuration.rb +1 -1
  20. data/lib/svix/endpoint_api.rb +1 -1
  21. data/lib/svix/integration_api.rb +38 -0
  22. data/lib/svix/internal.rb +1 -0
  23. data/lib/svix/message_attempt_api.rb +11 -1
  24. data/lib/svix/models/application_in.rb +1 -1
  25. data/lib/svix/models/application_out.rb +1 -1
  26. data/lib/svix/models/attempt_statistics_data.rb +1 -1
  27. data/lib/svix/models/attempt_statistics_response.rb +1 -1
  28. data/lib/svix/models/border_radius_config.rb +1 -1
  29. data/lib/svix/models/border_radius_enum.rb +1 -1
  30. data/lib/svix/models/custom_theme_override.rb +1 -1
  31. data/lib/svix/models/dashboard_access_out.rb +1 -1
  32. data/lib/svix/models/endpoint_created_event.rb +1 -1
  33. data/lib/svix/models/endpoint_created_event_data.rb +1 -1
  34. data/lib/svix/models/endpoint_deleted_event.rb +1 -1
  35. data/lib/svix/models/endpoint_deleted_event_data.rb +1 -1
  36. data/lib/svix/models/endpoint_disabled_event.rb +1 -1
  37. data/lib/svix/models/endpoint_disabled_event_data.rb +1 -1
  38. data/lib/svix/models/endpoint_headers_in.rb +1 -1
  39. data/lib/svix/models/endpoint_headers_out.rb +1 -1
  40. data/lib/svix/models/endpoint_in.rb +38 -2
  41. data/lib/svix/models/endpoint_message_out.rb +38 -2
  42. data/lib/svix/models/endpoint_out.rb +38 -2
  43. data/lib/svix/models/endpoint_secret_out.rb +1 -1
  44. data/lib/svix/models/endpoint_secret_rotate_in.rb +1 -1
  45. data/lib/svix/models/endpoint_stats.rb +1 -1
  46. data/lib/svix/models/endpoint_update.rb +38 -2
  47. data/lib/svix/models/endpoint_updated_event.rb +1 -1
  48. data/lib/svix/models/endpoint_updated_event_data.rb +1 -1
  49. data/lib/svix/models/environment_in.rb +257 -0
  50. data/lib/svix/models/environment_out.rb +259 -0
  51. data/lib/svix/models/environment_settings_out.rb +308 -0
  52. data/lib/svix/models/event_example_in.rb +1 -1
  53. data/lib/svix/models/event_type_example_out.rb +1 -1
  54. data/lib/svix/models/event_type_in.rb +1 -1
  55. data/lib/svix/models/event_type_out.rb +1 -1
  56. data/lib/svix/models/event_type_schema_in.rb +1 -1
  57. data/lib/svix/models/event_type_update.rb +1 -1
  58. data/lib/svix/models/export_organization_out.rb +259 -0
  59. data/lib/svix/models/font_size_config.rb +1 -1
  60. data/lib/svix/models/http_error_out.rb +1 -1
  61. data/lib/svix/models/http_validation_error.rb +1 -1
  62. data/lib/svix/models/import_organization_in.rb +257 -0
  63. data/lib/svix/models/integration_in.rb +223 -0
  64. data/lib/svix/models/integration_key_out.rb +223 -0
  65. data/lib/svix/models/integration_out.rb +265 -0
  66. data/lib/svix/models/integration_update.rb +223 -0
  67. data/lib/svix/models/list_response_application_out.rb +1 -1
  68. data/lib/svix/models/list_response_endpoint_message_out.rb +1 -1
  69. data/lib/svix/models/list_response_endpoint_out.rb +1 -1
  70. data/lib/svix/models/list_response_event_type_out.rb +1 -1
  71. data/lib/svix/models/list_response_integration_out.rb +248 -0
  72. data/lib/svix/models/list_response_message_attempt_endpoint_out.rb +1 -1
  73. data/lib/svix/models/list_response_message_attempt_out.rb +1 -1
  74. data/lib/svix/models/list_response_message_endpoint_out.rb +1 -1
  75. data/lib/svix/models/list_response_message_out.rb +1 -1
  76. data/lib/svix/models/message_attempt_endpoint_out.rb +16 -2
  77. data/lib/svix/models/message_attempt_exhausted_event.rb +1 -1
  78. data/lib/svix/models/message_attempt_exhausted_event_data.rb +1 -1
  79. data/lib/svix/models/message_attempt_failed_event.rb +1 -1
  80. data/lib/svix/models/message_attempt_out.rb +1 -1
  81. data/lib/svix/models/message_attempt_trigger_type.rb +1 -1
  82. data/lib/svix/models/message_endpoint_out.rb +38 -2
  83. data/lib/svix/models/message_in.rb +38 -2
  84. data/lib/svix/models/message_out.rb +38 -2
  85. data/lib/svix/models/message_status.rb +1 -1
  86. data/lib/svix/models/portal_settings_out.rb +16 -5
  87. data/lib/svix/models/recover_in.rb +1 -1
  88. data/lib/svix/models/settings_in.rb +339 -0
  89. data/lib/svix/models/settings_out.rb +339 -0
  90. data/lib/svix/models/statistics_period.rb +1 -1
  91. data/lib/svix/models/validation_error.rb +1 -1
  92. data/lib/svix/models/webhook_types.rb +1 -1
  93. data/lib/svix/svix.rb +2 -0
  94. data/lib/svix/version.rb +1 -1
  95. data/lib/svix.rb +8 -2
  96. metadata +23 -6
@@ -0,0 +1,339 @@
1
+ =begin
2
+ #Svix API
3
+
4
+ #Welcome to the Svix API documentation! Useful links: [Homepage](https://www.svix.com) | [Support email](mailto:support+docs@svix.com) | [Blog](https://www.svix.com/blog/) | [Slack Community](https://www.svix.com/slack/) # Introduction This is the reference documentation and schemas for the [Svix webhook service](https://www.svix.com) API. For tutorials and other documentation please refer to [the documentation](https://docs.svix.com). ## Main concepts In Svix you have four important entities you will be interacting with: - `messages`: these are the webhooks being sent. They can have contents and a few other properties. - `application`: this is where `messages` are sent to. Usually you want to create one application for each user on your platform. - `endpoint`: endpoints are the URLs messages will be sent to. Each application can have multiple `endpoints` and each message sent to that application will be sent to all of them (unless they are not subscribed to the sent event type). - `event-type`: event types are identifiers denoting the type of the message being sent. Event types are primarily used to decide which events are sent to which endpoint. ## Authentication Get your authentication token (`AUTH_TOKEN`) from the [Svix dashboard](https://dashboard.svix.com) and use it as part of the `Authorization` header as such: `Authorization: Bearer ${AUTH_TOKEN}`. <SecurityDefinitions /> ## Code samples The code samples assume you already have the respective libraries installed and you know how to use them. For the latest information on how to do that, please refer to [the documentation](https://docs.svix.com/). ## Idempotency Svix supports [idempotency](https://en.wikipedia.org/wiki/Idempotence) for safely retrying requests without accidentally performing the same operation twice. This is useful when an API call is disrupted in transit and you do not receive a response. To perform an idempotent request, pass the idempotency key in the `Idempotency-Key` header to the request. The idempotency key should be a unique value generated by the client. You can create the key in however way you like, though we suggest using UUID v4, or any other string with enough entropy to avoid collisions. Svix's idempotency works by saving the resulting status code and body of the first request made for any given idempotency key for any successful request. Subsequent requests with the same key return the same result. Please note that idempotency is only supported for `POST` requests. ## Cross-Origin Resource Sharing This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). And that allows cross-domain communication from the browser. All responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site.
5
+
6
+ The version of the OpenAPI document: 1.4
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.2.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Svix
17
+ class SettingsIn
18
+ attr_accessor :custom_base_font_size
19
+
20
+ attr_accessor :custom_color
21
+
22
+ attr_accessor :custom_font_family
23
+
24
+ attr_accessor :custom_logo_url
25
+
26
+ attr_accessor :custom_theme_override
27
+
28
+ attr_accessor :disable_endpoint_on_failure
29
+
30
+ attr_accessor :enable_channels
31
+
32
+ attr_accessor :enable_integration_management
33
+
34
+ attr_accessor :enforce_https
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'custom_base_font_size' => :'customBaseFontSize',
40
+ :'custom_color' => :'customColor',
41
+ :'custom_font_family' => :'customFontFamily',
42
+ :'custom_logo_url' => :'customLogoUrl',
43
+ :'custom_theme_override' => :'customThemeOverride',
44
+ :'disable_endpoint_on_failure' => :'disableEndpointOnFailure',
45
+ :'enable_channels' => :'enableChannels',
46
+ :'enable_integration_management' => :'enableIntegrationManagement',
47
+ :'enforce_https' => :'enforceHttps'
48
+ }
49
+ end
50
+
51
+ # Returns all the JSON keys this model knows about
52
+ def self.acceptable_attributes
53
+ attribute_map.values
54
+ end
55
+
56
+ # Attribute type mapping.
57
+ def self.openapi_types
58
+ {
59
+ :'custom_base_font_size' => :'Integer',
60
+ :'custom_color' => :'String',
61
+ :'custom_font_family' => :'String',
62
+ :'custom_logo_url' => :'String',
63
+ :'custom_theme_override' => :'CustomThemeOverride',
64
+ :'disable_endpoint_on_failure' => :'Boolean',
65
+ :'enable_channels' => :'Boolean',
66
+ :'enable_integration_management' => :'Boolean',
67
+ :'enforce_https' => :'Boolean'
68
+ }
69
+ end
70
+
71
+ # List of attributes with nullable: true
72
+ def self.openapi_nullable
73
+ Set.new([
74
+ ])
75
+ end
76
+
77
+ # Initializes the object
78
+ # @param [Hash] attributes Model attributes in the form of hash
79
+ def initialize(attributes = {})
80
+ if (!attributes.is_a?(Hash))
81
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Svix::SettingsIn` initialize method"
82
+ end
83
+
84
+ # check to see if the attribute exists and convert string to symbol for hash key
85
+ attributes = attributes.each_with_object({}) { |(k, v), h|
86
+ if (!self.class.attribute_map.key?(k.to_sym))
87
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Svix::SettingsIn`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
88
+ end
89
+ h[k.to_sym] = v
90
+ }
91
+
92
+ if attributes.key?(:'custom_base_font_size')
93
+ self.custom_base_font_size = attributes[:'custom_base_font_size']
94
+ end
95
+
96
+ if attributes.key?(:'custom_color')
97
+ self.custom_color = attributes[:'custom_color']
98
+ end
99
+
100
+ if attributes.key?(:'custom_font_family')
101
+ self.custom_font_family = attributes[:'custom_font_family']
102
+ end
103
+
104
+ if attributes.key?(:'custom_logo_url')
105
+ self.custom_logo_url = attributes[:'custom_logo_url']
106
+ end
107
+
108
+ if attributes.key?(:'custom_theme_override')
109
+ self.custom_theme_override = attributes[:'custom_theme_override']
110
+ end
111
+
112
+ if attributes.key?(:'disable_endpoint_on_failure')
113
+ self.disable_endpoint_on_failure = attributes[:'disable_endpoint_on_failure']
114
+ else
115
+ self.disable_endpoint_on_failure = true
116
+ end
117
+
118
+ if attributes.key?(:'enable_channels')
119
+ self.enable_channels = attributes[:'enable_channels']
120
+ else
121
+ self.enable_channels = false
122
+ end
123
+
124
+ if attributes.key?(:'enable_integration_management')
125
+ self.enable_integration_management = attributes[:'enable_integration_management']
126
+ else
127
+ self.enable_integration_management = false
128
+ end
129
+
130
+ if attributes.key?(:'enforce_https')
131
+ self.enforce_https = attributes[:'enforce_https']
132
+ else
133
+ self.enforce_https = true
134
+ end
135
+ end
136
+
137
+ # Show invalid properties with the reasons. Usually used together with valid?
138
+ # @return Array for valid properties with the reasons
139
+ def list_invalid_properties
140
+ invalid_properties = Array.new
141
+ pattern = Regexp.new(/^[a-zA-Z0-9\-_ ]+$/)
142
+ if !@custom_font_family.nil? && @custom_font_family !~ pattern
143
+ invalid_properties.push("invalid value for \"custom_font_family\", must conform to the pattern #{pattern}.")
144
+ end
145
+
146
+ if !@custom_logo_url.nil? && @custom_logo_url.to_s.length > 65536
147
+ invalid_properties.push('invalid value for "custom_logo_url", the character length must be smaller than or equal to 65536.')
148
+ end
149
+
150
+ if !@custom_logo_url.nil? && @custom_logo_url.to_s.length < 1
151
+ invalid_properties.push('invalid value for "custom_logo_url", the character length must be great than or equal to 1.')
152
+ end
153
+
154
+ invalid_properties
155
+ end
156
+
157
+ # Check to see if the all the properties in the model are valid
158
+ # @return true if the model is valid
159
+ def valid?
160
+ return false if !@custom_font_family.nil? && @custom_font_family !~ Regexp.new(/^[a-zA-Z0-9\-_ ]+$/)
161
+ return false if !@custom_logo_url.nil? && @custom_logo_url.to_s.length > 65536
162
+ return false if !@custom_logo_url.nil? && @custom_logo_url.to_s.length < 1
163
+ true
164
+ end
165
+
166
+ # Custom attribute writer method with validation
167
+ # @param [Object] custom_font_family Value to be assigned
168
+ def custom_font_family=(custom_font_family)
169
+ pattern = Regexp.new(/^[a-zA-Z0-9\-_ ]+$/)
170
+ if !custom_font_family.nil? && custom_font_family !~ pattern
171
+ fail ArgumentError, "invalid value for \"custom_font_family\", must conform to the pattern #{pattern}."
172
+ end
173
+
174
+ @custom_font_family = custom_font_family
175
+ end
176
+
177
+ # Custom attribute writer method with validation
178
+ # @param [Object] custom_logo_url Value to be assigned
179
+ def custom_logo_url=(custom_logo_url)
180
+ if !custom_logo_url.nil? && custom_logo_url.to_s.length > 65536
181
+ fail ArgumentError, 'invalid value for "custom_logo_url", the character length must be smaller than or equal to 65536.'
182
+ end
183
+
184
+ if !custom_logo_url.nil? && custom_logo_url.to_s.length < 1
185
+ fail ArgumentError, 'invalid value for "custom_logo_url", the character length must be great than or equal to 1.'
186
+ end
187
+
188
+ @custom_logo_url = custom_logo_url
189
+ end
190
+
191
+ # Checks equality by comparing each attribute.
192
+ # @param [Object] Object to be compared
193
+ def ==(o)
194
+ return true if self.equal?(o)
195
+ self.class == o.class &&
196
+ custom_base_font_size == o.custom_base_font_size &&
197
+ custom_color == o.custom_color &&
198
+ custom_font_family == o.custom_font_family &&
199
+ custom_logo_url == o.custom_logo_url &&
200
+ custom_theme_override == o.custom_theme_override &&
201
+ disable_endpoint_on_failure == o.disable_endpoint_on_failure &&
202
+ enable_channels == o.enable_channels &&
203
+ enable_integration_management == o.enable_integration_management &&
204
+ enforce_https == o.enforce_https
205
+ end
206
+
207
+ # @see the `==` method
208
+ # @param [Object] Object to be compared
209
+ def eql?(o)
210
+ self == o
211
+ end
212
+
213
+ # Calculates hash code according to all attributes.
214
+ # @return [Integer] Hash code
215
+ def hash
216
+ [custom_base_font_size, custom_color, custom_font_family, custom_logo_url, custom_theme_override, disable_endpoint_on_failure, enable_channels, enable_integration_management, enforce_https].hash
217
+ end
218
+
219
+ # Builds the object from hash
220
+ # @param [Hash] attributes Model attributes in the form of hash
221
+ # @return [Object] Returns the model itself
222
+ def self.build_from_hash(attributes)
223
+ new.build_from_hash(attributes)
224
+ end
225
+
226
+ # Builds the object from hash
227
+ # @param [Hash] attributes Model attributes in the form of hash
228
+ # @return [Object] Returns the model itself
229
+ def build_from_hash(attributes)
230
+ return nil unless attributes.is_a?(Hash)
231
+ self.class.openapi_types.each_pair do |key, type|
232
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
233
+ self.send("#{key}=", nil)
234
+ elsif type =~ /\AArray<(.*)>/i
235
+ # check to ensure the input is an array given that the attribute
236
+ # is documented as an array but the input is not
237
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
238
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
239
+ end
240
+ elsif !attributes[self.class.attribute_map[key]].nil?
241
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
242
+ end
243
+ end
244
+
245
+ self
246
+ end
247
+
248
+ # Deserializes the data based on type
249
+ # @param string type Data type
250
+ # @param string value Value to be deserialized
251
+ # @return [Object] Deserialized data
252
+ def _deserialize(type, value)
253
+ case type.to_sym
254
+ when :Time
255
+ Time.parse(value)
256
+ when :Date
257
+ Date.parse(value)
258
+ when :String
259
+ value.to_s
260
+ when :Integer
261
+ value.to_i
262
+ when :Float
263
+ value.to_f
264
+ when :Boolean
265
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
266
+ true
267
+ else
268
+ false
269
+ end
270
+ when :Object
271
+ # generic object (usually a Hash), return directly
272
+ value
273
+ when /\AArray<(?<inner_type>.+)>\z/
274
+ inner_type = Regexp.last_match[:inner_type]
275
+ value.map { |v| _deserialize(inner_type, v) }
276
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
277
+ k_type = Regexp.last_match[:k_type]
278
+ v_type = Regexp.last_match[:v_type]
279
+ {}.tap do |hash|
280
+ value.each do |k, v|
281
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
282
+ end
283
+ end
284
+ else # model
285
+ # models (e.g. Pet) or oneOf
286
+ klass = Svix.const_get(type)
287
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
288
+ end
289
+ end
290
+
291
+ # Returns the string representation of the object
292
+ # @return [String] String presentation of the object
293
+ def to_s
294
+ to_hash.to_s
295
+ end
296
+
297
+ # to_body is an alias to to_hash (backward compatibility)
298
+ # @return [Hash] Returns the object in the form of hash
299
+ def to_body
300
+ to_hash
301
+ end
302
+
303
+ # Returns the object in the form of hash
304
+ # @return [Hash] Returns the object in the form of hash
305
+ def to_hash
306
+ hash = {}
307
+ self.class.attribute_map.each_pair do |attr, param|
308
+ value = self.send(attr)
309
+ if value.nil?
310
+ is_nullable = self.class.openapi_nullable.include?(attr)
311
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
312
+ end
313
+
314
+ hash[param] = _to_hash(value)
315
+ end
316
+ hash
317
+ end
318
+
319
+ # Outputs non-array value in the form of hash
320
+ # For object, use to_hash. Otherwise, just return the value
321
+ # @param [Object] value Any valid value
322
+ # @return [Hash] Returns the value in the form of hash
323
+ def _to_hash(value)
324
+ if value.is_a?(Array)
325
+ value.compact.map { |v| _to_hash(v) }
326
+ elsif value.is_a?(Hash)
327
+ {}.tap do |hash|
328
+ value.each { |k, v| hash[k] = _to_hash(v) }
329
+ end
330
+ elsif value.respond_to? :to_hash
331
+ value.to_hash
332
+ else
333
+ value
334
+ end
335
+ end
336
+
337
+ end
338
+
339
+ end
@@ -0,0 +1,339 @@
1
+ =begin
2
+ #Svix API
3
+
4
+ #Welcome to the Svix API documentation! Useful links: [Homepage](https://www.svix.com) | [Support email](mailto:support+docs@svix.com) | [Blog](https://www.svix.com/blog/) | [Slack Community](https://www.svix.com/slack/) # Introduction This is the reference documentation and schemas for the [Svix webhook service](https://www.svix.com) API. For tutorials and other documentation please refer to [the documentation](https://docs.svix.com). ## Main concepts In Svix you have four important entities you will be interacting with: - `messages`: these are the webhooks being sent. They can have contents and a few other properties. - `application`: this is where `messages` are sent to. Usually you want to create one application for each user on your platform. - `endpoint`: endpoints are the URLs messages will be sent to. Each application can have multiple `endpoints` and each message sent to that application will be sent to all of them (unless they are not subscribed to the sent event type). - `event-type`: event types are identifiers denoting the type of the message being sent. Event types are primarily used to decide which events are sent to which endpoint. ## Authentication Get your authentication token (`AUTH_TOKEN`) from the [Svix dashboard](https://dashboard.svix.com) and use it as part of the `Authorization` header as such: `Authorization: Bearer ${AUTH_TOKEN}`. <SecurityDefinitions /> ## Code samples The code samples assume you already have the respective libraries installed and you know how to use them. For the latest information on how to do that, please refer to [the documentation](https://docs.svix.com/). ## Idempotency Svix supports [idempotency](https://en.wikipedia.org/wiki/Idempotence) for safely retrying requests without accidentally performing the same operation twice. This is useful when an API call is disrupted in transit and you do not receive a response. To perform an idempotent request, pass the idempotency key in the `Idempotency-Key` header to the request. The idempotency key should be a unique value generated by the client. You can create the key in however way you like, though we suggest using UUID v4, or any other string with enough entropy to avoid collisions. Svix's idempotency works by saving the resulting status code and body of the first request made for any given idempotency key for any successful request. Subsequent requests with the same key return the same result. Please note that idempotency is only supported for `POST` requests. ## Cross-Origin Resource Sharing This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). And that allows cross-domain communication from the browser. All responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site.
5
+
6
+ The version of the OpenAPI document: 1.4
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.2.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Svix
17
+ class SettingsOut
18
+ attr_accessor :custom_base_font_size
19
+
20
+ attr_accessor :custom_color
21
+
22
+ attr_accessor :custom_font_family
23
+
24
+ attr_accessor :custom_logo_url
25
+
26
+ attr_accessor :custom_theme_override
27
+
28
+ attr_accessor :disable_endpoint_on_failure
29
+
30
+ attr_accessor :enable_channels
31
+
32
+ attr_accessor :enable_integration_management
33
+
34
+ attr_accessor :enforce_https
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'custom_base_font_size' => :'customBaseFontSize',
40
+ :'custom_color' => :'customColor',
41
+ :'custom_font_family' => :'customFontFamily',
42
+ :'custom_logo_url' => :'customLogoUrl',
43
+ :'custom_theme_override' => :'customThemeOverride',
44
+ :'disable_endpoint_on_failure' => :'disableEndpointOnFailure',
45
+ :'enable_channels' => :'enableChannels',
46
+ :'enable_integration_management' => :'enableIntegrationManagement',
47
+ :'enforce_https' => :'enforceHttps'
48
+ }
49
+ end
50
+
51
+ # Returns all the JSON keys this model knows about
52
+ def self.acceptable_attributes
53
+ attribute_map.values
54
+ end
55
+
56
+ # Attribute type mapping.
57
+ def self.openapi_types
58
+ {
59
+ :'custom_base_font_size' => :'Integer',
60
+ :'custom_color' => :'String',
61
+ :'custom_font_family' => :'String',
62
+ :'custom_logo_url' => :'String',
63
+ :'custom_theme_override' => :'CustomThemeOverride',
64
+ :'disable_endpoint_on_failure' => :'Boolean',
65
+ :'enable_channels' => :'Boolean',
66
+ :'enable_integration_management' => :'Boolean',
67
+ :'enforce_https' => :'Boolean'
68
+ }
69
+ end
70
+
71
+ # List of attributes with nullable: true
72
+ def self.openapi_nullable
73
+ Set.new([
74
+ ])
75
+ end
76
+
77
+ # Initializes the object
78
+ # @param [Hash] attributes Model attributes in the form of hash
79
+ def initialize(attributes = {})
80
+ if (!attributes.is_a?(Hash))
81
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Svix::SettingsOut` initialize method"
82
+ end
83
+
84
+ # check to see if the attribute exists and convert string to symbol for hash key
85
+ attributes = attributes.each_with_object({}) { |(k, v), h|
86
+ if (!self.class.attribute_map.key?(k.to_sym))
87
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Svix::SettingsOut`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
88
+ end
89
+ h[k.to_sym] = v
90
+ }
91
+
92
+ if attributes.key?(:'custom_base_font_size')
93
+ self.custom_base_font_size = attributes[:'custom_base_font_size']
94
+ end
95
+
96
+ if attributes.key?(:'custom_color')
97
+ self.custom_color = attributes[:'custom_color']
98
+ end
99
+
100
+ if attributes.key?(:'custom_font_family')
101
+ self.custom_font_family = attributes[:'custom_font_family']
102
+ end
103
+
104
+ if attributes.key?(:'custom_logo_url')
105
+ self.custom_logo_url = attributes[:'custom_logo_url']
106
+ end
107
+
108
+ if attributes.key?(:'custom_theme_override')
109
+ self.custom_theme_override = attributes[:'custom_theme_override']
110
+ end
111
+
112
+ if attributes.key?(:'disable_endpoint_on_failure')
113
+ self.disable_endpoint_on_failure = attributes[:'disable_endpoint_on_failure']
114
+ else
115
+ self.disable_endpoint_on_failure = true
116
+ end
117
+
118
+ if attributes.key?(:'enable_channels')
119
+ self.enable_channels = attributes[:'enable_channels']
120
+ else
121
+ self.enable_channels = false
122
+ end
123
+
124
+ if attributes.key?(:'enable_integration_management')
125
+ self.enable_integration_management = attributes[:'enable_integration_management']
126
+ else
127
+ self.enable_integration_management = false
128
+ end
129
+
130
+ if attributes.key?(:'enforce_https')
131
+ self.enforce_https = attributes[:'enforce_https']
132
+ else
133
+ self.enforce_https = true
134
+ end
135
+ end
136
+
137
+ # Show invalid properties with the reasons. Usually used together with valid?
138
+ # @return Array for valid properties with the reasons
139
+ def list_invalid_properties
140
+ invalid_properties = Array.new
141
+ pattern = Regexp.new(/^[a-zA-Z0-9\-_ ]+$/)
142
+ if !@custom_font_family.nil? && @custom_font_family !~ pattern
143
+ invalid_properties.push("invalid value for \"custom_font_family\", must conform to the pattern #{pattern}.")
144
+ end
145
+
146
+ if !@custom_logo_url.nil? && @custom_logo_url.to_s.length > 65536
147
+ invalid_properties.push('invalid value for "custom_logo_url", the character length must be smaller than or equal to 65536.')
148
+ end
149
+
150
+ if !@custom_logo_url.nil? && @custom_logo_url.to_s.length < 1
151
+ invalid_properties.push('invalid value for "custom_logo_url", the character length must be great than or equal to 1.')
152
+ end
153
+
154
+ invalid_properties
155
+ end
156
+
157
+ # Check to see if the all the properties in the model are valid
158
+ # @return true if the model is valid
159
+ def valid?
160
+ return false if !@custom_font_family.nil? && @custom_font_family !~ Regexp.new(/^[a-zA-Z0-9\-_ ]+$/)
161
+ return false if !@custom_logo_url.nil? && @custom_logo_url.to_s.length > 65536
162
+ return false if !@custom_logo_url.nil? && @custom_logo_url.to_s.length < 1
163
+ true
164
+ end
165
+
166
+ # Custom attribute writer method with validation
167
+ # @param [Object] custom_font_family Value to be assigned
168
+ def custom_font_family=(custom_font_family)
169
+ pattern = Regexp.new(/^[a-zA-Z0-9\-_ ]+$/)
170
+ if !custom_font_family.nil? && custom_font_family !~ pattern
171
+ fail ArgumentError, "invalid value for \"custom_font_family\", must conform to the pattern #{pattern}."
172
+ end
173
+
174
+ @custom_font_family = custom_font_family
175
+ end
176
+
177
+ # Custom attribute writer method with validation
178
+ # @param [Object] custom_logo_url Value to be assigned
179
+ def custom_logo_url=(custom_logo_url)
180
+ if !custom_logo_url.nil? && custom_logo_url.to_s.length > 65536
181
+ fail ArgumentError, 'invalid value for "custom_logo_url", the character length must be smaller than or equal to 65536.'
182
+ end
183
+
184
+ if !custom_logo_url.nil? && custom_logo_url.to_s.length < 1
185
+ fail ArgumentError, 'invalid value for "custom_logo_url", the character length must be great than or equal to 1.'
186
+ end
187
+
188
+ @custom_logo_url = custom_logo_url
189
+ end
190
+
191
+ # Checks equality by comparing each attribute.
192
+ # @param [Object] Object to be compared
193
+ def ==(o)
194
+ return true if self.equal?(o)
195
+ self.class == o.class &&
196
+ custom_base_font_size == o.custom_base_font_size &&
197
+ custom_color == o.custom_color &&
198
+ custom_font_family == o.custom_font_family &&
199
+ custom_logo_url == o.custom_logo_url &&
200
+ custom_theme_override == o.custom_theme_override &&
201
+ disable_endpoint_on_failure == o.disable_endpoint_on_failure &&
202
+ enable_channels == o.enable_channels &&
203
+ enable_integration_management == o.enable_integration_management &&
204
+ enforce_https == o.enforce_https
205
+ end
206
+
207
+ # @see the `==` method
208
+ # @param [Object] Object to be compared
209
+ def eql?(o)
210
+ self == o
211
+ end
212
+
213
+ # Calculates hash code according to all attributes.
214
+ # @return [Integer] Hash code
215
+ def hash
216
+ [custom_base_font_size, custom_color, custom_font_family, custom_logo_url, custom_theme_override, disable_endpoint_on_failure, enable_channels, enable_integration_management, enforce_https].hash
217
+ end
218
+
219
+ # Builds the object from hash
220
+ # @param [Hash] attributes Model attributes in the form of hash
221
+ # @return [Object] Returns the model itself
222
+ def self.build_from_hash(attributes)
223
+ new.build_from_hash(attributes)
224
+ end
225
+
226
+ # Builds the object from hash
227
+ # @param [Hash] attributes Model attributes in the form of hash
228
+ # @return [Object] Returns the model itself
229
+ def build_from_hash(attributes)
230
+ return nil unless attributes.is_a?(Hash)
231
+ self.class.openapi_types.each_pair do |key, type|
232
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
233
+ self.send("#{key}=", nil)
234
+ elsif type =~ /\AArray<(.*)>/i
235
+ # check to ensure the input is an array given that the attribute
236
+ # is documented as an array but the input is not
237
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
238
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
239
+ end
240
+ elsif !attributes[self.class.attribute_map[key]].nil?
241
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
242
+ end
243
+ end
244
+
245
+ self
246
+ end
247
+
248
+ # Deserializes the data based on type
249
+ # @param string type Data type
250
+ # @param string value Value to be deserialized
251
+ # @return [Object] Deserialized data
252
+ def _deserialize(type, value)
253
+ case type.to_sym
254
+ when :Time
255
+ Time.parse(value)
256
+ when :Date
257
+ Date.parse(value)
258
+ when :String
259
+ value.to_s
260
+ when :Integer
261
+ value.to_i
262
+ when :Float
263
+ value.to_f
264
+ when :Boolean
265
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
266
+ true
267
+ else
268
+ false
269
+ end
270
+ when :Object
271
+ # generic object (usually a Hash), return directly
272
+ value
273
+ when /\AArray<(?<inner_type>.+)>\z/
274
+ inner_type = Regexp.last_match[:inner_type]
275
+ value.map { |v| _deserialize(inner_type, v) }
276
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
277
+ k_type = Regexp.last_match[:k_type]
278
+ v_type = Regexp.last_match[:v_type]
279
+ {}.tap do |hash|
280
+ value.each do |k, v|
281
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
282
+ end
283
+ end
284
+ else # model
285
+ # models (e.g. Pet) or oneOf
286
+ klass = Svix.const_get(type)
287
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
288
+ end
289
+ end
290
+
291
+ # Returns the string representation of the object
292
+ # @return [String] String presentation of the object
293
+ def to_s
294
+ to_hash.to_s
295
+ end
296
+
297
+ # to_body is an alias to to_hash (backward compatibility)
298
+ # @return [Hash] Returns the object in the form of hash
299
+ def to_body
300
+ to_hash
301
+ end
302
+
303
+ # Returns the object in the form of hash
304
+ # @return [Hash] Returns the object in the form of hash
305
+ def to_hash
306
+ hash = {}
307
+ self.class.attribute_map.each_pair do |attr, param|
308
+ value = self.send(attr)
309
+ if value.nil?
310
+ is_nullable = self.class.openapi_nullable.include?(attr)
311
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
312
+ end
313
+
314
+ hash[param] = _to_hash(value)
315
+ end
316
+ hash
317
+ end
318
+
319
+ # Outputs non-array value in the form of hash
320
+ # For object, use to_hash. Otherwise, just return the value
321
+ # @param [Object] value Any valid value
322
+ # @return [Hash] Returns the value in the form of hash
323
+ def _to_hash(value)
324
+ if value.is_a?(Array)
325
+ value.compact.map { |v| _to_hash(v) }
326
+ elsif value.is_a?(Hash)
327
+ {}.tap do |hash|
328
+ value.each { |k, v| hash[k] = _to_hash(v) }
329
+ end
330
+ elsif value.respond_to? :to_hash
331
+ value.to_hash
332
+ else
333
+ value
334
+ end
335
+ end
336
+
337
+ end
338
+
339
+ end