sources-api-client 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/Gemfile.lock +70 -0
  4. data/LICENSE.txt +202 -0
  5. data/README.md +151 -0
  6. data/Rakefile +10 -0
  7. data/docs/Application.md +31 -0
  8. data/docs/ApplicationType.md +31 -0
  9. data/docs/ApplicationTypesCollection.md +21 -0
  10. data/docs/ApplicationsCollection.md +21 -0
  11. data/docs/Authentication.md +41 -0
  12. data/docs/AuthenticationExtra.md +17 -0
  13. data/docs/AuthenticationExtraAzure.md +17 -0
  14. data/docs/AuthenticationsCollection.md +21 -0
  15. data/docs/CollectionLinks.md +23 -0
  16. data/docs/CollectionMetadata.md +21 -0
  17. data/docs/DefaultApi.md +1945 -0
  18. data/docs/Endpoint.md +47 -0
  19. data/docs/EndpointsCollection.md +21 -0
  20. data/docs/ErrorNotFound.md +17 -0
  21. data/docs/ErrorNotFoundErrors.md +19 -0
  22. data/docs/GraphQLRequest.md +21 -0
  23. data/docs/GraphQLResponse.md +19 -0
  24. data/docs/Source.md +37 -0
  25. data/docs/SourceType.md +31 -0
  26. data/docs/SourceTypesCollection.md +21 -0
  27. data/docs/SourcesCollection.md +21 -0
  28. data/docs/Tenant.md +21 -0
  29. data/git_push.sh +58 -0
  30. data/lib/sources-api-client.rb +61 -0
  31. data/lib/sources-api-client/api/default_api.rb +2523 -0
  32. data/lib/sources-api-client/api_client.rb +386 -0
  33. data/lib/sources-api-client/api_error.rb +57 -0
  34. data/lib/sources-api-client/configuration.rb +268 -0
  35. data/lib/sources-api-client/models/application.rb +323 -0
  36. data/lib/sources-api-client/models/application_type.rb +287 -0
  37. data/lib/sources-api-client/models/application_types_collection.rb +226 -0
  38. data/lib/sources-api-client/models/applications_collection.rb +226 -0
  39. data/lib/sources-api-client/models/authentication.rb +350 -0
  40. data/lib/sources-api-client/models/authentication_extra.rb +206 -0
  41. data/lib/sources-api-client/models/authentication_extra_azure.rb +206 -0
  42. data/lib/sources-api-client/models/authentications_collection.rb +226 -0
  43. data/lib/sources-api-client/models/collection_links.rb +233 -0
  44. data/lib/sources-api-client/models/collection_metadata.rb +224 -0
  45. data/lib/sources-api-client/models/endpoint.rb +384 -0
  46. data/lib/sources-api-client/models/endpoints_collection.rb +226 -0
  47. data/lib/sources-api-client/models/error_not_found.rb +208 -0
  48. data/lib/sources-api-client/models/error_not_found_errors.rb +215 -0
  49. data/lib/sources-api-client/models/graph_ql_request.rb +237 -0
  50. data/lib/sources-api-client/models/graph_ql_response.rb +219 -0
  51. data/lib/sources-api-client/models/source.rb +332 -0
  52. data/lib/sources-api-client/models/source_type.rb +287 -0
  53. data/lib/sources-api-client/models/source_types_collection.rb +226 -0
  54. data/lib/sources-api-client/models/sources_collection.rb +226 -0
  55. data/lib/sources-api-client/models/tenant.rb +224 -0
  56. data/lib/sources-api-client/version.rb +15 -0
  57. data/pkg/sources-api-client-1.0.0.gem +0 -0
  58. data/sources-api-client.gemspec +39 -0
  59. data/spec/api/default_api_spec.rb +487 -0
  60. data/spec/api_client_spec.rb +226 -0
  61. data/spec/configuration_spec.rb +42 -0
  62. data/spec/models/application_spec.rb +83 -0
  63. data/spec/models/application_type_spec.rb +83 -0
  64. data/spec/models/application_types_collection_spec.rb +53 -0
  65. data/spec/models/applications_collection_spec.rb +53 -0
  66. data/spec/models/authentication_extra_azure_spec.rb +41 -0
  67. data/spec/models/authentication_extra_spec.rb +41 -0
  68. data/spec/models/authentication_spec.rb +113 -0
  69. data/spec/models/authentications_collection_spec.rb +53 -0
  70. data/spec/models/collection_links_spec.rb +59 -0
  71. data/spec/models/collection_metadata_spec.rb +53 -0
  72. data/spec/models/endpoint_spec.rb +131 -0
  73. data/spec/models/endpoints_collection_spec.rb +53 -0
  74. data/spec/models/error_not_found_errors_spec.rb +47 -0
  75. data/spec/models/error_not_found_spec.rb +41 -0
  76. data/spec/models/graph_ql_request_spec.rb +53 -0
  77. data/spec/models/graph_ql_response_spec.rb +47 -0
  78. data/spec/models/source_spec.rb +101 -0
  79. data/spec/models/source_type_spec.rb +83 -0
  80. data/spec/models/source_types_collection_spec.rb +53 -0
  81. data/spec/models/sources_collection_spec.rb +53 -0
  82. data/spec/models/tenant_spec.rb +53 -0
  83. data/spec/spec_helper.rb +111 -0
  84. metadata +210 -0
