freeclimb 5.2.0 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -1
  3. data/Gemfile.lock +3 -3
  4. data/README.md +17 -4
  5. data/docs/CallResult.md +2 -2
  6. data/docs/CreateConference.md +4 -2
  7. data/docs/DefaultApi.md +368 -1
  8. data/docs/ExportList.md +32 -0
  9. data/docs/ExportOutputType.md +16 -0
  10. data/docs/ExportRequest.md +24 -0
  11. data/docs/ExportRequestOutput.md +18 -0
  12. data/docs/ExportResourceType.md +17 -0
  13. data/docs/ExportResult.md +40 -0
  14. data/docs/ExportResultOutput.md +18 -0
  15. data/docs/ExportStatus.md +21 -0
  16. data/lib/freeclimb/api/default_api.rb +313 -0
  17. data/lib/freeclimb/models/call_result.rb +8 -8
  18. data/lib/freeclimb/models/create_conference.rb +15 -5
  19. data/lib/freeclimb/models/export_list.rb +304 -0
  20. data/lib/freeclimb/models/export_output_type.rb +34 -0
  21. data/lib/freeclimb/models/export_request.rb +276 -0
  22. data/lib/freeclimb/models/export_request_output.rb +243 -0
  23. data/lib/freeclimb/models/export_resource_type.rb +35 -0
  24. data/lib/freeclimb/models/export_result.rb +405 -0
  25. data/lib/freeclimb/models/export_result_output.rb +243 -0
  26. data/lib/freeclimb/models/export_status.rb +39 -0
  27. data/lib/freeclimb/version.rb +1 -1
  28. data/lib/freeclimb.rb +8 -0
  29. data/openapi.json +370 -2
  30. data/spec/api/default_api_spec.rb +141 -2
  31. data/spec/models/call_result_spec.rb +36 -36
  32. data/spec/models/create_conference_spec.rb +83 -35
  33. data/spec/models/export_list_spec.rb +502 -0
  34. data/spec/models/export_output_type_spec.rb +43 -0
  35. data/spec/models/export_request_output_spec.rb +162 -0
  36. data/spec/models/export_request_spec.rb +320 -0
  37. data/spec/models/export_resource_type_spec.rb +59 -0
  38. data/spec/models/export_result_output_spec.rb +162 -0
  39. data/spec/models/export_result_spec.rb +718 -0
  40. data/spec/models/export_status_spec.rb +123 -0
  41. data/yarn.lock +29 -29
  42. metadata +26 -2
