daily-ruby 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/Gemfile.lock +79 -0
  4. data/README.md +119 -0
  5. data/Rakefile +10 -0
  6. data/daily-ruby.gemspec +40 -0
  7. data/daily.yaml +422 -0
  8. data/docs/CreateMeetingToken200Response.md +18 -0
  9. data/docs/MeetingTokenRequest.md +18 -0
  10. data/docs/MeetingTokenRequestProperties.md +56 -0
  11. data/docs/MeetingTokenRequestPropertiesPermissions.md +22 -0
  12. data/docs/MeetingTokenRequestPropertiesPermissionsCanAdmin.md +49 -0
  13. data/docs/MeetingTokenRequestPropertiesPermissionsCanSend.md +49 -0
  14. data/docs/MeetingTokensApi.md +79 -0
  15. data/docs/RoomApi.md +227 -0
  16. data/docs/RoomDeletedResponse.md +20 -0
  17. data/docs/RoomNotFoundResponse.md +20 -0
  18. data/docs/RoomRequest.md +22 -0
  19. data/docs/RoomRequestProperties.md +76 -0
  20. data/docs/RoomResponse.md +28 -0
  21. data/docs/ServerErrorResponse.md +18 -0
  22. data/git_push.sh +57 -0
  23. data/lib/daily-ruby/api/meeting_tokens_api.rb +86 -0
  24. data/lib/daily-ruby/api/room_api.rb +218 -0
  25. data/lib/daily-ruby/api_client.rb +431 -0
  26. data/lib/daily-ruby/api_error.rb +58 -0
  27. data/lib/daily-ruby/configuration.rb +382 -0
  28. data/lib/daily-ruby/models/create_meeting_token200_response.rb +214 -0
  29. data/lib/daily-ruby/models/meeting_token_request.rb +215 -0
  30. data/lib/daily-ruby/models/meeting_token_request_properties.rb +438 -0
  31. data/lib/daily-ruby/models/meeting_token_request_properties_permissions.rb +232 -0
  32. data/lib/daily-ruby/models/meeting_token_request_properties_permissions_can_admin.rb +105 -0
  33. data/lib/daily-ruby/models/meeting_token_request_properties_permissions_can_send.rb +105 -0
  34. data/lib/daily-ruby/models/room_deleted_response.rb +224 -0
  35. data/lib/daily-ruby/models/room_not_found_response.rb +224 -0
  36. data/lib/daily-ruby/models/room_request.rb +267 -0
  37. data/lib/daily-ruby/models/room_request_properties.rb +521 -0
  38. data/lib/daily-ruby/models/room_response.rb +260 -0
  39. data/lib/daily-ruby/models/server_error_response.rb +215 -0
  40. data/lib/daily-ruby/version.rb +15 -0
  41. data/lib/daily-ruby.rb +53 -0
  42. data/run.sh +16 -0
  43. data/script.rb +35 -0
  44. data/spec/api/meeting_tokens_api_spec.rb +47 -0
  45. data/spec/api/room_api_spec.rb +74 -0
  46. data/spec/models/create_meeting_token200_response_spec.rb +36 -0
  47. data/spec/models/meeting_token_request_properties_permissions_can_admin_spec.rb +32 -0
  48. data/spec/models/meeting_token_request_properties_permissions_can_send_spec.rb +32 -0
  49. data/spec/models/meeting_token_request_properties_permissions_spec.rb +48 -0
  50. data/spec/models/meeting_token_request_properties_spec.rb +158 -0
  51. data/spec/models/meeting_token_request_spec.rb +36 -0
  52. data/spec/models/room_deleted_response_spec.rb +42 -0
  53. data/spec/models/room_not_found_response_spec.rb +42 -0
  54. data/spec/models/room_request_properties_spec.rb +218 -0
  55. data/spec/models/room_request_spec.rb +52 -0
  56. data/spec/models/room_response_spec.rb +66 -0
  57. data/spec/models/server_error_response_spec.rb +36 -0
  58. data/spec/spec_helper.rb +111 -0
  59. metadata +169 -0
