svix 1.31.0 → 1.33.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/svix/api/message_api.rb +1 -1
- data/lib/svix/api/message_attempt_api.rb +5 -5
- data/lib/svix/api/sink_api.rb +176 -0
- data/lib/svix/api/stream_api.rb +432 -0
- data/lib/svix/models/custom_strings_override.rb +229 -0
- data/lib/svix/models/endpoint_message_out.rb +5 -5
- data/lib/svix/models/environment_settings_out.rb +10 -1
- data/lib/svix/models/list_response_stream_sink_out.rb +259 -0
- data/lib/svix/models/message_broadcast_in.rb +5 -5
- data/lib/svix/models/message_in.rb +5 -5
- data/lib/svix/models/message_out.rb +5 -5
- data/lib/svix/models/s3_config.rb +265 -0
- data/lib/svix/models/settings_in.rb +10 -1
- data/lib/svix/models/settings_out.rb +10 -1
- data/lib/svix/models/sink_http_config.rb +223 -0
- data/lib/svix/models/sink_in.rb +2 -1
- data/lib/svix/models/sink_in_one_of4.rb +271 -0
- data/lib/svix/models/sink_otel_v1_config.rb +223 -0
- data/lib/svix/models/sink_out.rb +2 -1
- data/lib/svix/models/sink_payload_format.rb +36 -0
- data/lib/svix/models/sink_status.rb +38 -0
- data/lib/svix/models/sink_status_in.rb +37 -0
- data/lib/svix/models/stream_sink_in.rb +106 -0
- data/lib/svix/models/stream_sink_in_one_of.rb +271 -0
- data/lib/svix/models/stream_sink_in_one_of1.rb +271 -0
- data/lib/svix/models/stream_sink_in_one_of2.rb +271 -0
- data/lib/svix/models/stream_sink_out.rb +106 -0
- data/lib/svix/models/stream_sink_patch.rb +106 -0
- data/lib/svix/version.rb +1 -1
- metadata +19 -2
@@ -0,0 +1,265 @@
|
|
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
|
+
OpenAPI Generator version: 5.2.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Svix
|
17
|
+
class S3Config
|
18
|
+
attr_accessor :access_key
|
19
|
+
|
20
|
+
attr_accessor :bucket
|
21
|
+
|
22
|
+
attr_accessor :region
|
23
|
+
|
24
|
+
attr_accessor :secret_access_key
|
25
|
+
|
26
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
27
|
+
def self.attribute_map
|
28
|
+
{
|
29
|
+
:'access_key' => :'accessKey',
|
30
|
+
:'bucket' => :'bucket',
|
31
|
+
:'region' => :'region',
|
32
|
+
:'secret_access_key' => :'secretAccessKey'
|
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
|
+
:'access_key' => :'String',
|
45
|
+
:'bucket' => :'String',
|
46
|
+
:'region' => :'String',
|
47
|
+
:'secret_access_key' => :'String'
|
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::S3Config` 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::S3Config`. 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?(:'access_key')
|
73
|
+
self.access_key = attributes[:'access_key']
|
74
|
+
end
|
75
|
+
|
76
|
+
if attributes.key?(:'bucket')
|
77
|
+
self.bucket = attributes[:'bucket']
|
78
|
+
end
|
79
|
+
|
80
|
+
if attributes.key?(:'region')
|
81
|
+
self.region = attributes[:'region']
|
82
|
+
end
|
83
|
+
|
84
|
+
if attributes.key?(:'secret_access_key')
|
85
|
+
self.secret_access_key = attributes[:'secret_access_key']
|
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
|
+
if @access_key.nil?
|
94
|
+
invalid_properties.push('invalid value for "access_key", access_key cannot be nil.')
|
95
|
+
end
|
96
|
+
|
97
|
+
if @bucket.nil?
|
98
|
+
invalid_properties.push('invalid value for "bucket", bucket cannot be nil.')
|
99
|
+
end
|
100
|
+
|
101
|
+
if @region.nil?
|
102
|
+
invalid_properties.push('invalid value for "region", region cannot be nil.')
|
103
|
+
end
|
104
|
+
|
105
|
+
if @secret_access_key.nil?
|
106
|
+
invalid_properties.push('invalid value for "secret_access_key", secret_access_key cannot be nil.')
|
107
|
+
end
|
108
|
+
|
109
|
+
invalid_properties
|
110
|
+
end
|
111
|
+
|
112
|
+
# Check to see if the all the properties in the model are valid
|
113
|
+
# @return true if the model is valid
|
114
|
+
def valid?
|
115
|
+
return false if @access_key.nil?
|
116
|
+
return false if @bucket.nil?
|
117
|
+
return false if @region.nil?
|
118
|
+
return false if @secret_access_key.nil?
|
119
|
+
true
|
120
|
+
end
|
121
|
+
|
122
|
+
# Checks equality by comparing each attribute.
|
123
|
+
# @param [Object] Object to be compared
|
124
|
+
def ==(o)
|
125
|
+
return true if self.equal?(o)
|
126
|
+
self.class == o.class &&
|
127
|
+
access_key == o.access_key &&
|
128
|
+
bucket == o.bucket &&
|
129
|
+
region == o.region &&
|
130
|
+
secret_access_key == o.secret_access_key
|
131
|
+
end
|
132
|
+
|
133
|
+
# @see the `==` method
|
134
|
+
# @param [Object] Object to be compared
|
135
|
+
def eql?(o)
|
136
|
+
self == o
|
137
|
+
end
|
138
|
+
|
139
|
+
# Calculates hash code according to all attributes.
|
140
|
+
# @return [Integer] Hash code
|
141
|
+
def hash
|
142
|
+
[access_key, bucket, region, secret_access_key].hash
|
143
|
+
end
|
144
|
+
|
145
|
+
# Builds the object from hash
|
146
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
147
|
+
# @return [Object] Returns the model itself
|
148
|
+
def self.build_from_hash(attributes)
|
149
|
+
new.build_from_hash(attributes)
|
150
|
+
end
|
151
|
+
|
152
|
+
# Builds the object from hash
|
153
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
154
|
+
# @return [Object] Returns the model itself
|
155
|
+
def build_from_hash(attributes)
|
156
|
+
return nil unless attributes.is_a?(Hash)
|
157
|
+
self.class.openapi_types.each_pair do |key, type|
|
158
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
159
|
+
self.send("#{key}=", nil)
|
160
|
+
elsif type =~ /\AArray<(.*)>/i
|
161
|
+
# check to ensure the input is an array given that the attribute
|
162
|
+
# is documented as an array but the input is not
|
163
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
164
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
165
|
+
end
|
166
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
167
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
self
|
172
|
+
end
|
173
|
+
|
174
|
+
# Deserializes the data based on type
|
175
|
+
# @param string type Data type
|
176
|
+
# @param string value Value to be deserialized
|
177
|
+
# @return [Object] Deserialized data
|
178
|
+
def _deserialize(type, value)
|
179
|
+
case type.to_sym
|
180
|
+
when :Time
|
181
|
+
Time.parse(value)
|
182
|
+
when :Date
|
183
|
+
Date.parse(value)
|
184
|
+
when :String
|
185
|
+
value.to_s
|
186
|
+
when :Integer
|
187
|
+
value.to_i
|
188
|
+
when :Float
|
189
|
+
value.to_f
|
190
|
+
when :Boolean
|
191
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
192
|
+
true
|
193
|
+
else
|
194
|
+
false
|
195
|
+
end
|
196
|
+
when :Object
|
197
|
+
# generic object (usually a Hash), return directly
|
198
|
+
value
|
199
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
200
|
+
inner_type = Regexp.last_match[:inner_type]
|
201
|
+
value.map { |v| _deserialize(inner_type, v) }
|
202
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
203
|
+
k_type = Regexp.last_match[:k_type]
|
204
|
+
v_type = Regexp.last_match[:v_type]
|
205
|
+
{}.tap do |hash|
|
206
|
+
value.each do |k, v|
|
207
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
208
|
+
end
|
209
|
+
end
|
210
|
+
else # model
|
211
|
+
# models (e.g. Pet) or oneOf
|
212
|
+
klass = Svix.const_get(type)
|
213
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
# Returns the string representation of the object
|
218
|
+
# @return [String] String presentation of the object
|
219
|
+
def to_s
|
220
|
+
to_hash.to_s
|
221
|
+
end
|
222
|
+
|
223
|
+
# to_body is an alias to to_hash (backward compatibility)
|
224
|
+
# @return [Hash] Returns the object in the form of hash
|
225
|
+
def to_body
|
226
|
+
to_hash
|
227
|
+
end
|
228
|
+
|
229
|
+
# Returns the object in the form of hash
|
230
|
+
# @return [Hash] Returns the object in the form of hash
|
231
|
+
def to_hash
|
232
|
+
hash = {}
|
233
|
+
self.class.attribute_map.each_pair do |attr, param|
|
234
|
+
value = self.send(attr)
|
235
|
+
if value.nil?
|
236
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
237
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
238
|
+
end
|
239
|
+
|
240
|
+
hash[param] = _to_hash(value)
|
241
|
+
end
|
242
|
+
hash
|
243
|
+
end
|
244
|
+
|
245
|
+
# Outputs non-array value in the form of hash
|
246
|
+
# For object, use to_hash. Otherwise, just return the value
|
247
|
+
# @param [Object] value Any valid value
|
248
|
+
# @return [Hash] Returns the value in the form of hash
|
249
|
+
def _to_hash(value)
|
250
|
+
if value.is_a?(Array)
|
251
|
+
value.compact.map { |v| _to_hash(v) }
|
252
|
+
elsif value.is_a?(Hash)
|
253
|
+
{}.tap do |hash|
|
254
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
255
|
+
end
|
256
|
+
elsif value.respond_to? :to_hash
|
257
|
+
value.to_hash
|
258
|
+
else
|
259
|
+
value
|
260
|
+
end
|
261
|
+
end
|
262
|
+
|
263
|
+
end
|
264
|
+
|
265
|
+
end
|
@@ -29,6 +29,8 @@ module Svix
|
|
29
29
|
|
30
30
|
attr_accessor :custom_logo_url
|
31
31
|
|
32
|
+
attr_accessor :custom_strings_override
|
33
|
+
|
32
34
|
attr_accessor :custom_theme_override
|
33
35
|
|
34
36
|
attr_accessor :disable_endpoint_on_failure
|
@@ -61,6 +63,7 @@ module Svix
|
|
61
63
|
:'custom_font_family' => :'customFontFamily',
|
62
64
|
:'custom_font_family_url' => :'customFontFamilyUrl',
|
63
65
|
:'custom_logo_url' => :'customLogoUrl',
|
66
|
+
:'custom_strings_override' => :'customStringsOverride',
|
64
67
|
:'custom_theme_override' => :'customThemeOverride',
|
65
68
|
:'disable_endpoint_on_failure' => :'disableEndpointOnFailure',
|
66
69
|
:'display_name' => :'displayName',
|
@@ -90,6 +93,7 @@ module Svix
|
|
90
93
|
:'custom_font_family' => :'String',
|
91
94
|
:'custom_font_family_url' => :'String',
|
92
95
|
:'custom_logo_url' => :'String',
|
96
|
+
:'custom_strings_override' => :'CustomStringsOverride',
|
93
97
|
:'custom_theme_override' => :'CustomThemeOverride',
|
94
98
|
:'disable_endpoint_on_failure' => :'Boolean',
|
95
99
|
:'display_name' => :'String',
|
@@ -159,6 +163,10 @@ module Svix
|
|
159
163
|
self.custom_logo_url = attributes[:'custom_logo_url']
|
160
164
|
end
|
161
165
|
|
166
|
+
if attributes.key?(:'custom_strings_override')
|
167
|
+
self.custom_strings_override = attributes[:'custom_strings_override']
|
168
|
+
end
|
169
|
+
|
162
170
|
if attributes.key?(:'custom_theme_override')
|
163
171
|
self.custom_theme_override = attributes[:'custom_theme_override']
|
164
172
|
end
|
@@ -312,6 +320,7 @@ module Svix
|
|
312
320
|
custom_font_family == o.custom_font_family &&
|
313
321
|
custom_font_family_url == o.custom_font_family_url &&
|
314
322
|
custom_logo_url == o.custom_logo_url &&
|
323
|
+
custom_strings_override == o.custom_strings_override &&
|
315
324
|
custom_theme_override == o.custom_theme_override &&
|
316
325
|
disable_endpoint_on_failure == o.disable_endpoint_on_failure &&
|
317
326
|
display_name == o.display_name &&
|
@@ -334,7 +343,7 @@ module Svix
|
|
334
343
|
# Calculates hash code according to all attributes.
|
335
344
|
# @return [Integer] Hash code
|
336
345
|
def hash
|
337
|
-
[color_palette_dark, color_palette_light, custom_base_font_size, custom_color, custom_font_family, custom_font_family_url, custom_logo_url, custom_theme_override, disable_endpoint_on_failure, display_name, enable_channels, enable_integration_management, enable_transformations, enforce_https, event_catalog_published, read_only, show_use_svix_play, wipe_successful_payload].hash
|
346
|
+
[color_palette_dark, color_palette_light, custom_base_font_size, custom_color, custom_font_family, custom_font_family_url, custom_logo_url, custom_strings_override, custom_theme_override, disable_endpoint_on_failure, display_name, enable_channels, enable_integration_management, enable_transformations, enforce_https, event_catalog_published, read_only, show_use_svix_play, wipe_successful_payload].hash
|
338
347
|
end
|
339
348
|
|
340
349
|
# Builds the object from hash
|
@@ -29,6 +29,8 @@ module Svix
|
|
29
29
|
|
30
30
|
attr_accessor :custom_logo_url
|
31
31
|
|
32
|
+
attr_accessor :custom_strings_override
|
33
|
+
|
32
34
|
attr_accessor :custom_theme_override
|
33
35
|
|
34
36
|
attr_accessor :disable_endpoint_on_failure
|
@@ -61,6 +63,7 @@ module Svix
|
|
61
63
|
:'custom_font_family' => :'customFontFamily',
|
62
64
|
:'custom_font_family_url' => :'customFontFamilyUrl',
|
63
65
|
:'custom_logo_url' => :'customLogoUrl',
|
66
|
+
:'custom_strings_override' => :'customStringsOverride',
|
64
67
|
:'custom_theme_override' => :'customThemeOverride',
|
65
68
|
:'disable_endpoint_on_failure' => :'disableEndpointOnFailure',
|
66
69
|
:'display_name' => :'displayName',
|
@@ -90,6 +93,7 @@ module Svix
|
|
90
93
|
:'custom_font_family' => :'String',
|
91
94
|
:'custom_font_family_url' => :'String',
|
92
95
|
:'custom_logo_url' => :'String',
|
96
|
+
:'custom_strings_override' => :'CustomStringsOverride',
|
93
97
|
:'custom_theme_override' => :'CustomThemeOverride',
|
94
98
|
:'disable_endpoint_on_failure' => :'Boolean',
|
95
99
|
:'display_name' => :'String',
|
@@ -159,6 +163,10 @@ module Svix
|
|
159
163
|
self.custom_logo_url = attributes[:'custom_logo_url']
|
160
164
|
end
|
161
165
|
|
166
|
+
if attributes.key?(:'custom_strings_override')
|
167
|
+
self.custom_strings_override = attributes[:'custom_strings_override']
|
168
|
+
end
|
169
|
+
|
162
170
|
if attributes.key?(:'custom_theme_override')
|
163
171
|
self.custom_theme_override = attributes[:'custom_theme_override']
|
164
172
|
end
|
@@ -312,6 +320,7 @@ module Svix
|
|
312
320
|
custom_font_family == o.custom_font_family &&
|
313
321
|
custom_font_family_url == o.custom_font_family_url &&
|
314
322
|
custom_logo_url == o.custom_logo_url &&
|
323
|
+
custom_strings_override == o.custom_strings_override &&
|
315
324
|
custom_theme_override == o.custom_theme_override &&
|
316
325
|
disable_endpoint_on_failure == o.disable_endpoint_on_failure &&
|
317
326
|
display_name == o.display_name &&
|
@@ -334,7 +343,7 @@ module Svix
|
|
334
343
|
# Calculates hash code according to all attributes.
|
335
344
|
# @return [Integer] Hash code
|
336
345
|
def hash
|
337
|
-
[color_palette_dark, color_palette_light, custom_base_font_size, custom_color, custom_font_family, custom_font_family_url, custom_logo_url, custom_theme_override, disable_endpoint_on_failure, display_name, enable_channels, enable_integration_management, enable_transformations, enforce_https, event_catalog_published, read_only, show_use_svix_play, wipe_successful_payload].hash
|
346
|
+
[color_palette_dark, color_palette_light, custom_base_font_size, custom_color, custom_font_family, custom_font_family_url, custom_logo_url, custom_strings_override, custom_theme_override, disable_endpoint_on_failure, display_name, enable_channels, enable_integration_management, enable_transformations, enforce_https, event_catalog_published, read_only, show_use_svix_play, wipe_successful_payload].hash
|
338
347
|
end
|
339
348
|
|
340
349
|
# Builds the object from hash
|
@@ -0,0 +1,223 @@
|
|
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
|
+
OpenAPI Generator version: 5.2.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Svix
|
17
|
+
class SinkHttpConfig
|
18
|
+
attr_accessor :url
|
19
|
+
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
+
def self.attribute_map
|
22
|
+
{
|
23
|
+
:'url' => :'url'
|
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
|
+
:'url' => :'String'
|
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::SinkHttpConfig` 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::SinkHttpConfig`. 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?(:'url')
|
61
|
+
self.url = attributes[:'url']
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
66
|
+
# @return Array for valid properties with the reasons
|
67
|
+
def list_invalid_properties
|
68
|
+
invalid_properties = Array.new
|
69
|
+
if @url.nil?
|
70
|
+
invalid_properties.push('invalid value for "url", url cannot be nil.')
|
71
|
+
end
|
72
|
+
|
73
|
+
invalid_properties
|
74
|
+
end
|
75
|
+
|
76
|
+
# Check to see if the all the properties in the model are valid
|
77
|
+
# @return true if the model is valid
|
78
|
+
def valid?
|
79
|
+
return false if @url.nil?
|
80
|
+
true
|
81
|
+
end
|
82
|
+
|
83
|
+
# Checks equality by comparing each attribute.
|
84
|
+
# @param [Object] Object to be compared
|
85
|
+
def ==(o)
|
86
|
+
return true if self.equal?(o)
|
87
|
+
self.class == o.class &&
|
88
|
+
url == o.url
|
89
|
+
end
|
90
|
+
|
91
|
+
# @see the `==` method
|
92
|
+
# @param [Object] Object to be compared
|
93
|
+
def eql?(o)
|
94
|
+
self == o
|
95
|
+
end
|
96
|
+
|
97
|
+
# Calculates hash code according to all attributes.
|
98
|
+
# @return [Integer] Hash code
|
99
|
+
def hash
|
100
|
+
[url].hash
|
101
|
+
end
|
102
|
+
|
103
|
+
# Builds the object from hash
|
104
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
105
|
+
# @return [Object] Returns the model itself
|
106
|
+
def self.build_from_hash(attributes)
|
107
|
+
new.build_from_hash(attributes)
|
108
|
+
end
|
109
|
+
|
110
|
+
# Builds the object from hash
|
111
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
112
|
+
# @return [Object] Returns the model itself
|
113
|
+
def build_from_hash(attributes)
|
114
|
+
return nil unless attributes.is_a?(Hash)
|
115
|
+
self.class.openapi_types.each_pair do |key, type|
|
116
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
117
|
+
self.send("#{key}=", nil)
|
118
|
+
elsif type =~ /\AArray<(.*)>/i
|
119
|
+
# check to ensure the input is an array given that the attribute
|
120
|
+
# is documented as an array but the input is not
|
121
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
122
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
123
|
+
end
|
124
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
125
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
self
|
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 _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_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
|