svix 0.37.0 → 0.38.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,286 @@
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 of your users. - `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/). ## 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 PortalSettingsOut
18
+ attr_accessor :custom_color
19
+
20
+ attr_accessor :custom_font_family
21
+
22
+ attr_accessor :custom_logo_url
23
+
24
+ attr_accessor :custom_theme_override
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'custom_color' => :'customColor',
30
+ :'custom_font_family' => :'customFontFamily',
31
+ :'custom_logo_url' => :'customLogoUrl',
32
+ :'custom_theme_override' => :'customThemeOverride'
33
+ }
34
+ end
35
+
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ attribute_map.values
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'custom_color' => :'String',
45
+ :'custom_font_family' => :'String',
46
+ :'custom_logo_url' => :'String',
47
+ :'custom_theme_override' => :'CustomThemeOverride'
48
+ }
49
+ end
50
+
51
+ # List of attributes with nullable: true
52
+ def self.openapi_nullable
53
+ Set.new([
54
+ ])
55
+ end
56
+
57
+ # Initializes the object
58
+ # @param [Hash] attributes Model attributes in the form of hash
59
+ def initialize(attributes = {})
60
+ if (!attributes.is_a?(Hash))
61
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Svix::PortalSettingsOut` initialize method"
62
+ end
63
+
64
+ # check to see if the attribute exists and convert string to symbol for hash key
65
+ attributes = attributes.each_with_object({}) { |(k, v), h|
66
+ if (!self.class.attribute_map.key?(k.to_sym))
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Svix::PortalSettingsOut`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
68
+ end
69
+ h[k.to_sym] = v
70
+ }
71
+
72
+ if attributes.key?(:'custom_color')
73
+ self.custom_color = attributes[:'custom_color']
74
+ end
75
+
76
+ if attributes.key?(:'custom_font_family')
77
+ self.custom_font_family = attributes[:'custom_font_family']
78
+ end
79
+
80
+ if attributes.key?(:'custom_logo_url')
81
+ self.custom_logo_url = attributes[:'custom_logo_url']
82
+ end
83
+
84
+ if attributes.key?(:'custom_theme_override')
85
+ self.custom_theme_override = attributes[:'custom_theme_override']
86
+ end
87
+ end
88
+
89
+ # Show invalid properties with the reasons. Usually used together with valid?
90
+ # @return Array for valid properties with the reasons
91
+ def list_invalid_properties
92
+ invalid_properties = Array.new
93
+ pattern = Regexp.new(/^[a-zA-Z0-9\-_ ]+$/)
94
+ if !@custom_font_family.nil? && @custom_font_family !~ pattern
95
+ invalid_properties.push("invalid value for \"custom_font_family\", must conform to the pattern #{pattern}.")
96
+ end
97
+
98
+ if !@custom_logo_url.nil? && @custom_logo_url.to_s.length > 65536
99
+ invalid_properties.push('invalid value for "custom_logo_url", the character length must be smaller than or equal to 65536.')
100
+ end
101
+
102
+ if !@custom_logo_url.nil? && @custom_logo_url.to_s.length < 1
103
+ invalid_properties.push('invalid value for "custom_logo_url", the character length must be great than or equal to 1.')
104
+ end
105
+
106
+ invalid_properties
107
+ end
108
+
109
+ # Check to see if the all the properties in the model are valid
110
+ # @return true if the model is valid
111
+ def valid?
112
+ return false if !@custom_font_family.nil? && @custom_font_family !~ Regexp.new(/^[a-zA-Z0-9\-_ ]+$/)
113
+ return false if !@custom_logo_url.nil? && @custom_logo_url.to_s.length > 65536
114
+ return false if !@custom_logo_url.nil? && @custom_logo_url.to_s.length < 1
115
+ true
116
+ end
117
+
118
+ # Custom attribute writer method with validation
119
+ # @param [Object] custom_font_family Value to be assigned
120
+ def custom_font_family=(custom_font_family)
121
+ pattern = Regexp.new(/^[a-zA-Z0-9\-_ ]+$/)
122
+ if !custom_font_family.nil? && custom_font_family !~ pattern
123
+ fail ArgumentError, "invalid value for \"custom_font_family\", must conform to the pattern #{pattern}."
124
+ end
125
+
126
+ @custom_font_family = custom_font_family
127
+ end
128
+
129
+ # Custom attribute writer method with validation
130
+ # @param [Object] custom_logo_url Value to be assigned
131
+ def custom_logo_url=(custom_logo_url)
132
+ if !custom_logo_url.nil? && custom_logo_url.to_s.length > 65536
133
+ fail ArgumentError, 'invalid value for "custom_logo_url", the character length must be smaller than or equal to 65536.'
134
+ end
135
+
136
+ if !custom_logo_url.nil? && custom_logo_url.to_s.length < 1
137
+ fail ArgumentError, 'invalid value for "custom_logo_url", the character length must be great than or equal to 1.'
138
+ end
139
+
140
+ @custom_logo_url = custom_logo_url
141
+ end
142
+
143
+ # Checks equality by comparing each attribute.
144
+ # @param [Object] Object to be compared
145
+ def ==(o)
146
+ return true if self.equal?(o)
147
+ self.class == o.class &&
148
+ custom_color == o.custom_color &&
149
+ custom_font_family == o.custom_font_family &&
150
+ custom_logo_url == o.custom_logo_url &&
151
+ custom_theme_override == o.custom_theme_override
152
+ end
153
+
154
+ # @see the `==` method
155
+ # @param [Object] Object to be compared
156
+ def eql?(o)
157
+ self == o
158
+ end
159
+
160
+ # Calculates hash code according to all attributes.
161
+ # @return [Integer] Hash code
162
+ def hash
163
+ [custom_color, custom_font_family, custom_logo_url, custom_theme_override].hash
164
+ end
165
+
166
+ # Builds the object from hash
167
+ # @param [Hash] attributes Model attributes in the form of hash
168
+ # @return [Object] Returns the model itself
169
+ def self.build_from_hash(attributes)
170
+ new.build_from_hash(attributes)
171
+ end
172
+
173
+ # Builds the object from hash
174
+ # @param [Hash] attributes Model attributes in the form of hash
175
+ # @return [Object] Returns the model itself
176
+ def build_from_hash(attributes)
177
+ return nil unless attributes.is_a?(Hash)
178
+ self.class.openapi_types.each_pair do |key, type|
179
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
180
+ self.send("#{key}=", nil)
181
+ elsif type =~ /\AArray<(.*)>/i
182
+ # check to ensure the input is an array given that the attribute
183
+ # is documented as an array but the input is not
184
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
185
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
186
+ end
187
+ elsif !attributes[self.class.attribute_map[key]].nil?
188
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
189
+ end
190
+ end
191
+
192
+ self
193
+ end
194
+
195
+ # Deserializes the data based on type
196
+ # @param string type Data type
197
+ # @param string value Value to be deserialized
198
+ # @return [Object] Deserialized data
199
+ def _deserialize(type, value)
200
+ case type.to_sym
201
+ when :Time
202
+ Time.parse(value)
203
+ when :Date
204
+ Date.parse(value)
205
+ when :String
206
+ value.to_s
207
+ when :Integer
208
+ value.to_i
209
+ when :Float
210
+ value.to_f
211
+ when :Boolean
212
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
213
+ true
214
+ else
215
+ false
216
+ end
217
+ when :Object
218
+ # generic object (usually a Hash), return directly
219
+ value
220
+ when /\AArray<(?<inner_type>.+)>\z/
221
+ inner_type = Regexp.last_match[:inner_type]
222
+ value.map { |v| _deserialize(inner_type, v) }
223
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
224
+ k_type = Regexp.last_match[:k_type]
225
+ v_type = Regexp.last_match[:v_type]
226
+ {}.tap do |hash|
227
+ value.each do |k, v|
228
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
229
+ end
230
+ end
231
+ else # model
232
+ # models (e.g. Pet) or oneOf
233
+ klass = Svix.const_get(type)
234
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
235
+ end
236
+ end
237
+
238
+ # Returns the string representation of the object
239
+ # @return [String] String presentation of the object
240
+ def to_s
241
+ to_hash.to_s
242
+ end
243
+
244
+ # to_body is an alias to to_hash (backward compatibility)
245
+ # @return [Hash] Returns the object in the form of hash
246
+ def to_body
247
+ to_hash
248
+ end
249
+
250
+ # Returns the object in the form of hash
251
+ # @return [Hash] Returns the object in the form of hash
252
+ def to_hash
253
+ hash = {}
254
+ self.class.attribute_map.each_pair do |attr, param|
255
+ value = self.send(attr)
256
+ if value.nil?
257
+ is_nullable = self.class.openapi_nullable.include?(attr)
258
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
259
+ end
260
+
261
+ hash[param] = _to_hash(value)
262
+ end
263
+ hash
264
+ end
265
+
266
+ # Outputs non-array value in the form of hash
267
+ # For object, use to_hash. Otherwise, just return the value
268
+ # @param [Object] value Any valid value
269
+ # @return [Hash] Returns the value in the form of hash
270
+ def _to_hash(value)
271
+ if value.is_a?(Array)
272
+ value.compact.map { |v| _to_hash(v) }
273
+ elsif value.is_a?(Hash)
274
+ {}.tap do |hash|
275
+ value.each { |k, v| hash[k] = _to_hash(v) }
276
+ end
277
+ elsif value.respond_to? :to_hash
278
+ value.to_hash
279
+ else
280
+ value
281
+ end
282
+ end
283
+
284
+ end
285
+
286
+ end
@@ -0,0 +1,39 @@
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 of your users. - `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/). ## 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 RadiiEnum
18
+ NONE = "none".freeze
19
+ LG = "lg".freeze
20
+ SM = "sm".freeze
21
+ FULL = "full".freeze
22
+
23
+ # Builds the enum from string
24
+ # @param [String] The enum value in the form of the string
25
+ # @return [String] The enum value
26
+ def self.build_from_hash(value)
27
+ new.build_from_hash(value)
28
+ end
29
+
30
+ # Builds the enum from string
31
+ # @param [String] The enum value in the form of the string
32
+ # @return [String] The enum value
33
+ def build_from_hash(value)
34
+ constantValues = RadiiEnum.constants.select { |c| RadiiEnum::const_get(c) == value }
35
+ raise "Invalid ENUM value #{value} for class #RadiiEnum" if constantValues.empty?
36
+ value
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,323 @@
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 of your users. - `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/). ## 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_color
19
+
20
+ attr_accessor :custom_font_family
21
+
22
+ attr_accessor :custom_logo_url
23
+
24
+ attr_accessor :custom_theme_override
25
+
26
+ attr_accessor :enforce_https
27
+
28
+ attr_accessor :retry_policy
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'custom_color' => :'customColor',
34
+ :'custom_font_family' => :'customFontFamily',
35
+ :'custom_logo_url' => :'customLogoUrl',
36
+ :'custom_theme_override' => :'customThemeOverride',
37
+ :'enforce_https' => :'enforceHttps',
38
+ :'retry_policy' => :'retryPolicy'
39
+ }
40
+ end
41
+
42
+ # Returns all the JSON keys this model knows about
43
+ def self.acceptable_attributes
44
+ attribute_map.values
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.openapi_types
49
+ {
50
+ :'custom_color' => :'String',
51
+ :'custom_font_family' => :'String',
52
+ :'custom_logo_url' => :'String',
53
+ :'custom_theme_override' => :'CustomThemeOverride',
54
+ :'enforce_https' => :'Boolean',
55
+ :'retry_policy' => :'Array<Float>'
56
+ }
57
+ end
58
+
59
+ # List of attributes with nullable: true
60
+ def self.openapi_nullable
61
+ Set.new([
62
+ ])
63
+ end
64
+
65
+ # Initializes the object
66
+ # @param [Hash] attributes Model attributes in the form of hash
67
+ def initialize(attributes = {})
68
+ if (!attributes.is_a?(Hash))
69
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Svix::SettingsOut` initialize method"
70
+ end
71
+
72
+ # check to see if the attribute exists and convert string to symbol for hash key
73
+ attributes = attributes.each_with_object({}) { |(k, v), h|
74
+ if (!self.class.attribute_map.key?(k.to_sym))
75
+ 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
76
+ end
77
+ h[k.to_sym] = v
78
+ }
79
+
80
+ if attributes.key?(:'custom_color')
81
+ self.custom_color = attributes[:'custom_color']
82
+ end
83
+
84
+ if attributes.key?(:'custom_font_family')
85
+ self.custom_font_family = attributes[:'custom_font_family']
86
+ end
87
+
88
+ if attributes.key?(:'custom_logo_url')
89
+ self.custom_logo_url = attributes[:'custom_logo_url']
90
+ end
91
+
92
+ if attributes.key?(:'custom_theme_override')
93
+ self.custom_theme_override = attributes[:'custom_theme_override']
94
+ end
95
+
96
+ if attributes.key?(:'enforce_https')
97
+ self.enforce_https = attributes[:'enforce_https']
98
+ else
99
+ self.enforce_https = true
100
+ end
101
+
102
+ if attributes.key?(:'retry_policy')
103
+ if (value = attributes[:'retry_policy']).is_a?(Array)
104
+ self.retry_policy = value
105
+ end
106
+ end
107
+ end
108
+
109
+ # Show invalid properties with the reasons. Usually used together with valid?
110
+ # @return Array for valid properties with the reasons
111
+ def list_invalid_properties
112
+ invalid_properties = Array.new
113
+ pattern = Regexp.new(/^[a-zA-Z0-9\-_ ]+$/)
114
+ if !@custom_font_family.nil? && @custom_font_family !~ pattern
115
+ invalid_properties.push("invalid value for \"custom_font_family\", must conform to the pattern #{pattern}.")
116
+ end
117
+
118
+ if !@custom_logo_url.nil? && @custom_logo_url.to_s.length > 65536
119
+ invalid_properties.push('invalid value for "custom_logo_url", the character length must be smaller than or equal to 65536.')
120
+ end
121
+
122
+ if !@custom_logo_url.nil? && @custom_logo_url.to_s.length < 1
123
+ invalid_properties.push('invalid value for "custom_logo_url", the character length must be great than or equal to 1.')
124
+ end
125
+
126
+ if !@retry_policy.nil? && @retry_policy.length < 1
127
+ invalid_properties.push('invalid value for "retry_policy", number of items must be greater than or equal to 1.')
128
+ end
129
+
130
+ invalid_properties
131
+ end
132
+
133
+ # Check to see if the all the properties in the model are valid
134
+ # @return true if the model is valid
135
+ def valid?
136
+ return false if !@custom_font_family.nil? && @custom_font_family !~ Regexp.new(/^[a-zA-Z0-9\-_ ]+$/)
137
+ return false if !@custom_logo_url.nil? && @custom_logo_url.to_s.length > 65536
138
+ return false if !@custom_logo_url.nil? && @custom_logo_url.to_s.length < 1
139
+ return false if !@retry_policy.nil? && @retry_policy.length < 1
140
+ true
141
+ end
142
+
143
+ # Custom attribute writer method with validation
144
+ # @param [Object] custom_font_family Value to be assigned
145
+ def custom_font_family=(custom_font_family)
146
+ pattern = Regexp.new(/^[a-zA-Z0-9\-_ ]+$/)
147
+ if !custom_font_family.nil? && custom_font_family !~ pattern
148
+ fail ArgumentError, "invalid value for \"custom_font_family\", must conform to the pattern #{pattern}."
149
+ end
150
+
151
+ @custom_font_family = custom_font_family
152
+ end
153
+
154
+ # Custom attribute writer method with validation
155
+ # @param [Object] custom_logo_url Value to be assigned
156
+ def custom_logo_url=(custom_logo_url)
157
+ if !custom_logo_url.nil? && custom_logo_url.to_s.length > 65536
158
+ fail ArgumentError, 'invalid value for "custom_logo_url", the character length must be smaller than or equal to 65536.'
159
+ end
160
+
161
+ if !custom_logo_url.nil? && custom_logo_url.to_s.length < 1
162
+ fail ArgumentError, 'invalid value for "custom_logo_url", the character length must be great than or equal to 1.'
163
+ end
164
+
165
+ @custom_logo_url = custom_logo_url
166
+ end
167
+
168
+ # Custom attribute writer method with validation
169
+ # @param [Object] retry_policy Value to be assigned
170
+ def retry_policy=(retry_policy)
171
+ if !retry_policy.nil? && retry_policy.length < 1
172
+ fail ArgumentError, 'invalid value for "retry_policy", number of items must be greater than or equal to 1.'
173
+ end
174
+
175
+ @retry_policy = retry_policy
176
+ end
177
+
178
+ # Checks equality by comparing each attribute.
179
+ # @param [Object] Object to be compared
180
+ def ==(o)
181
+ return true if self.equal?(o)
182
+ self.class == o.class &&
183
+ custom_color == o.custom_color &&
184
+ custom_font_family == o.custom_font_family &&
185
+ custom_logo_url == o.custom_logo_url &&
186
+ custom_theme_override == o.custom_theme_override &&
187
+ enforce_https == o.enforce_https &&
188
+ retry_policy == o.retry_policy
189
+ end
190
+
191
+ # @see the `==` method
192
+ # @param [Object] Object to be compared
193
+ def eql?(o)
194
+ self == o
195
+ end
196
+
197
+ # Calculates hash code according to all attributes.
198
+ # @return [Integer] Hash code
199
+ def hash
200
+ [custom_color, custom_font_family, custom_logo_url, custom_theme_override, enforce_https, retry_policy].hash
201
+ end
202
+
203
+ # Builds the object from hash
204
+ # @param [Hash] attributes Model attributes in the form of hash
205
+ # @return [Object] Returns the model itself
206
+ def self.build_from_hash(attributes)
207
+ new.build_from_hash(attributes)
208
+ end
209
+
210
+ # Builds the object from hash
211
+ # @param [Hash] attributes Model attributes in the form of hash
212
+ # @return [Object] Returns the model itself
213
+ def build_from_hash(attributes)
214
+ return nil unless attributes.is_a?(Hash)
215
+ self.class.openapi_types.each_pair do |key, type|
216
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
217
+ self.send("#{key}=", nil)
218
+ elsif type =~ /\AArray<(.*)>/i
219
+ # check to ensure the input is an array given that the attribute
220
+ # is documented as an array but the input is not
221
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
222
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
223
+ end
224
+ elsif !attributes[self.class.attribute_map[key]].nil?
225
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
226
+ end
227
+ end
228
+
229
+ self
230
+ end
231
+
232
+ # Deserializes the data based on type
233
+ # @param string type Data type
234
+ # @param string value Value to be deserialized
235
+ # @return [Object] Deserialized data
236
+ def _deserialize(type, value)
237
+ case type.to_sym
238
+ when :Time
239
+ Time.parse(value)
240
+ when :Date
241
+ Date.parse(value)
242
+ when :String
243
+ value.to_s
244
+ when :Integer
245
+ value.to_i
246
+ when :Float
247
+ value.to_f
248
+ when :Boolean
249
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
250
+ true
251
+ else
252
+ false
253
+ end
254
+ when :Object
255
+ # generic object (usually a Hash), return directly
256
+ value
257
+ when /\AArray<(?<inner_type>.+)>\z/
258
+ inner_type = Regexp.last_match[:inner_type]
259
+ value.map { |v| _deserialize(inner_type, v) }
260
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
261
+ k_type = Regexp.last_match[:k_type]
262
+ v_type = Regexp.last_match[:v_type]
263
+ {}.tap do |hash|
264
+ value.each do |k, v|
265
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
266
+ end
267
+ end
268
+ else # model
269
+ # models (e.g. Pet) or oneOf
270
+ klass = Svix.const_get(type)
271
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
272
+ end
273
+ end
274
+
275
+ # Returns the string representation of the object
276
+ # @return [String] String presentation of the object
277
+ def to_s
278
+ to_hash.to_s
279
+ end
280
+
281
+ # to_body is an alias to to_hash (backward compatibility)
282
+ # @return [Hash] Returns the object in the form of hash
283
+ def to_body
284
+ to_hash
285
+ end
286
+
287
+ # Returns the object in the form of hash
288
+ # @return [Hash] Returns the object in the form of hash
289
+ def to_hash
290
+ hash = {}
291
+ self.class.attribute_map.each_pair do |attr, param|
292
+ value = self.send(attr)
293
+ if value.nil?
294
+ is_nullable = self.class.openapi_nullable.include?(attr)
295
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
296
+ end
297
+
298
+ hash[param] = _to_hash(value)
299
+ end
300
+ hash
301
+ end
302
+
303
+ # Outputs non-array value in the form of hash
304
+ # For object, use to_hash. Otherwise, just return the value
305
+ # @param [Object] value Any valid value
306
+ # @return [Hash] Returns the value in the form of hash
307
+ def _to_hash(value)
308
+ if value.is_a?(Array)
309
+ value.compact.map { |v| _to_hash(v) }
310
+ elsif value.is_a?(Hash)
311
+ {}.tap do |hash|
312
+ value.each { |k, v| hash[k] = _to_hash(v) }
313
+ end
314
+ elsif value.respond_to? :to_hash
315
+ value.to_hash
316
+ else
317
+ value
318
+ end
319
+ end
320
+
321
+ end
322
+
323
+ end
data/lib/svix/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Svix
4
- VERSION = "0.37.0"
4
+ VERSION = "0.38.0"
5
5
  end
data/lib/svix.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "json"
4
4
  require "openssl"
5
- require "Base64"
5
+ require "base64"
6
6
 
7
7
  # API
8
8
  require "svix/api/application_api"