@@ -0,0 +1,382 @@
1
+ =begin
2
+ #Daily
3
+
4
+ #The official library for communicating with the Daily REST API.
5
+
6
+ The version of the OpenAPI document: 0.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.3.0
10
+
11
+ =end
12
+
13
+ module Daily
14
+ class Configuration
15
+ # Defines url scheme
16
+ attr_accessor :scheme
17
+
18
+ # Defines url host
19
+ attr_accessor :host
20
+
21
+ # Defines url base path
22
+ attr_accessor :base_path
23
+
24
+ # Define server configuration index
25
+ attr_accessor :server_index
26
+
27
+ # Define server operation configuration index
28
+ attr_accessor :server_operation_index
29
+
30
+ # Default server variables
31
+ attr_accessor :server_variables
32
+
33
+ # Default server operation variables
34
+ attr_accessor :server_operation_variables
35
+
36
+ # Defines API keys used with API Key authentications.
37
+ #
38
+ # @return [Hash] key: parameter name, value: parameter value (API key)
39
+ #
40
+ # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string)
41
+ # config.api_key['api_key'] = 'xxx'
42
+ attr_accessor :api_key
43
+
44
+ # Defines API key prefixes used with API Key authentications.
45
+ #
46
+ # @return [Hash] key: parameter name, value: API key prefix
47
+ #
48
+ # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers)
49
+ # config.api_key_prefix['api_key'] = 'Token'
50
+ attr_accessor :api_key_prefix
51
+
52
+ # Defines the username used with HTTP basic authentication.
53
+ #
54
+ # @return [String]
55
+ attr_accessor :username
56
+
57
+ # Defines the password used with HTTP basic authentication.
58
+ #
59
+ # @return [String]
60
+ attr_accessor :password
61
+
62
+ # Defines the access token (Bearer) used with OAuth2.
63
+ attr_accessor :access_token
64
+
65
+ # Defines a Proc used to fetch or refresh access tokens (Bearer) used with OAuth2.
66
+ # Overrides the access_token if set
67
+ # @return [Proc]
68
+ attr_accessor :access_token_getter
69
+
70
+ # Set this to return data as binary instead of downloading a temp file. When enabled (set to true)
71
+ # HTTP responses with return type `File` will be returned as a stream of binary data.
72
+ # Default to false.
73
+ attr_accessor :return_binary_data
74
+
75
+ # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
76
+ # details will be logged with `logger.debug` (see the `logger` attribute).
77
+ # Default to false.
78
+ #
79
+ # @return [true, false]
80
+ attr_accessor :debugging
81
+
82
+ # Defines the logger used for debugging.
83
+ # Default to `Rails.logger` (when in Rails) or logging to STDOUT.
84
+ #
85
+ # @return [#debug]
86
+ attr_accessor :logger
87
+
88
+ # Defines the temporary folder to store downloaded files
89
+ # (for API endpoints that have file response).
90
+ # Default to use `Tempfile`.
91
+ #
92
+ # @return [String]
93
+ attr_accessor :temp_folder_path
94
+
95
+ # The time limit for HTTP request in seconds.
96
+ # Default to 0 (never times out).
97
+ attr_accessor :timeout
98
+
99
+ # Set this to false to skip client side validation in the operation.
100
+ # Default to true.
101
+ # @return [true, false]
102
+ attr_accessor :client_side_validation
103
+
104
+ ### TLS/SSL setting
105
+ # Set this to false to skip verifying SSL certificate when calling API from https server.
106
+ # Default to true.
107
+ #
108
+ # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
109
+ #
110
+ # @return [true, false]
111
+ attr_accessor :ssl_verify
112
+
113
+ ### TLS/SSL setting
114
+ # Any `OpenSSL::SSL::` constant (see https://ruby-doc.org/stdlib-2.5.1/libdoc/openssl/rdoc/OpenSSL/SSL.html)
115
+ #
116
+ # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
117
+ #
118
+ attr_accessor :ssl_verify_mode
119
+
120
+ ### TLS/SSL setting
121
+ # Set this to customize the certificate file to verify the peer.
122
+ #
123
+ # @return [String] the path to the certificate file
124
+ attr_accessor :ssl_ca_file
125
+
126
+ ### TLS/SSL setting
127
+ # Client certificate file (for client certificate)
128
+ attr_accessor :ssl_client_cert
129
+
130
+ ### TLS/SSL setting
131
+ # Client private key file (for client certificate)
132
+ attr_accessor :ssl_client_key
133
+
134
+ ### Proxy setting
135
+ # HTTP Proxy settings
136
+ attr_accessor :proxy
137
+
138
+ # Set this to customize parameters encoder of array parameter.
139
+ # Default to nil. Faraday uses NestedParamsEncoder when nil.
140
+ #
141
+ # @see The params_encoder option of Faraday. Related source code:
142
+ # https://github.com/lostisland/faraday/tree/main/lib/faraday/encoders
143
+ attr_accessor :params_encoder
144
+
145
+
146
+ attr_accessor :inject_format
147
+
148
+ attr_accessor :force_ending_format
149
+
150
+ def initialize
151
+ @scheme = 'https'
152
+ @host = 'api.daily.co'
153
+ @base_path = '/v1'
154
+ @server_index = nil
155
+ @server_operation_index = {}
156
+ @server_variables = {}
157
+ @server_operation_variables = {}
158
+ @api_key = {}
159
+ @api_key_prefix = {}
160
+ @client_side_validation = true
161
+ @ssl_verify = true
162
+ @ssl_verify_mode = nil
163
+ @ssl_ca_file = nil
164
+ @ssl_client_cert = nil
165
+ @ssl_client_key = nil
166
+ @middlewares = Hash.new { |h, k| h[k] = [] }
167
+ @configure_connection_blocks = []
168
+ @timeout = 60
169
+ # return data as binary instead of file
170
+ @return_binary_data = false
171
+ @params_encoder = nil
172
+ @debugging = false
173
+ @inject_format = false
174
+ @force_ending_format = false
175
+ @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
176
+
177
+ yield(self) if block_given?
178
+ end
179
+
180
+ # The default Configuration object.
181
+ def self.default
182
+ @@default ||= Configuration.new
183
+ end
184
+
185
+ def configure
186
+ yield(self) if block_given?
187
+ end
188
+
189
+ def scheme=(scheme)
190
+ # remove :// from scheme
191
+ @scheme = scheme.sub(/:\/\//, '')
192
+ end
193
+
194
+ def host=(host)
195
+ # remove http(s):// and anything after a slash
196
+ @host = host.sub(/https?:\/\//, '').split('/').first
197
+ end
198
+
199
+ def base_path=(base_path)
200
+ # Add leading and trailing slashes to base_path
201
+ @base_path = "/#{base_path}".gsub(/\/+/, '/')
202
+ @base_path = '' if @base_path == '/'
203
+ end
204
+
205
+ # Returns base URL for specified operation based on server settings
206
+ def base_url(operation = nil)
207
+ if operation_server_settings.key?(operation) then
208
+ index = server_operation_index.fetch(operation, server_index)
209
+ server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
210
+ else
211
+ server_index.nil? ? "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') : server_url(server_index, server_variables, nil)
212
+ end
213
+ end
214
+
215
+ # Gets API key (with prefix if set).
216
+ # @param [String] param_name the parameter name of API key auth
217
+ def api_key_with_prefix(param_name, param_alias = nil)
218
+ key = @api_key[param_name]
219
+ key = @api_key.fetch(param_alias, key) unless param_alias.nil?
220
+ if @api_key_prefix[param_name]
221
+ "#{@api_key_prefix[param_name]} #{key}"
222
+ else
223
+ key
224
+ end
225
+ end
226
+
227
+ # Gets access_token using access_token_getter or uses the static access_token
228
+ def access_token_with_refresh
229
+ return access_token if access_token_getter.nil?
230
+ access_token_getter.call
231
+ end
232
+
233
+ # Gets Basic Auth token string
234
+ def basic_auth_token
235
+ 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
236
+ end
237
+
238
+ # Returns Auth Settings hash for api client.
239
+ def auth_settings
240
+ {
241
+ 'bearerAuth' =>
242
+ {
243
+ type: 'bearer',
244
+ in: 'header',
245
+ key: 'Authorization',
246
+ value: "Bearer #{access_token_with_refresh}"
247
+ },
248
+ }
249
+ end
250
+
251
+ # Returns an array of Server setting
252
+ def server_settings
253
+ [
254
+ {
255
+ url: "https://api.daily.co/v1",
256
+ description: "No description provided",
257
+ }
258
+ ]
259
+ end
260
+
261
+ def operation_server_settings
262
+ {
263
+ }
264
+ end
265
+
266
+ # Returns URL based on server settings
267
+ #
268
+ # @param index array index of the server settings
269
+ # @param variables hash of variable and the corresponding value
270
+ def server_url(index, variables = {}, servers = nil)
271
+ servers = server_settings if servers == nil
272
+
273
+ # check array index out of bound
274
+ if (index.nil? || index < 0 || index >= servers.size)
275
+ fail ArgumentError, "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}"
276
+ end
277
+
278
+ server = servers[index]
279
+ url = server[:url]
280
+
281
+ return url unless server.key? :variables
282
+
283
+ # go through variable and assign a value
284
+ server[:variables].each do |name, variable|
285
+ if variables.key?(name)
286
+ if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name]))
287
+ url.gsub! "{" + name.to_s + "}", variables[name]
288
+ else
289
+ fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
290
+ end
291
+ else
292
+ # use default value
293
+ url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value]
294
+ end
295
+ end
296
+
297
+ url
298
+ end
299
+
300
+ # Configure Faraday connection directly.
301
+ #
302
+ # ```
303
+ # c.configure_faraday_connection do |conn|
304
+ # conn.use Faraday::HttpCache, shared_cache: false, logger: logger
305
+ # conn.response :logger, nil, headers: true, bodies: true, log_level: :debug do |logger|
306
+ # logger.filter(/(Authorization: )(.*)/, '\1[REDACTED]')
307
+ # end
308
+ # end
309
+ #
310
+ # c.configure_faraday_connection do |conn|
311
+ # conn.adapter :typhoeus
312
+ # end
313
+ # ```
314
+ #
315
+ # @param block [Proc] `#call`able object that takes one arg, the connection
316
+ def configure_faraday_connection(&block)
317
+ @configure_connection_blocks << block
318
+ end
319
+
320
+ def configure_connection(conn)
321
+ @configure_connection_blocks.each do |block|
322
+ block.call(conn)
323
+ end
324
+ end
325
+
326
+ # Adds middleware to the stack
327
+ def use(*middleware)
328
+ set_faraday_middleware(:use, *middleware)
329
+ end
330
+
331
+ # Adds request middleware to the stack
332
+ def request(*middleware)
333
+ set_faraday_middleware(:request, *middleware)
334
+ end
335
+
336
+ # Adds response middleware to the stack
337
+ def response(*middleware)
338
+ set_faraday_middleware(:response, *middleware)
339
+ end
340
+
341
+ # Adds Faraday middleware setting information to the stack
342
+ #
343
+ # @example Use the `set_faraday_middleware` method to set middleware information
344
+ # config.set_faraday_middleware(:request, :retry, max: 3, methods: [:get, :post], retry_statuses: [503])
345
+ # config.set_faraday_middleware(:response, :logger, nil, { bodies: true, log_level: :debug })
346
+ # config.set_faraday_middleware(:use, Faraday::HttpCache, store: Rails.cache, shared_cache: false)
347
+ # config.set_faraday_middleware(:insert, 0, FaradayMiddleware::FollowRedirects, { standards_compliant: true, limit: 1 })
348
+ # config.set_faraday_middleware(:swap, 0, Faraday::Response::Logger)
349
+ # config.set_faraday_middleware(:delete, Faraday::Multipart::Middleware)
350
+ #
351
+ # @see https://github.com/lostisland/faraday/blob/v2.3.0/lib/faraday/rack_builder.rb#L92-L143
352
+ def set_faraday_middleware(operation, key, *args, &block)
353
+ unless [:request, :response, :use, :insert, :insert_before, :insert_after, :swap, :delete].include?(operation)
354
+ fail ArgumentError, "Invalid faraday middleware operation #{operation}. Must be" \
355
+ " :request, :response, :use, :insert, :insert_before, :insert_after, :swap or :delete."
356
+ end
357
+
358
+ @middlewares[operation] << [key, args, block]
359
+ end
360
+ ruby2_keywords(:set_faraday_middleware) if respond_to?(:ruby2_keywords, true)
361
+
362
+ # Set up middleware on the connection
363
+ def configure_middleware(connection)
364
+ return if @middlewares.empty?
365
+
366
+ [:request, :response, :use, :insert, :insert_before, :insert_after, :swap].each do |operation|
367
+ next unless @middlewares.key?(operation)
368
+
369
+ @middlewares[operation].each do |key, args, block|
370
+ connection.builder.send(operation, key, *args, &block)
371
+ end
372
+ end
373
+
374
+ if @middlewares.key?(:delete)
375
+ @middlewares[:delete].each do |key, _args, _block|
376
+ connection.builder.delete(key)
377
+ end
378
+ end
379
+ end
380
+
381
+ end
382
+ end
@@ -0,0 +1,214 @@
1
+ =begin
2
+ #Daily
3
+
4
+ #The official library for communicating with the Daily REST API.
5
+
6
+ The version of the OpenAPI document: 0.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.3.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Daily
17
+ class CreateMeetingToken200Response
18
+ attr_accessor :token
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'token' => :'token'
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
+ :'token' => :'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 `Daily::CreateMeetingToken200Response` 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 `Daily::CreateMeetingToken200Response`. 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?(:'token')
61
+ self.token = attributes[:'token']
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
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
69
+ invalid_properties = Array.new
70
+ invalid_properties
71
+ end
72
+
73
+ # Check to see if the all the properties in the model are valid
74
+ # @return true if the model is valid
75
+ def valid?
76
+ warn '[DEPRECATED] the `valid?` method is obsolete'
77
+ true
78
+ end
79
+
80
+ # Checks equality by comparing each attribute.
81
+ # @param [Object] Object to be compared
82
+ def ==(o)
83
+ return true if self.equal?(o)
84
+ self.class == o.class &&
85
+ token == o.token
86
+ end
87
+
88
+ # @see the `==` method
89
+ # @param [Object] Object to be compared
90
+ def eql?(o)
91
+ self == o
92
+ end
93
+
94
+ # Calculates hash code according to all attributes.
95
+ # @return [Integer] Hash code
96
+ def hash
97
+ [token].hash
98
+ end
99
+
100
+ # Builds the object from hash
101
+ # @param [Hash] attributes Model attributes in the form of hash
102
+ # @return [Object] Returns the model itself
103
+ def self.build_from_hash(attributes)
104
+ return nil unless attributes.is_a?(Hash)
105
+ attributes = attributes.transform_keys(&:to_sym)
106
+ transformed_hash = {}
107
+ openapi_types.each_pair do |key, type|
108
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
109
+ transformed_hash["#{key}"] = nil
110
+ elsif type =~ /\AArray<(.*)>/i
111
+ # check to ensure the input is an array given that the attribute
112
+ # is documented as an array but the input is not
113
+ if attributes[attribute_map[key]].is_a?(Array)
114
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
115
+ end
116
+ elsif !attributes[attribute_map[key]].nil?
117
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
118
+ end
119
+ end
120
+ new(transformed_hash)
121
+ end
122
+
123
+ # Deserializes the data based on type
124
+ # @param string type Data type
125
+ # @param string value Value to be deserialized
126
+ # @return [Object] Deserialized data
127
+ def self._deserialize(type, value)
128
+ case type.to_sym
129
+ when :Time
130
+ Time.parse(value)
131
+ when :Date
132
+ Date.parse(value)
133
+ when :String
134
+ value.to_s
135
+ when :Integer
136
+ value.to_i
137
+ when :Float
138
+ value.to_f
139
+ when :Boolean
140
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
141
+ true
142
+ else
143
+ false
144
+ end
145
+ when :Object
146
+ # generic object (usually a Hash), return directly
147
+ value
148
+ when /\AArray<(?<inner_type>.+)>\z/
149
+ inner_type = Regexp.last_match[:inner_type]
150
+ value.map { |v| _deserialize(inner_type, v) }
151
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
152
+ k_type = Regexp.last_match[:k_type]
153
+ v_type = Regexp.last_match[:v_type]
154
+ {}.tap do |hash|
155
+ value.each do |k, v|
156
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
157
+ end
158
+ end
159
+ else # model
160
+ # models (e.g. Pet) or oneOf
161
+ klass = Daily.const_get(type)
162
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
163
+ end
164
+ end
165
+
166
+ # Returns the string representation of the object
167
+ # @return [String] String presentation of the object
168
+ def to_s
169
+ to_hash.to_s
170
+ end
171
+
172
+ # to_body is an alias to to_hash (backward compatibility)
173
+ # @return [Hash] Returns the object in the form of hash
174
+ def to_body
175
+ to_hash
176
+ end
177
+
178
+ # Returns the object in the form of hash
179
+ # @return [Hash] Returns the object in the form of hash
180
+ def to_hash
181
+ hash = {}
182
+ self.class.attribute_map.each_pair do |attr, param|
183
+ value = self.send(attr)
184
+ if value.nil?
185
+ is_nullable = self.class.openapi_nullable.include?(attr)
186
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
187
+ end
188
+
189
+ hash[param] = _to_hash(value)
190
+ end
191
+ hash
192
+ end
193
+
194
+ # Outputs non-array value in the form of hash
195
+ # For object, use to_hash. Otherwise, just return the value
196
+ # @param [Object] value Any valid value
197
+ # @return [Hash] Returns the value in the form of hash
198
+ def _to_hash(value)
199
+ if value.is_a?(Array)
200
+ value.compact.map { |v| _to_hash(v) }
201
+ elsif value.is_a?(Hash)
202
+ {}.tap do |hash|
203
+ value.each { |k, v| hash[k] = _to_hash(v) }
204
+ end
205
+ elsif value.respond_to? :to_hash
206
+ value.to_hash
207
+ else
208
+ value
209
+ end
210
+ end
211
+
212
+ end
213
+
214
+ end