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