@@ -0,0 +1,323 @@
1
+ =begin
2
+ #Sources
3
+
4
+ #Sources
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: support@redhat.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module SourcesApiClient
16
+ class Application
17
+ # ID of the resource
18
+ attr_accessor :application_type_id
19
+
20
+ attr_accessor :availability_status
21
+
22
+ attr_accessor :availability_status_error
23
+
24
+ attr_accessor :created_at
25
+
26
+ # ID of the resource
27
+ attr_accessor :id
28
+
29
+ # ID of the resource
30
+ attr_accessor :source_id
31
+
32
+ attr_accessor :tenant
33
+
34
+ attr_accessor :updated_at
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'application_type_id' => :'application_type_id',
40
+ :'availability_status' => :'availability_status',
41
+ :'availability_status_error' => :'availability_status_error',
42
+ :'created_at' => :'created_at',
43
+ :'id' => :'id',
44
+ :'source_id' => :'source_id',
45
+ :'tenant' => :'tenant',
46
+ :'updated_at' => :'updated_at'
47
+ }
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.openapi_types
52
+ {
53
+ :'application_type_id' => :'String',
54
+ :'availability_status' => :'String',
55
+ :'availability_status_error' => :'String',
56
+ :'created_at' => :'DateTime',
57
+ :'id' => :'String',
58
+ :'source_id' => :'String',
59
+ :'tenant' => :'String',
60
+ :'updated_at' => :'DateTime'
61
+ }
62
+ end
63
+
64
+ # List of attributes with nullable: true
65
+ def self.openapi_nullable
66
+ Set.new([
67
+ ])
68
+ end
69
+
70
+ # Initializes the object
71
+ # @param [Hash] attributes Model attributes in the form of hash
72
+ def initialize(attributes = {})
73
+ if (!attributes.is_a?(Hash))
74
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SourcesApiClient::Application` initialize method"
75
+ end
76
+
77
+ # check to see if the attribute exists and convert string to symbol for hash key
78
+ attributes = attributes.each_with_object({}) { |(k, v), h|
79
+ if (!self.class.attribute_map.key?(k.to_sym))
80
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SourcesApiClient::Application`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
81
+ end
82
+ h[k.to_sym] = v
83
+ }
84
+
85
+ if attributes.key?(:'application_type_id')
86
+ self.application_type_id = attributes[:'application_type_id']
87
+ end
88
+
89
+ if attributes.key?(:'availability_status')
90
+ self.availability_status = attributes[:'availability_status']
91
+ end
92
+
93
+ if attributes.key?(:'availability_status_error')
94
+ self.availability_status_error = attributes[:'availability_status_error']
95
+ end
96
+
97
+ if attributes.key?(:'created_at')
98
+ self.created_at = attributes[:'created_at']
99
+ end
100
+
101
+ if attributes.key?(:'id')
102
+ self.id = attributes[:'id']
103
+ end
104
+
105
+ if attributes.key?(:'source_id')
106
+ self.source_id = attributes[:'source_id']
107
+ end
108
+
109
+ if attributes.key?(:'tenant')
110
+ self.tenant = attributes[:'tenant']
111
+ end
112
+
113
+ if attributes.key?(:'updated_at')
114
+ self.updated_at = attributes[:'updated_at']
115
+ end
116
+ end
117
+
118
+ # Show invalid properties with the reasons. Usually used together with valid?
119
+ # @return Array for valid properties with the reasons
120
+ def list_invalid_properties
121
+ invalid_properties = Array.new
122
+ pattern = Regexp.new(/^\d+$/)
123
+ if !@application_type_id.nil? && @application_type_id !~ pattern
124
+ invalid_properties.push("invalid value for \"application_type_id\", must conform to the pattern #{pattern}.")
125
+ end
126
+
127
+ pattern = Regexp.new(/^\d+$/)
128
+ if !@id.nil? && @id !~ pattern
129
+ invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.")
130
+ end
131
+
132
+ pattern = Regexp.new(/^\d+$/)
133
+ if !@source_id.nil? && @source_id !~ pattern
134
+ invalid_properties.push("invalid value for \"source_id\", must conform to the pattern #{pattern}.")
135
+ end
136
+
137
+ invalid_properties
138
+ end
139
+
140
+ # Check to see if the all the properties in the model are valid
141
+ # @return true if the model is valid
142
+ def valid?
143
+ return false if !@application_type_id.nil? && @application_type_id !~ Regexp.new(/^\d+$/)
144
+ return false if !@id.nil? && @id !~ Regexp.new(/^\d+$/)
145
+ return false if !@source_id.nil? && @source_id !~ Regexp.new(/^\d+$/)
146
+ true
147
+ end
148
+
149
+ # Custom attribute writer method with validation
150
+ # @param [Object] application_type_id Value to be assigned
151
+ def application_type_id=(application_type_id)
152
+ pattern = Regexp.new(/^\d+$/)
153
+ if !application_type_id.nil? && application_type_id !~ pattern
154
+ fail ArgumentError, "invalid value for \"application_type_id\", must conform to the pattern #{pattern}."
155
+ end
156
+
157
+ @application_type_id = application_type_id
158
+ end
159
+
160
+ # Custom attribute writer method with validation
161
+ # @param [Object] id Value to be assigned
162
+ def id=(id)
163
+ pattern = Regexp.new(/^\d+$/)
164
+ if !id.nil? && id !~ pattern
165
+ fail ArgumentError, "invalid value for \"id\", must conform to the pattern #{pattern}."
166
+ end
167
+
168
+ @id = id
169
+ end
170
+
171
+ # Custom attribute writer method with validation
172
+ # @param [Object] source_id Value to be assigned
173
+ def source_id=(source_id)
174
+ pattern = Regexp.new(/^\d+$/)
175
+ if !source_id.nil? && source_id !~ pattern
176
+ fail ArgumentError, "invalid value for \"source_id\", must conform to the pattern #{pattern}."
177
+ end
178
+
179
+ @source_id = source_id
180
+ end
181
+
182
+ # Checks equality by comparing each attribute.
183
+ # @param [Object] Object to be compared
184
+ def ==(o)
185
+ return true if self.equal?(o)
186
+ self.class == o.class &&
187
+ application_type_id == o.application_type_id &&
188
+ availability_status == o.availability_status &&
189
+ availability_status_error == o.availability_status_error &&
190
+ created_at == o.created_at &&
191
+ id == o.id &&
192
+ source_id == o.source_id &&
193
+ tenant == o.tenant &&
194
+ updated_at == o.updated_at
195
+ end
196
+
197
+ # @see the `==` method
198
+ # @param [Object] Object to be compared
199
+ def eql?(o)
200
+ self == o
201
+ end
202
+
203
+ # Calculates hash code according to all attributes.
204
+ # @return [Integer] Hash code
205
+ def hash
206
+ [application_type_id, availability_status, availability_status_error, created_at, id, source_id, tenant, updated_at].hash
207
+ end
208
+
209
+ # Builds the object from hash
210
+ # @param [Hash] attributes Model attributes in the form of hash
211
+ # @return [Object] Returns the model itself
212
+ def self.build_from_hash(attributes)
213
+ new.build_from_hash(attributes)
214
+ end
215
+
216
+ # Builds the object from hash
217
+ # @param [Hash] attributes Model attributes in the form of hash
218
+ # @return [Object] Returns the model itself
219
+ def build_from_hash(attributes)
220
+ return nil unless attributes.is_a?(Hash)
221
+ self.class.openapi_types.each_pair do |key, type|
222
+ if type =~ /\AArray<(.*)>/i
223
+ # check to ensure the input is an array given that the attribute
224
+ # is documented as an array but the input is not
225
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
226
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
227
+ end
228
+ elsif !attributes[self.class.attribute_map[key]].nil?
229
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
230
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
231
+ end
232
+
233
+ self
234
+ end
235
+
236
+ # Deserializes the data based on type
237
+ # @param string type Data type
238
+ # @param string value Value to be deserialized
239
+ # @return [Object] Deserialized data
240
+ def _deserialize(type, value)
241
+ case type.to_sym
242
+ when :DateTime
243
+ DateTime.parse(value)
244
+ when :Date
245
+ Date.parse(value)
246
+ when :String
247
+ value.to_s
248
+ when :Integer
249
+ value.to_i
250
+ when :Float
251
+ value.to_f
252
+ when :Boolean
253
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
254
+ true
255
+ else
256
+ false
257
+ end
258
+ when :Object
259
+ # generic object (usually a Hash), return directly
260
+ value
261
+ when /\AArray<(?<inner_type>.+)>\z/
262
+ inner_type = Regexp.last_match[:inner_type]
263
+ value.map { |v| _deserialize(inner_type, v) }
264
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
265
+ k_type = Regexp.last_match[:k_type]
266
+ v_type = Regexp.last_match[:v_type]
267
+ {}.tap do |hash|
268
+ value.each do |k, v|
269
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
270
+ end
271
+ end
272
+ else # model
273
+ SourcesApiClient.const_get(type).build_from_hash(value)
274
+ end
275
+ end
276
+
277
+ # Returns the string representation of the object
278
+ # @return [String] String presentation of the object
279
+ def to_s
280
+ to_hash.to_s
281
+ end
282
+
283
+ # to_body is an alias to to_hash (backward compatibility)
284
+ # @return [Hash] Returns the object in the form of hash
285
+ def to_body
286
+ to_hash
287
+ end
288
+
289
+ # Returns the object in the form of hash
290
+ # @return [Hash] Returns the object in the form of hash
291
+ def to_hash
292
+ hash = {}
293
+ self.class.attribute_map.each_pair do |attr, param|
294
+ value = self.send(attr)
295
+ if value.nil?
296
+ is_nullable = self.class.openapi_nullable.include?(attr)
297
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
298
+ end
299
+
300
+ hash[param] = _to_hash(value)
301
+ end
302
+ hash
303
+ end
304
+
305
+ # Outputs non-array value in the form of hash
306
+ # For object, use to_hash. Otherwise, just return the value
307
+ # @param [Object] value Any valid value
308
+ # @return [Hash] Returns the value in the form of hash
309
+ def _to_hash(value)
310
+ if value.is_a?(Array)
311
+ value.compact.map { |v| _to_hash(v) }
312
+ elsif value.is_a?(Hash)
313
+ {}.tap do |hash|
314
+ value.each { |k, v| hash[k] = _to_hash(v) }
315
+ end
316
+ elsif value.respond_to? :to_hash
317
+ value.to_hash
318
+ else
319
+ value
320
+ end
321
+ end
322
+ end
323
+ end
@@ -0,0 +1,287 @@
1
+ =begin
2
+ #Sources
3
+
4
+ #Sources
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: support@redhat.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module SourcesApiClient
16
+ class ApplicationType
17
+ attr_accessor :created_at
18
+
19
+ attr_accessor :dependent_applications
20
+
21
+ attr_accessor :display_name
22
+
23
+ # ID of the resource
24
+ attr_accessor :id
25
+
26
+ attr_accessor :name
27
+
28
+ attr_accessor :supported_authentication_types
29
+
30
+ attr_accessor :supported_source_types
31
+
32
+ attr_accessor :updated_at
33
+
34
+ # Attribute mapping from ruby-style variable name to JSON key.
35
+ def self.attribute_map
36
+ {
37
+ :'created_at' => :'created_at',
38
+ :'dependent_applications' => :'dependent_applications',
39
+ :'display_name' => :'display_name',
40
+ :'id' => :'id',
41
+ :'name' => :'name',
42
+ :'supported_authentication_types' => :'supported_authentication_types',
43
+ :'supported_source_types' => :'supported_source_types',
44
+ :'updated_at' => :'updated_at'
45
+ }
46
+ end
47
+
48
+ # Attribute type mapping.
49
+ def self.openapi_types
50
+ {
51
+ :'created_at' => :'DateTime',
52
+ :'dependent_applications' => :'Object',
53
+ :'display_name' => :'String',
54
+ :'id' => :'String',
55
+ :'name' => :'String',
56
+ :'supported_authentication_types' => :'Object',
57
+ :'supported_source_types' => :'Object',
58
+ :'updated_at' => :'DateTime'
59
+ }
60
+ end
61
+
62
+ # List of attributes with nullable: true
63
+ def self.openapi_nullable
64
+ Set.new([
65
+ ])
66
+ end
67
+
68
+ # Initializes the object
69
+ # @param [Hash] attributes Model attributes in the form of hash
70
+ def initialize(attributes = {})
71
+ if (!attributes.is_a?(Hash))
72
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SourcesApiClient::ApplicationType` initialize method"
73
+ end
74
+
75
+ # check to see if the attribute exists and convert string to symbol for hash key
76
+ attributes = attributes.each_with_object({}) { |(k, v), h|
77
+ if (!self.class.attribute_map.key?(k.to_sym))
78
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SourcesApiClient::ApplicationType`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
79
+ end
80
+ h[k.to_sym] = v
81
+ }
82
+
83
+ if attributes.key?(:'created_at')
84
+ self.created_at = attributes[:'created_at']
85
+ end
86
+
87
+ if attributes.key?(:'dependent_applications')
88
+ self.dependent_applications = attributes[:'dependent_applications']
89
+ end
90
+
91
+ if attributes.key?(:'display_name')
92
+ self.display_name = attributes[:'display_name']
93
+ end
94
+
95
+ if attributes.key?(:'id')
96
+ self.id = attributes[:'id']
97
+ end
98
+
99
+ if attributes.key?(:'name')
100
+ self.name = attributes[:'name']
101
+ end
102
+
103
+ if attributes.key?(:'supported_authentication_types')
104
+ self.supported_authentication_types = attributes[:'supported_authentication_types']
105
+ end
106
+
107
+ if attributes.key?(:'supported_source_types')
108
+ self.supported_source_types = attributes[:'supported_source_types']
109
+ end
110
+
111
+ if attributes.key?(:'updated_at')
112
+ self.updated_at = attributes[:'updated_at']
113
+ end
114
+ end
115
+
116
+ # Show invalid properties with the reasons. Usually used together with valid?
117
+ # @return Array for valid properties with the reasons
118
+ def list_invalid_properties
119
+ invalid_properties = Array.new
120
+ pattern = Regexp.new(/^\d+$/)
121
+ if !@id.nil? && @id !~ pattern
122
+ invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.")
123
+ end
124
+
125
+ invalid_properties
126
+ end
127
+
128
+ # Check to see if the all the properties in the model are valid
129
+ # @return true if the model is valid
130
+ def valid?
131
+ return false if !@id.nil? && @id !~ Regexp.new(/^\d+$/)
132
+ true
133
+ end
134
+
135
+ # Custom attribute writer method with validation
136
+ # @param [Object] id Value to be assigned
137
+ def id=(id)
138
+ pattern = Regexp.new(/^\d+$/)
139
+ if !id.nil? && id !~ pattern
140
+ fail ArgumentError, "invalid value for \"id\", must conform to the pattern #{pattern}."
141
+ end
142
+
143
+ @id = id
144
+ end
145
+
146
+ # Checks equality by comparing each attribute.
147
+ # @param [Object] Object to be compared
148
+ def ==(o)
149
+ return true if self.equal?(o)
150
+ self.class == o.class &&
151
+ created_at == o.created_at &&
152
+ dependent_applications == o.dependent_applications &&
153
+ display_name == o.display_name &&
154
+ id == o.id &&
155
+ name == o.name &&
156
+ supported_authentication_types == o.supported_authentication_types &&
157
+ supported_source_types == o.supported_source_types &&
158
+ updated_at == o.updated_at
159
+ end
160
+
161
+ # @see the `==` method
162
+ # @param [Object] Object to be compared
163
+ def eql?(o)
164
+ self == o
165
+ end
166
+
167
+ # Calculates hash code according to all attributes.
168
+ # @return [Integer] Hash code
169
+ def hash
170
+ [created_at, dependent_applications, display_name, id, name, supported_authentication_types, supported_source_types, updated_at].hash
171
+ end
172
+
173
+ # Builds the object from hash
174
+ # @param [Hash] attributes Model attributes in the form of hash
175
+ # @return [Object] Returns the model itself
176
+ def self.build_from_hash(attributes)
177
+ new.build_from_hash(attributes)
178
+ end
179
+
180
+ # Builds the object from hash
181
+ # @param [Hash] attributes Model attributes in the form of hash
182
+ # @return [Object] Returns the model itself
183
+ def build_from_hash(attributes)
184
+ return nil unless attributes.is_a?(Hash)
185
+ self.class.openapi_types.each_pair do |key, type|
186
+ if type =~ /\AArray<(.*)>/i
187
+ # check to ensure the input is an array given that the attribute
188
+ # is documented as an array but the input is not
189
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
190
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
191
+ end
192
+ elsif !attributes[self.class.attribute_map[key]].nil?
193
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
194
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
195
+ end
196
+
197
+ self
198
+ end
199
+
200
+ # Deserializes the data based on type
201
+ # @param string type Data type
202
+ # @param string value Value to be deserialized
203
+ # @return [Object] Deserialized data
204
+ def _deserialize(type, value)
205
+ case type.to_sym
206
+ when :DateTime
207
+ DateTime.parse(value)
208
+ when :Date
209
+ Date.parse(value)
210
+ when :String
211
+ value.to_s
212
+ when :Integer
213
+ value.to_i
214
+ when :Float
215
+ value.to_f
216
+ when :Boolean
217
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
218
+ true
219
+ else
220
+ false
221
+ end
222
+ when :Object
223
+ # generic object (usually a Hash), return directly
224
+ value
225
+ when /\AArray<(?<inner_type>.+)>\z/
226
+ inner_type = Regexp.last_match[:inner_type]
227
+ value.map { |v| _deserialize(inner_type, v) }
228
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
229
+ k_type = Regexp.last_match[:k_type]
230
+ v_type = Regexp.last_match[:v_type]
231
+ {}.tap do |hash|
232
+ value.each do |k, v|
233
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
234
+ end
235
+ end
236
+ else # model
237
+ SourcesApiClient.const_get(type).build_from_hash(value)
238
+ end
239
+ end
240
+
241
+ # Returns the string representation of the object
242
+ # @return [String] String presentation of the object
243
+ def to_s
244
+ to_hash.to_s
245
+ end
246
+
247
+ # to_body is an alias to to_hash (backward compatibility)
248
+ # @return [Hash] Returns the object in the form of hash
249
+ def to_body
250
+ to_hash
251
+ end
252
+
253
+ # Returns the object in the form of hash
254
+ # @return [Hash] Returns the object in the form of hash
255
+ def to_hash
256
+ hash = {}
257
+ self.class.attribute_map.each_pair do |attr, param|
258
+ value = self.send(attr)
259
+ if value.nil?
260
+ is_nullable = self.class.openapi_nullable.include?(attr)
261
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
262
+ end
263
+
264
+ hash[param] = _to_hash(value)
265
+ end
266
+ hash
267
+ end
268
+
269
+ # Outputs non-array value in the form of hash
270
+ # For object, use to_hash. Otherwise, just return the value
271
+ # @param [Object] value Any valid value
272
+ # @return [Hash] Returns the value in the form of hash
273
+ def _to_hash(value)
274
+ if value.is_a?(Array)
275
+ value.compact.map { |v| _to_hash(v) }
276
+ elsif value.is_a?(Hash)
277
+ {}.tap do |hash|
278
+ value.each { |k, v| hash[k] = _to_hash(v) }
279
+ end
280
+ elsif value.respond_to? :to_hash
281
+ value.to_hash
282
+ else
283
+ value
284
+ end
285
+ end
286
+ end
287
+ end