svix 1.23.0 → 1.25.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/lib/svix/api/endpoint_api.rb +475 -2
  4. data/lib/svix/api/message_api.rb +218 -2
  5. data/lib/svix/api/streams_api.rb +185 -0
  6. data/lib/svix/api/transformation_template_api.rb +195 -24
  7. data/lib/svix/models/auth_token_out.rb +272 -0
  8. data/lib/svix/models/client_secret_jwt_params_in.rb +3 -0
  9. data/lib/svix/models/create_message_token_in.rb +250 -0
  10. data/lib/svix/models/create_stream_in.rb +225 -0
  11. data/lib/svix/models/endpoint_created_event_data.rb +1 -0
  12. data/lib/svix/models/endpoint_deleted_event_data.rb +1 -0
  13. data/lib/svix/models/endpoint_mtls_config_in.rb +235 -0
  14. data/lib/svix/models/endpoint_oauth_config_in.rb +42 -2
  15. data/lib/svix/models/endpoint_updated_event_data.rb +1 -0
  16. data/lib/svix/models/environment_settings_out.rb +15 -4
  17. data/lib/svix/models/event_in.rb +223 -0
  18. data/lib/svix/models/event_out.rb +223 -0
  19. data/lib/svix/models/event_type_from_open_api.rb +280 -0
  20. data/lib/svix/models/event_type_import_open_api_in.rb +13 -1
  21. data/lib/svix/models/event_type_import_open_api_out_data.rb +16 -4
  22. data/lib/svix/models/hubspot_oauth_config_in.rb +223 -0
  23. data/lib/svix/models/{oauth_payload_out.rb → incoming_webhook_payload_out.rb} +3 -3
  24. data/lib/svix/models/kafka_security_protocol_type.rb +38 -0
  25. data/lib/svix/models/list_response_event_out.rb +259 -0
  26. data/lib/svix/models/list_response_sink_out.rb +259 -0
  27. data/lib/svix/models/message_subscriber_auth_token_out.rb +237 -0
  28. data/lib/svix/models/{oauth_payload_in.rb → o_auth_payload_in.rb} +3 -3
  29. data/lib/svix/models/o_auth_payload_out.rb +239 -0
  30. data/lib/svix/models/{oauth2_grant_type.rb → oauth2_grant_type_in.rb} +4 -3
  31. data/lib/svix/models/settings_in.rb +15 -4
  32. data/lib/svix/models/settings_out.rb +15 -4
  33. data/lib/svix/models/sink_in.rb +107 -0
  34. data/lib/svix/models/sink_in_one_of.rb +285 -0
  35. data/lib/svix/models/sink_in_one_of1.rb +313 -0
  36. data/lib/svix/models/sink_in_one_of2.rb +321 -0
  37. data/lib/svix/models/sink_in_one_of3.rb +271 -0
  38. data/lib/svix/models/sink_out.rb +107 -0
  39. data/lib/svix/version.rb +1 -1
  40. metadata +25 -5