@@ -0,0 +1,243 @@
1
+ # #FreeClimb API
2
+ #
3
+ # FreeClimb is a cloud-based application programming interface (API) that puts the power of the Vail platform in your hands. FreeClimb simplifies the process of creating applications that can use a full range of telephony features without requiring specialized or on-site telephony equipment. Using the FreeClimb REST API to write applications is easy! You have the option to use the language of your choice or hit the API directly. Your application can execute a command by issuing a RESTful request to the FreeClimb API. The base URL to send HTTP requests to the FreeClimb REST API is: /apiserver. FreeClimb authenticates and processes your request.
4
+ #
5
+ # The version of the OpenAPI document: 1.0.0
6
+ # Contact: support@freeclimb.com
7
+ # Generated by: https://openapi-generator.tech
8
+ # OpenAPI Generator version: 7.9.0
9
+ #
10
+
11
+ require "date"
12
+ require "time"
13
+
14
+ module Freeclimb
15
+ class ExportRequestOutput
16
+ attr_accessor :type
17
+
18
+ class EnumAttributeValidator
19
+ attr_reader :datatype
20
+ attr_reader :allowable_values
21
+
22
+ def initialize(datatype, allowable_values)
23
+ @allowable_values = allowable_values.map do |value|
24
+ case datatype.to_s
25
+ when /Integer/i
26
+ value.to_i
27
+ when /Float/i
28
+ value.to_f
29
+ else
30
+ value
31
+ end
32
+ end
33
+ end
34
+
35
+ def valid?(value)
36
+ !value || allowable_values.include?(value)
37
+ end
38
+ end
39
+
40
+ # Attribute mapping from ruby-style variable name to JSON key.
41
+ def self.attribute_map
42
+ {
43
+ type: :type
44
+ }
45
+ end
46
+
47
+ # Returns all the JSON keys this model knows about
48
+ def self.acceptable_attributes
49
+ attribute_map.values
50
+ end
51
+
52
+ # Attribute type mapping.
53
+ def self.openapi_types
54
+ {
55
+ type: :ExportOutputType
56
+ }
57
+ end
58
+
59
+ # List of attributes with nullable: true
60
+ def self.openapi_nullable
61
+ Set.new([])
62
+ end
63
+
64
+ # Initializes the object
65
+ # @param [Hash] attributes Model attributes in the form of hash
66
+ def initialize(attributes = {})
67
+ if !attributes.is_a?(Hash)
68
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Freeclimb::ExportRequestOutput` initialize method"
69
+ end
70
+
71
+ # check to see if the attribute exists and convert string to symbol for hash key
72
+ attributes = attributes.each_with_object({}) { |(k, v), h|
73
+ if !self.class.attribute_map.key?(k.to_sym)
74
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Freeclimb::ExportRequestOutput`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
75
+ end
76
+ h[k.to_sym] = v
77
+ }
78
+
79
+ if attributes.key?(:type)
80
+ self.type = attributes[:type]
81
+ end
82
+ end
83
+
84
+ # Show invalid properties with the reasons. Usually used together with valid?
85
+ # @return Array for valid properties with the reasons
86
+ def list_invalid_properties
87
+ invalid_properties = []
88
+ if @type.nil?
89
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
90
+ end
91
+
92
+ invalid_properties
93
+ end
94
+
95
+ # Check to see if the all the properties in the model are valid
96
+ # @return true if the model is valid
97
+ def valid?
98
+ if @type.nil?
99
+ false
100
+ else
101
+ list_invalid_properties.length == 0
102
+ end
103
+ end
104
+
105
+ # Checks equality by comparing each attribute.
106
+ # @param [Object] Object to be compared
107
+ def ==(other)
108
+ return true if equal?(other)
109
+ self.class == other.class &&
110
+ type == other.type
111
+ end
112
+
113
+ # @see the `==` method
114
+ # @param [Object] Object to be compared
115
+ def eql?(other)
116
+ self == other
117
+ end
118
+
119
+ # Calculates hash code according to all attributes.
120
+ # @return [Integer] Hash code
121
+ def hash
122
+ [type].hash
123
+ end
124
+
125
+ # Builds the object from hash
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ # @return [Object] Returns the model itself
128
+ def self.build_from_hash(attributes)
129
+ new.build_from_hash(attributes)
130
+ end
131
+
132
+ # Builds the object from hash
133
+ # @param [Hash] attributes Model attributes in the form of hash
134
+ # @return [Object] Returns the model itself
135
+ def build_from_hash(attributes)
136
+ return nil unless attributes.is_a?(Hash)
137
+ self.class.openapi_types.each_pair do |key, type|
138
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
139
+ send(:"#{key}=", nil)
140
+ elsif type =~ /\AArray<(.*)>/i
141
+ # check to ensure the input is an array given that the attribute
142
+ # is documented as an array but the input is not
143
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
144
+ send(:"#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
145
+ end
146
+ elsif !attributes[self.class.attribute_map[key]].nil?
147
+ send(:"#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
148
+ end
149
+ end
150
+
151
+ self
152
+ end
153
+
154
+ # Deserializes the data based on type
155
+ # @param string type Data type
156
+ # @param string value Value to be deserialized
157
+ # @return [Object] Deserialized data
158
+ def _deserialize(type, value)
159
+ case type.to_sym
160
+ when :Time
161
+ Time.parse(value)
162
+ when :Date
163
+ Date.parse(value)
164
+ when :String
165
+ value.to_s
166
+ when :Integer
167
+ value.to_i
168
+ when :Float
169
+ value.to_f
170
+ when :Boolean
171
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
172
+ true
173
+ else
174
+ false
175
+ end
176
+ when :Object
177
+ # generic object (usually a Hash), return directly
178
+ value
179
+ when /\AArray<(?<inner_type>.+)>\z/
180
+ inner_type = Regexp.last_match[:inner_type]
181
+ value.map { |v| _deserialize(inner_type, v) }
182
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
183
+ k_type = Regexp.last_match[:k_type]
184
+ v_type = Regexp.last_match[:v_type]
185
+ {}.tap do |hash|
186
+ value.each do |k, v|
187
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
188
+ end
189
+ end
190
+ else # model
191
+ # models (e.g. Pet) or oneOf
192
+ klass = Freeclimb.const_get(type)
193
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
194
+ end
195
+ end
196
+
197
+ # Returns the string representation of the object
198
+ # @return [String] String presentation of the object
199
+ def to_s
200
+ to_hash.to_s
201
+ end
202
+
203
+ # to_body is an alias to to_hash (backward compatibility)
204
+ # @return [Hash] Returns the object in the form of hash
205
+ def to_body
206
+ to_hash
207
+ end
208
+
209
+ # Returns the object in the form of hash
210
+ # @return [Hash] Returns the object in the form of hash
211
+ def to_hash
212
+ hash = {}
213
+ self.class.attribute_map.each_pair do |attr, param|
214
+ value = send(attr)
215
+ if value.nil?
216
+ is_nullable = self.class.openapi_nullable.include?(attr)
217
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
218
+ end
219
+
220
+ hash[param] = _to_hash(value)
221
+ end
222
+ hash
223
+ end
224
+
225
+ # Outputs non-array value in the form of hash
226
+ # For object, use to_hash. Otherwise, just return the value
227
+ # @param [Object] value Any valid value
228
+ # @return [Hash] Returns the value in the form of hash
229
+ def _to_hash(value)
230
+ if value.is_a?(Array)
231
+ value.compact.map { |v| _to_hash(v) }
232
+ elsif value.is_a?(Hash)
233
+ {}.tap do |hash|
234
+ value.each { |k, v| hash[k] = _to_hash(v) }
235
+ end
236
+ elsif value.respond_to? :to_hash
237
+ value.to_hash
238
+ else
239
+ value
240
+ end
241
+ end
242
+ end
243
+ end
@@ -0,0 +1,35 @@
1
+ # #FreeClimb API
2
+ #
3
+ # FreeClimb is a cloud-based application programming interface (API) that puts the power of the Vail platform in your hands. FreeClimb simplifies the process of creating applications that can use a full range of telephony features without requiring specialized or on-site telephony equipment. Using the FreeClimb REST API to write applications is easy! You have the option to use the language of your choice or hit the API directly. Your application can execute a command by issuing a RESTful request to the FreeClimb API. The base URL to send HTTP requests to the FreeClimb REST API is: /apiserver. FreeClimb authenticates and processes your request.
4
+ #
5
+ # The version of the OpenAPI document: 1.0.0
6
+ # Contact: support@freeclimb.com
7
+ # Generated by: https://openapi-generator.tech
8
+ # OpenAPI Generator version: 7.9.0
9
+ #
10
+
11
+ require "date"
12
+ require "time"
13
+
14
+ module Freeclimb
15
+ class ExportResourceType
16
+ MESSAGES = "Messages".freeze
17
+ CALLS = "Calls".freeze
18
+
19
+ # Builds the enum from string
20
+ # @param [String] The enum value in the form of the string
21
+ # @return [String] The enum value
22
+ def self.build_from_hash(value)
23
+ new.build_from_hash(value)
24
+ end
25
+
26
+ # Builds the enum from string
27
+ # @param [String] The enum value in the form of the string
28
+ # @return [String] The enum value
29
+ def build_from_hash(value)
30
+ constantValues = ExportResourceType.constants.select { |c| ExportResourceType.const_get(c) == value }
31
+ raise "Invalid ENUM value #{value} for class #ExportResourceType" if constantValues.empty?
32
+ value
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,405 @@
1
+ # #FreeClimb API
2
+ #
3
+ # FreeClimb is a cloud-based application programming interface (API) that puts the power of the Vail platform in your hands. FreeClimb simplifies the process of creating applications that can use a full range of telephony features without requiring specialized or on-site telephony equipment. Using the FreeClimb REST API to write applications is easy! You have the option to use the language of your choice or hit the API directly. Your application can execute a command by issuing a RESTful request to the FreeClimb API. The base URL to send HTTP requests to the FreeClimb REST API is: /apiserver. FreeClimb authenticates and processes your request.
4
+ #
5
+ # The version of the OpenAPI document: 1.0.0
6
+ # Contact: support@freeclimb.com
7
+ # Generated by: https://openapi-generator.tech
8
+ # OpenAPI Generator version: 7.9.0
9
+ #
10
+
11
+ require "date"
12
+ require "time"
13
+
14
+ module Freeclimb
15
+ class ExportResult
16
+ # String that uniquely identifies this account resource.
17
+ attr_accessor :account_id
18
+
19
+ attr_accessor :uri
20
+
21
+ attr_accessor :date_created
22
+
23
+ attr_accessor :date_updated
24
+
25
+ attr_accessor :revision
26
+
27
+ # String that uniquely identifies this export resource
28
+ attr_accessor :export_id
29
+
30
+ attr_accessor :status
31
+
32
+ attr_accessor :size
33
+
34
+ attr_accessor :resource_type
35
+
36
+ # Query params used to filter exported documents
37
+ attr_accessor :query
38
+
39
+ # Desired fields of exported documents
40
+ attr_accessor :format
41
+
42
+ attr_accessor :output
43
+
44
+ class EnumAttributeValidator
45
+ attr_reader :datatype
46
+ attr_reader :allowable_values
47
+
48
+ def initialize(datatype, allowable_values)
49
+ @allowable_values = allowable_values.map do |value|
50
+ case datatype.to_s
51
+ when /Integer/i
52
+ value.to_i
53
+ when /Float/i
54
+ value.to_f
55
+ else
56
+ value
57
+ end
58
+ end
59
+ end
60
+
61
+ def valid?(value)
62
+ !value || allowable_values.include?(value)
63
+ end
64
+ end
65
+
66
+ # Attribute mapping from ruby-style variable name to JSON key.
67
+ def self.attribute_map
68
+ {
69
+ account_id: :accountId,
70
+ uri: :uri,
71
+ date_created: :dateCreated,
72
+ date_updated: :dateUpdated,
73
+ revision: :revision,
74
+ export_id: :exportId,
75
+ status: :status,
76
+ size: :size,
77
+ resource_type: :resourceType,
78
+ query: :query,
79
+ format: :format,
80
+ output: :output
81
+ }
82
+ end
83
+
84
+ # Returns all the JSON keys this model knows about
85
+ def self.acceptable_attributes
86
+ attribute_map.values
87
+ end
88
+
89
+ # Attribute type mapping.
90
+ def self.openapi_types
91
+ {
92
+ account_id: :String,
93
+ uri: :String,
94
+ date_created: :String,
95
+ date_updated: :String,
96
+ revision: :Integer,
97
+ export_id: :String,
98
+ status: :ExportStatus,
99
+ size: :Integer,
100
+ resource_type: :ExportResourceType,
101
+ query: :Object,
102
+ format: :"Array<String>",
103
+ output: :ExportResultOutput
104
+ }
105
+ end
106
+
107
+ # List of attributes with nullable: true
108
+ def self.openapi_nullable
109
+ Set.new([
110
+ :account_id,
111
+ :export_id
112
+ ])
113
+ end
114
+
115
+ # Initializes the object
116
+ # @param [Hash] attributes Model attributes in the form of hash
117
+ def initialize(attributes = {})
118
+ if !attributes.is_a?(Hash)
119
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Freeclimb::ExportResult` initialize method"
120
+ end
121
+
122
+ # check to see if the attribute exists and convert string to symbol for hash key
123
+ attributes = attributes.each_with_object({}) { |(k, v), h|
124
+ if !self.class.attribute_map.key?(k.to_sym)
125
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Freeclimb::ExportResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
126
+ end
127
+ h[k.to_sym] = v
128
+ }
129
+
130
+ if attributes.key?(:account_id)
131
+ self.account_id = attributes[:account_id]
132
+ end
133
+
134
+ if attributes.key?(:uri)
135
+ self.uri = attributes[:uri]
136
+ end
137
+
138
+ if attributes.key?(:date_created)
139
+ self.date_created = attributes[:date_created]
140
+ end
141
+
142
+ if attributes.key?(:date_updated)
143
+ self.date_updated = attributes[:date_updated]
144
+ end
145
+
146
+ if attributes.key?(:revision)
147
+ self.revision = attributes[:revision]
148
+ end
149
+
150
+ if attributes.key?(:export_id)
151
+ self.export_id = attributes[:export_id]
152
+ end
153
+
154
+ if attributes.key?(:status)
155
+ self.status = attributes[:status]
156
+ end
157
+
158
+ if attributes.key?(:size)
159
+ self.size = attributes[:size]
160
+ end
161
+
162
+ if attributes.key?(:resource_type)
163
+ self.resource_type = attributes[:resource_type]
164
+ end
165
+
166
+ if attributes.key?(:query)
167
+ self.query = attributes[:query]
168
+ end
169
+
170
+ if attributes.key?(:format)
171
+ if (value = attributes[:format]).is_a?(Array)
172
+ self.format = value
173
+ end
174
+ end
175
+
176
+ if attributes.key?(:output)
177
+ self.output = attributes[:output]
178
+ end
179
+ end
180
+
181
+ # Show invalid properties with the reasons. Usually used together with valid?
182
+ # @return Array for valid properties with the reasons
183
+ def list_invalid_properties
184
+ invalid_properties = []
185
+ if @uri.nil?
186
+ invalid_properties.push('invalid value for "uri", uri cannot be nil.')
187
+ end
188
+
189
+ if @date_created.nil?
190
+ invalid_properties.push('invalid value for "date_created", date_created cannot be nil.')
191
+ end
192
+
193
+ if @date_updated.nil?
194
+ invalid_properties.push('invalid value for "date_updated", date_updated cannot be nil.')
195
+ end
196
+
197
+ if @revision.nil?
198
+ invalid_properties.push('invalid value for "revision", revision cannot be nil.')
199
+ end
200
+
201
+ if @revision < 0
202
+ invalid_properties.push('invalid value for "revision", must be greater than or equal to 0.')
203
+ end
204
+
205
+ if @status.nil?
206
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
207
+ end
208
+
209
+ if @size.nil?
210
+ invalid_properties.push('invalid value for "size", size cannot be nil.')
211
+ end
212
+
213
+ if @resource_type.nil?
214
+ invalid_properties.push('invalid value for "resource_type", resource_type cannot be nil.')
215
+ end
216
+
217
+ if @query.nil?
218
+ invalid_properties.push('invalid value for "query", query cannot be nil.')
219
+ end
220
+
221
+ if @format.nil?
222
+ invalid_properties.push('invalid value for "format", format cannot be nil.')
223
+ end
224
+
225
+ if @output.nil?
226
+ invalid_properties.push('invalid value for "output", output cannot be nil.')
227
+ end
228
+
229
+ invalid_properties
230
+ end
231
+
232
+ # Check to see if the all the properties in the model are valid
233
+ # @return true if the model is valid
234
+ def valid?
235
+ if @account_id.nil?
236
+ false
237
+ else
238
+ list_invalid_properties.length == 0
239
+ end
240
+ end
241
+
242
+ # Custom attribute writer method with validation
243
+ # @param [Object] revision Value to be assigned
244
+ def revision=(revision)
245
+ if revision.nil?
246
+ fail ArgumentError, "revision cannot be nil"
247
+ end
248
+
249
+ if revision < 0
250
+ fail ArgumentError, 'invalid value for "revision", must be greater than or equal to 0.'
251
+ end
252
+
253
+ @revision = revision
254
+ end
255
+
256
+ # Checks equality by comparing each attribute.
257
+ # @param [Object] Object to be compared
258
+ def ==(other)
259
+ return true if equal?(other)
260
+ self.class == other.class &&
261
+ account_id == other.account_id &&
262
+ uri == other.uri &&
263
+ date_created == other.date_created &&
264
+ date_updated == other.date_updated &&
265
+ revision == other.revision &&
266
+ export_id == other.export_id &&
267
+ status == other.status &&
268
+ size == other.size &&
269
+ resource_type == other.resource_type &&
270
+ query == other.query &&
271
+ format == other.format &&
272
+ output == other.output
273
+ end
274
+
275
+ # @see the `==` method
276
+ # @param [Object] Object to be compared
277
+ def eql?(other)
278
+ self == other
279
+ end
280
+
281
+ # Calculates hash code according to all attributes.
282
+ # @return [Integer] Hash code
283
+ def hash
284
+ [account_id, uri, date_created, date_updated, revision, export_id, status, size, resource_type, query, format, output].hash
285
+ end
286
+
287
+ # Builds the object from hash
288
+ # @param [Hash] attributes Model attributes in the form of hash
289
+ # @return [Object] Returns the model itself
290
+ def self.build_from_hash(attributes)
291
+ new.build_from_hash(attributes)
292
+ end
293
+
294
+ # Builds the object from hash
295
+ # @param [Hash] attributes Model attributes in the form of hash
296
+ # @return [Object] Returns the model itself
297
+ def build_from_hash(attributes)
298
+ return nil unless attributes.is_a?(Hash)
299
+ self.class.openapi_types.each_pair do |key, type|
300
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
301
+ send(:"#{key}=", nil)
302
+ elsif type =~ /\AArray<(.*)>/i
303
+ # check to ensure the input is an array given that the attribute
304
+ # is documented as an array but the input is not
305
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
306
+ send(:"#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
307
+ end
308
+ elsif !attributes[self.class.attribute_map[key]].nil?
309
+ send(:"#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
310
+ end
311
+ end
312
+
313
+ self
314
+ end
315
+
316
+ # Deserializes the data based on type
317
+ # @param string type Data type
318
+ # @param string value Value to be deserialized
319
+ # @return [Object] Deserialized data
320
+ def _deserialize(type, value)
321
+ case type.to_sym
322
+ when :Time
323
+ Time.parse(value)
324
+ when :Date
325
+ Date.parse(value)
326
+ when :String
327
+ value.to_s
328
+ when :Integer
329
+ value.to_i
330
+ when :Float
331
+ value.to_f
332
+ when :Boolean
333
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
334
+ true
335
+ else
336
+ false
337
+ end
338
+ when :Object
339
+ # generic object (usually a Hash), return directly
340
+ value
341
+ when /\AArray<(?<inner_type>.+)>\z/
342
+ inner_type = Regexp.last_match[:inner_type]
343
+ value.map { |v| _deserialize(inner_type, v) }
344
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
345
+ k_type = Regexp.last_match[:k_type]
346
+ v_type = Regexp.last_match[:v_type]
347
+ {}.tap do |hash|
348
+ value.each do |k, v|
349
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
350
+ end
351
+ end
352
+ else # model
353
+ # models (e.g. Pet) or oneOf
354
+ klass = Freeclimb.const_get(type)
355
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
356
+ end
357
+ end
358
+
359
+ # Returns the string representation of the object
360
+ # @return [String] String presentation of the object
361
+ def to_s
362
+ to_hash.to_s
363
+ end
364
+
365
+ # to_body is an alias to to_hash (backward compatibility)
366
+ # @return [Hash] Returns the object in the form of hash
367
+ def to_body
368
+ to_hash
369
+ end
370
+
371
+ # Returns the object in the form of hash
372
+ # @return [Hash] Returns the object in the form of hash
373
+ def to_hash
374
+ hash = {}
375
+ self.class.attribute_map.each_pair do |attr, param|
376
+ value = send(attr)
377
+ if value.nil?
378
+ is_nullable = self.class.openapi_nullable.include?(attr)
379
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
380
+ end
381
+
382
+ hash[param] = _to_hash(value)
383
+ end
384
+ hash
385
+ end
386
+
387
+ # Outputs non-array value in the form of hash
388
+ # For object, use to_hash. Otherwise, just return the value
389
+ # @param [Object] value Any valid value
390
+ # @return [Hash] Returns the value in the form of hash
391
+ def _to_hash(value)
392
+ if value.is_a?(Array)
393
+ value.compact.map { |v| _to_hash(v) }
394
+ elsif value.is_a?(Hash)
395
+ {}.tap do |hash|
396
+ value.each { |k, v| hash[k] = _to_hash(v) }
397
+ end
398
+ elsif value.respond_to? :to_hash
399
+ value.to_hash
400
+ else
401
+ value
402
+ end
403
+ end
404
+ end
405
+ end