@@ -0,0 +1,235 @@
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 EndpointMtlsConfigIn
18
+ # A PEM encoded private key and X509 certificate to identify the webhook sender.
19
+ attr_accessor :identity
20
+
21
+ # A PEM encoded X509 certificate used to verify the webhook receiver's certificate.
22
+ attr_accessor :server_ca_cert
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'identity' => :'identity',
28
+ :'server_ca_cert' => :'serverCaCert'
29
+ }
30
+ end
31
+
32
+ # Returns all the JSON keys this model knows about
33
+ def self.acceptable_attributes
34
+ attribute_map.values
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'identity' => :'String',
41
+ :'server_ca_cert' => :'String'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ :'server_ca_cert'
49
+ ])
50
+ end
51
+
52
+ # Initializes the object
53
+ # @param [Hash] attributes Model attributes in the form of hash
54
+ def initialize(attributes = {})
55
+ if (!attributes.is_a?(Hash))
56
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Svix::EndpointMtlsConfigIn` initialize method"
57
+ end
58
+
59
+ # check to see if the attribute exists and convert string to symbol for hash key
60
+ attributes = attributes.each_with_object({}) { |(k, v), h|
61
+ if (!self.class.attribute_map.key?(k.to_sym))
62
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Svix::EndpointMtlsConfigIn`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
63
+ end
64
+ h[k.to_sym] = v
65
+ }
66
+
67
+ if attributes.key?(:'identity')
68
+ self.identity = attributes[:'identity']
69
+ end
70
+
71
+ if attributes.key?(:'server_ca_cert')
72
+ self.server_ca_cert = attributes[:'server_ca_cert']
73
+ end
74
+ end
75
+
76
+ # Show invalid properties with the reasons. Usually used together with valid?
77
+ # @return Array for valid properties with the reasons
78
+ def list_invalid_properties
79
+ invalid_properties = Array.new
80
+ if @identity.nil?
81
+ invalid_properties.push('invalid value for "identity", identity cannot be nil.')
82
+ end
83
+
84
+ invalid_properties
85
+ end
86
+
87
+ # Check to see if the all the properties in the model are valid
88
+ # @return true if the model is valid
89
+ def valid?
90
+ return false if @identity.nil?
91
+ true
92
+ end
93
+
94
+ # Checks equality by comparing each attribute.
95
+ # @param [Object] Object to be compared
96
+ def ==(o)
97
+ return true if self.equal?(o)
98
+ self.class == o.class &&
99
+ identity == o.identity &&
100
+ server_ca_cert == o.server_ca_cert
101
+ end
102
+
103
+ # @see the `==` method
104
+ # @param [Object] Object to be compared
105
+ def eql?(o)
106
+ self == o
107
+ end
108
+
109
+ # Calculates hash code according to all attributes.
110
+ # @return [Integer] Hash code
111
+ def hash
112
+ [identity, server_ca_cert].hash
113
+ end
114
+
115
+ # Builds the object from hash
116
+ # @param [Hash] attributes Model attributes in the form of hash
117
+ # @return [Object] Returns the model itself
118
+ def self.build_from_hash(attributes)
119
+ new.build_from_hash(attributes)
120
+ end
121
+
122
+ # Builds the object from hash
123
+ # @param [Hash] attributes Model attributes in the form of hash
124
+ # @return [Object] Returns the model itself
125
+ def build_from_hash(attributes)
126
+ return nil unless attributes.is_a?(Hash)
127
+ self.class.openapi_types.each_pair do |key, type|
128
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
129
+ self.send("#{key}=", nil)
130
+ elsif type =~ /\AArray<(.*)>/i
131
+ # check to ensure the input is an array given that the attribute
132
+ # is documented as an array but the input is not
133
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
134
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
135
+ end
136
+ elsif !attributes[self.class.attribute_map[key]].nil?
137
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
138
+ end
139
+ end
140
+
141
+ self
142
+ end
143
+
144
+ # Deserializes the data based on type
145
+ # @param string type Data type
146
+ # @param string value Value to be deserialized
147
+ # @return [Object] Deserialized data
148
+ def _deserialize(type, value)
149
+ case type.to_sym
150
+ when :Time
151
+ Time.parse(value)
152
+ when :Date
153
+ Date.parse(value)
154
+ when :String
155
+ value.to_s
156
+ when :Integer
157
+ value.to_i
158
+ when :Float
159
+ value.to_f
160
+ when :Boolean
161
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
162
+ true
163
+ else
164
+ false
165
+ end
166
+ when :Object
167
+ # generic object (usually a Hash), return directly
168
+ value
169
+ when /\AArray<(?<inner_type>.+)>\z/
170
+ inner_type = Regexp.last_match[:inner_type]
171
+ value.map { |v| _deserialize(inner_type, v) }
172
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
173
+ k_type = Regexp.last_match[:k_type]
174
+ v_type = Regexp.last_match[:v_type]
175
+ {}.tap do |hash|
176
+ value.each do |k, v|
177
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
178
+ end
179
+ end
180
+ else # model
181
+ # models (e.g. Pet) or oneOf
182
+ klass = Svix.const_get(type)
183
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
184
+ end
185
+ end
186
+
187
+ # Returns the string representation of the object
188
+ # @return [String] String presentation of the object
189
+ def to_s
190
+ to_hash.to_s
191
+ end
192
+
193
+ # to_body is an alias to to_hash (backward compatibility)
194
+ # @return [Hash] Returns the object in the form of hash
195
+ def to_body
196
+ to_hash
197
+ end
198
+
199
+ # Returns the object in the form of hash
200
+ # @return [Hash] Returns the object in the form of hash
201
+ def to_hash
202
+ hash = {}
203
+ self.class.attribute_map.each_pair do |attr, param|
204
+ value = self.send(attr)
205
+ if value.nil?
206
+ is_nullable = self.class.openapi_nullable.include?(attr)
207
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
208
+ end
209
+
210
+ hash[param] = _to_hash(value)
211
+ end
212
+ hash
213
+ end
214
+
215
+ # Outputs non-array value in the form of hash
216
+ # For object, use to_hash. Otherwise, just return the value
217
+ # @param [Object] value Any valid value
218
+ # @return [Hash] Returns the value in the form of hash
219
+ def _to_hash(value)
220
+ if value.is_a?(Array)
221
+ value.compact.map { |v| _to_hash(v) }
222
+ elsif value.is_a?(Hash)
223
+ {}.tap do |hash|
224
+ value.each { |k, v| hash[k] = _to_hash(v) }
225
+ end
226
+ elsif value.respond_to? :to_hash
227
+ value.to_hash
228
+ else
229
+ value
230
+ end
231
+ end
232
+
233
+ end
234
+
235
+ end
@@ -17,14 +17,26 @@ module Svix
17
17
  class EndpointOauthConfigIn
18
18
  attr_accessor :auth_method
19
19
 
20
+ # The client ID. Required for all authentication types.
20
21
  attr_accessor :client_id
21
22
 
23
+ # Optional client secret. This is only used for `clientSecretBasic` and `clientSecretPost`. For `clientSecretBasic`, the secret will be appended to the `Authorization` header. For `clientSecretPost`, this will be added to the body in a `client_secret` parameter.
22
24
  attr_accessor :client_secret
23
25
 
26
+ # Extra parameters added to the request body as key-value pairs.
27
+ attr_accessor :extra_params
28
+
24
29
  attr_accessor :grant_type
25
30
 
26
31
  attr_accessor :jwt_params
27
32
 
33
+ # For `refreshToken` grant type
34
+ attr_accessor :refresh_token
35
+
36
+ # Optional OAuth scopes added to the request body.
37
+ attr_accessor :scopes
38
+
39
+ # The URL of the authorization server.
28
40
  attr_accessor :token_url
29
41
 
30
42
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -33,8 +45,11 @@ module Svix
33
45
  :'auth_method' => :'authMethod',
34
46
  :'client_id' => :'clientId',
35
47
  :'client_secret' => :'clientSecret',
48
+ :'extra_params' => :'extraParams',
36
49
  :'grant_type' => :'grantType',
37
50
  :'jwt_params' => :'jwtParams',
51
+ :'refresh_token' => :'refreshToken',
52
+ :'scopes' => :'scopes',
38
53
  :'token_url' => :'tokenUrl'
39
54
  }
40
55
  end
@@ -50,8 +65,11 @@ module Svix
50
65
  :'auth_method' => :'Oauth2AuthMethodIn',
51
66
  :'client_id' => :'String',
52
67
  :'client_secret' => :'String',
53
- :'grant_type' => :'Oauth2GrantType',
68
+ :'extra_params' => :'Hash<String, String>',
69
+ :'grant_type' => :'Oauth2GrantTypeIn',
54
70
  :'jwt_params' => :'ClientSecretJwtParamsIn',
71
+ :'refresh_token' => :'String',
72
+ :'scopes' => :'Array<String>',
55
73
  :'token_url' => :'String'
56
74
  }
57
75
  end
@@ -60,6 +78,9 @@ module Svix
60
78
  def self.openapi_nullable
61
79
  Set.new([
62
80
  :'client_secret',
81
+ :'extra_params',
82
+ :'refresh_token',
83
+ :'scopes',
63
84
  ])
64
85
  end
65
86
 
@@ -90,6 +111,12 @@ module Svix
90
111
  self.client_secret = attributes[:'client_secret']
91
112
  end
92
113
 
114
+ if attributes.key?(:'extra_params')
115
+ if (value = attributes[:'extra_params']).is_a?(Hash)
116
+ self.extra_params = value
117
+ end
118
+ end
119
+
93
120
  if attributes.key?(:'grant_type')
94
121
  self.grant_type = attributes[:'grant_type']
95
122
  end
@@ -98,6 +125,16 @@ module Svix
98
125
  self.jwt_params = attributes[:'jwt_params']
99
126
  end
100
127
 
128
+ if attributes.key?(:'refresh_token')
129
+ self.refresh_token = attributes[:'refresh_token']
130
+ end
131
+
132
+ if attributes.key?(:'scopes')
133
+ if (value = attributes[:'scopes']).is_a?(Array)
134
+ self.scopes = value
135
+ end
136
+ end
137
+
101
138
  if attributes.key?(:'token_url')
102
139
  self.token_url = attributes[:'token_url']
103
140
  end
@@ -144,8 +181,11 @@ module Svix
144
181
  auth_method == o.auth_method &&
145
182
  client_id == o.client_id &&
146
183
  client_secret == o.client_secret &&
184
+ extra_params == o.extra_params &&
147
185
  grant_type == o.grant_type &&
148
186
  jwt_params == o.jwt_params &&
187
+ refresh_token == o.refresh_token &&
188
+ scopes == o.scopes &&
149
189
  token_url == o.token_url
150
190
  end
151
191
 
@@ -158,7 +198,7 @@ module Svix
158
198
  # Calculates hash code according to all attributes.
159
199
  # @return [Integer] Hash code
160
200
  def hash
161
- [auth_method, client_id, client_secret, grant_type, jwt_params, token_url].hash
201
+ [auth_method, client_id, client_secret, extra_params, grant_type, jwt_params, refresh_token, scopes, token_url].hash
162
202
  end
163
203
 
164
204
  # Builds the object from hash
@@ -14,6 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Svix
17
+ # Sent when an endpoint is created, updated, or deleted
17
18
  class EndpointUpdatedEventData
18
19
  # The app's ID
19
20
  attr_accessor :app_id
@@ -41,6 +41,8 @@ module Svix
41
41
 
42
42
  attr_accessor :show_use_svix_play
43
43
 
44
+ attr_accessor :wipe_successful_payload
45
+
44
46
  # Attribute mapping from ruby-style variable name to JSON key.
45
47
  def self.attribute_map
46
48
  {
@@ -56,7 +58,8 @@ module Svix
56
58
  :'enable_integration_management' => :'enableIntegrationManagement',
57
59
  :'enable_message_tags' => :'enableMessageTags',
58
60
  :'enable_transformations' => :'enableTransformations',
59
- :'show_use_svix_play' => :'showUseSvixPlay'
61
+ :'show_use_svix_play' => :'showUseSvixPlay',
62
+ :'wipe_successful_payload' => :'wipeSuccessfulPayload'
60
63
  }
61
64
  end
62
65
 
@@ -80,7 +83,8 @@ module Svix
80
83
  :'enable_integration_management' => :'Boolean',
81
84
  :'enable_message_tags' => :'Boolean',
82
85
  :'enable_transformations' => :'Boolean',
83
- :'show_use_svix_play' => :'Boolean'
86
+ :'show_use_svix_play' => :'Boolean',
87
+ :'wipe_successful_payload' => :'Boolean'
84
88
  }
85
89
  end
86
90
 
@@ -171,6 +175,12 @@ module Svix
171
175
  else
172
176
  self.show_use_svix_play = true
173
177
  end
178
+
179
+ if attributes.key?(:'wipe_successful_payload')
180
+ self.wipe_successful_payload = attributes[:'wipe_successful_payload']
181
+ else
182
+ self.wipe_successful_payload = false
183
+ end
174
184
  end
175
185
 
176
186
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -268,7 +278,8 @@ module Svix
268
278
  enable_integration_management == o.enable_integration_management &&
269
279
  enable_message_tags == o.enable_message_tags &&
270
280
  enable_transformations == o.enable_transformations &&
271
- show_use_svix_play == o.show_use_svix_play
281
+ show_use_svix_play == o.show_use_svix_play &&
282
+ wipe_successful_payload == o.wipe_successful_payload
272
283
  end
273
284
 
274
285
  # @see the `==` method
@@ -280,7 +291,7 @@ module Svix
280
291
  # Calculates hash code according to all attributes.
281
292
  # @return [Integer] Hash code
282
293
  def hash
283
- [color_palette_dark, color_palette_light, custom_color, custom_font_family, custom_font_family_url, custom_logo_url, custom_theme_override, display_name, enable_channels, enable_integration_management, enable_message_tags, enable_transformations, show_use_svix_play].hash
294
+ [color_palette_dark, color_palette_light, custom_color, custom_font_family, custom_font_family_url, custom_logo_url, custom_theme_override, display_name, enable_channels, enable_integration_management, enable_message_tags, enable_transformations, show_use_svix_play, wipe_successful_payload].hash
284
295
  end
285
296
 
286
297
  # 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 EventIn
18
+ attr_accessor :payload
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'payload' => :'payload'
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
+ :'payload' => :'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::EventIn` 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::EventIn`. 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?(:'payload')
61
+ self.payload = attributes[:'payload']
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 @payload.nil?
70
+ invalid_properties.push('invalid value for "payload", payload 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 @payload.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
+ payload == o.payload
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
+ [payload].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