zest 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/README.md +185 -0
  4. data/Rakefile +8 -0
  5. data/api.json +1 -0
  6. data/config.json +6 -0
  7. data/docs/Artifact.md +17 -0
  8. data/docs/AsyncOperationResponse.md +8 -0
  9. data/docs/Distribution.md +16 -0
  10. data/docs/FileContent.md +12 -0
  11. data/docs/FilePublisher.md +14 -0
  12. data/docs/FileRemote.md +23 -0
  13. data/docs/InlineResponse200.md +11 -0
  14. data/docs/InlineResponse2001.md +11 -0
  15. data/docs/InlineResponse20010.md +11 -0
  16. data/docs/InlineResponse2002.md +11 -0
  17. data/docs/InlineResponse2003.md +11 -0
  18. data/docs/InlineResponse2004.md +11 -0
  19. data/docs/InlineResponse2005.md +11 -0
  20. data/docs/InlineResponse2006.md +11 -0
  21. data/docs/InlineResponse2007.md +11 -0
  22. data/docs/InlineResponse2008.md +11 -0
  23. data/docs/InlineResponse2009.md +11 -0
  24. data/docs/ProgressReport.md +13 -0
  25. data/docs/Publication.md +13 -0
  26. data/docs/PulpApi.md +3056 -0
  27. data/docs/Repository.md +13 -0
  28. data/docs/RepositoryPublishURL.md +9 -0
  29. data/docs/RepositorySyncURL.md +9 -0
  30. data/docs/RepositoryVersion.md +17 -0
  31. data/docs/RepositoryVersionCreate.md +10 -0
  32. data/docs/Task.md +21 -0
  33. data/docs/User.md +11 -0
  34. data/docs/Worker.md +13 -0
  35. data/git_push.sh +55 -0
  36. data/katello_pulp_api-0.0.1.gem +0 -0
  37. data/katello_pulp_api.gemspec +46 -0
  38. data/lib/katello_pulp_api.rb +67 -0
  39. data/lib/katello_pulp_api/api/pulp_api.rb +3277 -0
  40. data/lib/katello_pulp_api/api_client.rb +389 -0
  41. data/lib/katello_pulp_api/api_error.rb +38 -0
  42. data/lib/katello_pulp_api/configuration.rb +209 -0
  43. data/lib/katello_pulp_api/models/artifact.rb +278 -0
  44. data/lib/katello_pulp_api/models/async_operation_response.rb +194 -0
  45. data/lib/katello_pulp_api/models/distribution.rb +350 -0
  46. data/lib/katello_pulp_api/models/file_content.rb +272 -0
  47. data/lib/katello_pulp_api/models/file_publisher.rb +306 -0
  48. data/lib/katello_pulp_api/models/file_remote.rb +452 -0
  49. data/lib/katello_pulp_api/models/inline_response_200.rb +227 -0
  50. data/lib/katello_pulp_api/models/inline_response_200_1.rb +227 -0
  51. data/lib/katello_pulp_api/models/inline_response_200_10.rb +227 -0
  52. data/lib/katello_pulp_api/models/inline_response_200_2.rb +227 -0
  53. data/lib/katello_pulp_api/models/inline_response_200_3.rb +227 -0
  54. data/lib/katello_pulp_api/models/inline_response_200_4.rb +227 -0
  55. data/lib/katello_pulp_api/models/inline_response_200_5.rb +227 -0
  56. data/lib/katello_pulp_api/models/inline_response_200_6.rb +227 -0
  57. data/lib/katello_pulp_api/models/inline_response_200_7.rb +227 -0
  58. data/lib/katello_pulp_api/models/inline_response_200_8.rb +227 -0
  59. data/lib/katello_pulp_api/models/inline_response_200_9.rb +227 -0
  60. data/lib/katello_pulp_api/models/progress_report.rb +271 -0
  61. data/lib/katello_pulp_api/models/publication.rb +249 -0
  62. data/lib/katello_pulp_api/models/repository.rb +260 -0
  63. data/lib/katello_pulp_api/models/repository_publish_url.rb +199 -0
  64. data/lib/katello_pulp_api/models/repository_sync_url.rb +206 -0
  65. data/lib/katello_pulp_api/models/repository_version.rb +277 -0
  66. data/lib/katello_pulp_api/models/repository_version_create.rb +223 -0
  67. data/lib/katello_pulp_api/models/task.rb +363 -0
  68. data/lib/katello_pulp_api/models/user.rb +284 -0
  69. data/lib/katello_pulp_api/models/worker.rb +254 -0
  70. data/lib/katello_pulp_api/version.rb +15 -0
  71. data/lib/zest.rb +67 -0
  72. data/lib/zest/api/pulp_api.rb +3277 -0
  73. data/lib/zest/api_client.rb +389 -0
  74. data/lib/zest/api_error.rb +38 -0
  75. data/lib/zest/configuration.rb +209 -0
  76. data/lib/zest/models/artifact.rb +278 -0
  77. data/lib/zest/models/async_operation_response.rb +194 -0
  78. data/lib/zest/models/distribution.rb +350 -0
  79. data/lib/zest/models/file_content.rb +272 -0
  80. data/lib/zest/models/file_publisher.rb +306 -0
  81. data/lib/zest/models/file_remote.rb +452 -0
  82. data/lib/zest/models/inline_response_200.rb +227 -0
  83. data/lib/zest/models/inline_response_200_1.rb +227 -0
  84. data/lib/zest/models/inline_response_200_10.rb +227 -0
  85. data/lib/zest/models/inline_response_200_2.rb +227 -0
  86. data/lib/zest/models/inline_response_200_3.rb +227 -0
  87. data/lib/zest/models/inline_response_200_4.rb +227 -0
  88. data/lib/zest/models/inline_response_200_5.rb +227 -0
  89. data/lib/zest/models/inline_response_200_6.rb +227 -0
  90. data/lib/zest/models/inline_response_200_7.rb +227 -0
  91. data/lib/zest/models/inline_response_200_8.rb +227 -0
  92. data/lib/zest/models/inline_response_200_9.rb +227 -0
  93. data/lib/zest/models/progress_report.rb +271 -0
  94. data/lib/zest/models/publication.rb +249 -0
  95. data/lib/zest/models/repository.rb +260 -0
  96. data/lib/zest/models/repository_publish_url.rb +199 -0
  97. data/lib/zest/models/repository_sync_url.rb +206 -0
  98. data/lib/zest/models/repository_version.rb +277 -0
  99. data/lib/zest/models/repository_version_create.rb +223 -0
  100. data/lib/zest/models/task.rb +363 -0
  101. data/lib/zest/models/user.rb +284 -0
  102. data/lib/zest/models/worker.rb +254 -0
  103. data/lib/zest/version.rb +15 -0
  104. data/spec/api/pulp_api_spec.rb +784 -0
  105. data/spec/api_client_spec.rb +226 -0
  106. data/spec/configuration_spec.rb +42 -0
  107. data/spec/models/artifact_spec.rb +96 -0
  108. data/spec/models/async_operation_response_spec.rb +42 -0
  109. data/spec/models/distribution_spec.rb +90 -0
  110. data/spec/models/file_content_spec.rb +66 -0
  111. data/spec/models/file_publisher_spec.rb +78 -0
  112. data/spec/models/file_remote_spec.rb +136 -0
  113. data/spec/models/inline_response_200_10_spec.rb +60 -0
  114. data/spec/models/inline_response_200_1_spec.rb +60 -0
  115. data/spec/models/inline_response_200_2_spec.rb +60 -0
  116. data/spec/models/inline_response_200_3_spec.rb +60 -0
  117. data/spec/models/inline_response_200_4_spec.rb +60 -0
  118. data/spec/models/inline_response_200_5_spec.rb +60 -0
  119. data/spec/models/inline_response_200_6_spec.rb +60 -0
  120. data/spec/models/inline_response_200_7_spec.rb +60 -0
  121. data/spec/models/inline_response_200_8_spec.rb +60 -0
  122. data/spec/models/inline_response_200_9_spec.rb +60 -0
  123. data/spec/models/inline_response_200_spec.rb +60 -0
  124. data/spec/models/progress_report_spec.rb +72 -0
  125. data/spec/models/publication_spec.rb +72 -0
  126. data/spec/models/repository_publish_url_spec.rb +48 -0
  127. data/spec/models/repository_spec.rb +72 -0
  128. data/spec/models/repository_sync_url_spec.rb +48 -0
  129. data/spec/models/repository_version_create_spec.rb +54 -0
  130. data/spec/models/repository_version_spec.rb +96 -0
  131. data/spec/models/task_spec.rb +120 -0
  132. data/spec/models/user_spec.rb +60 -0
  133. data/spec/models/worker_spec.rb +72 -0
  134. data/spec/spec_helper.rb +111 -0
  135. data/zest.gemspec +46 -0
  136. metadata +391 -0
@@ -0,0 +1,350 @@
1
+ =begin
2
+ #Pulp3 API
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: v3
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module KatelloPulpApi
16
+
17
+ class Distribution
18
+ attr_accessor :_href
19
+
20
+ # Timestamp of creation.
21
+ attr_accessor :_created
22
+
23
+ # A unique distribution name. Ex, `rawhide` and `stable`.
24
+ attr_accessor :name
25
+
26
+ # The base (relative) path component of the published url. Avoid paths that overlap with other distribution base paths (e.g. \"foo\" and \"foo/bar\")
27
+ attr_accessor :base_path
28
+
29
+ # Publications created by this publisher and repository are automaticallyserved as defined by this distribution
30
+ attr_accessor :publisher
31
+
32
+ # The publication being served as defined by this distribution
33
+ attr_accessor :publication
34
+
35
+ # The URL for accessing the publication as defined by this distribution.
36
+ attr_accessor :base_url
37
+
38
+ # Publications created by this repository and publisher are automaticallyserved as defined by this distribution
39
+ attr_accessor :repository
40
+
41
+ # An optional content-guard.
42
+ attr_accessor :content_guard
43
+
44
+
45
+ # Attribute mapping from ruby-style variable name to JSON key.
46
+ def self.attribute_map
47
+ {
48
+ :'_href' => :'_href',
49
+ :'_created' => :'_created',
50
+ :'name' => :'name',
51
+ :'base_path' => :'base_path',
52
+ :'publisher' => :'publisher',
53
+ :'publication' => :'publication',
54
+ :'base_url' => :'base_url',
55
+ :'repository' => :'repository',
56
+ :'content_guard' => :'content_guard'
57
+ }
58
+ end
59
+
60
+ # Attribute type mapping.
61
+ def self.swagger_types
62
+ {
63
+ :'_href' => :'String',
64
+ :'_created' => :'DateTime',
65
+ :'name' => :'String',
66
+ :'base_path' => :'String',
67
+ :'publisher' => :'String',
68
+ :'publication' => :'String',
69
+ :'base_url' => :'String',
70
+ :'repository' => :'String',
71
+ :'content_guard' => :'String'
72
+ }
73
+ end
74
+
75
+ # Initializes the object
76
+ # @param [Hash] attributes Model attributes in the form of hash
77
+ def initialize(attributes = {})
78
+ return unless attributes.is_a?(Hash)
79
+
80
+ # convert string to symbol for hash key
81
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
82
+
83
+ if attributes.has_key?(:'_href')
84
+ self._href = attributes[:'_href']
85
+ end
86
+
87
+ if attributes.has_key?(:'_created')
88
+ self._created = attributes[:'_created']
89
+ end
90
+
91
+ if attributes.has_key?(:'name')
92
+ self.name = attributes[:'name']
93
+ end
94
+
95
+ if attributes.has_key?(:'base_path')
96
+ self.base_path = attributes[:'base_path']
97
+ end
98
+
99
+ if attributes.has_key?(:'publisher')
100
+ self.publisher = attributes[:'publisher']
101
+ end
102
+
103
+ if attributes.has_key?(:'publication')
104
+ self.publication = attributes[:'publication']
105
+ end
106
+
107
+ if attributes.has_key?(:'base_url')
108
+ self.base_url = attributes[:'base_url']
109
+ end
110
+
111
+ if attributes.has_key?(:'repository')
112
+ self.repository = attributes[:'repository']
113
+ end
114
+
115
+ if attributes.has_key?(:'content_guard')
116
+ self.content_guard = attributes[:'content_guard']
117
+ end
118
+
119
+ end
120
+
121
+ # Show invalid properties with the reasons. Usually used together with valid?
122
+ # @return Array for valid properties with the reasons
123
+ def list_invalid_properties
124
+ invalid_properties = Array.new
125
+ if @name.nil?
126
+ invalid_properties.push("invalid value for 'name', name cannot be nil.")
127
+ end
128
+
129
+ if @name.to_s.length > 255
130
+ invalid_properties.push("invalid value for 'name', the character length must be smaller than or equal to 255.")
131
+ end
132
+
133
+ if @name.to_s.length < 1
134
+ invalid_properties.push("invalid value for 'name', the character length must be great than or equal to 1.")
135
+ end
136
+
137
+ if @base_path.nil?
138
+ invalid_properties.push("invalid value for 'base_path', base_path cannot be nil.")
139
+ end
140
+
141
+ if @base_path.to_s.length > 255
142
+ invalid_properties.push("invalid value for 'base_path', the character length must be smaller than or equal to 255.")
143
+ end
144
+
145
+ if @base_path.to_s.length < 1
146
+ invalid_properties.push("invalid value for 'base_path', the character length must be great than or equal to 1.")
147
+ end
148
+
149
+ if !@base_url.nil? && @base_url.to_s.length < 1
150
+ invalid_properties.push("invalid value for 'base_url', the character length must be great than or equal to 1.")
151
+ end
152
+
153
+ return invalid_properties
154
+ end
155
+
156
+ # Check to see if the all the properties in the model are valid
157
+ # @return true if the model is valid
158
+ def valid?
159
+ return false if @name.nil?
160
+ return false if @name.to_s.length > 255
161
+ return false if @name.to_s.length < 1
162
+ return false if @base_path.nil?
163
+ return false if @base_path.to_s.length > 255
164
+ return false if @base_path.to_s.length < 1
165
+ return false if !@base_url.nil? && @base_url.to_s.length < 1
166
+ return true
167
+ end
168
+
169
+ # Custom attribute writer method with validation
170
+ # @param [Object] name Value to be assigned
171
+ def name=(name)
172
+ if name.nil?
173
+ fail ArgumentError, "name cannot be nil"
174
+ end
175
+
176
+ if name.to_s.length > 255
177
+ fail ArgumentError, "invalid value for 'name', the character length must be smaller than or equal to 255."
178
+ end
179
+
180
+ if name.to_s.length < 1
181
+ fail ArgumentError, "invalid value for 'name', the character length must be great than or equal to 1."
182
+ end
183
+
184
+ @name = name
185
+ end
186
+
187
+ # Custom attribute writer method with validation
188
+ # @param [Object] base_path Value to be assigned
189
+ def base_path=(base_path)
190
+ if base_path.nil?
191
+ fail ArgumentError, "base_path cannot be nil"
192
+ end
193
+
194
+ if base_path.to_s.length > 255
195
+ fail ArgumentError, "invalid value for 'base_path', the character length must be smaller than or equal to 255."
196
+ end
197
+
198
+ if base_path.to_s.length < 1
199
+ fail ArgumentError, "invalid value for 'base_path', the character length must be great than or equal to 1."
200
+ end
201
+
202
+ @base_path = base_path
203
+ end
204
+
205
+ # Custom attribute writer method with validation
206
+ # @param [Object] base_url Value to be assigned
207
+ def base_url=(base_url)
208
+
209
+ if !base_url.nil? && base_url.to_s.length < 1
210
+ fail ArgumentError, "invalid value for 'base_url', the character length must be great than or equal to 1."
211
+ end
212
+
213
+ @base_url = base_url
214
+ end
215
+
216
+ # Checks equality by comparing each attribute.
217
+ # @param [Object] Object to be compared
218
+ def ==(o)
219
+ return true if self.equal?(o)
220
+ self.class == o.class &&
221
+ _href == o._href &&
222
+ _created == o._created &&
223
+ name == o.name &&
224
+ base_path == o.base_path &&
225
+ publisher == o.publisher &&
226
+ publication == o.publication &&
227
+ base_url == o.base_url &&
228
+ repository == o.repository &&
229
+ content_guard == o.content_guard
230
+ end
231
+
232
+ # @see the `==` method
233
+ # @param [Object] Object to be compared
234
+ def eql?(o)
235
+ self == o
236
+ end
237
+
238
+ # Calculates hash code according to all attributes.
239
+ # @return [Fixnum] Hash code
240
+ def hash
241
+ [_href, _created, name, base_path, publisher, publication, base_url, repository, content_guard].hash
242
+ end
243
+
244
+ # Builds the object from hash
245
+ # @param [Hash] attributes Model attributes in the form of hash
246
+ # @return [Object] Returns the model itself
247
+ def build_from_hash(attributes)
248
+ return nil unless attributes.is_a?(Hash)
249
+ self.class.swagger_types.each_pair do |key, type|
250
+ if type =~ /\AArray<(.*)>/i
251
+ # check to ensure the input is an array given that the the attribute
252
+ # is documented as an array but the input is not
253
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
254
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
255
+ end
256
+ elsif !attributes[self.class.attribute_map[key]].nil?
257
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
258
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
259
+ end
260
+
261
+ self
262
+ end
263
+
264
+ # Deserializes the data based on type
265
+ # @param string type Data type
266
+ # @param string value Value to be deserialized
267
+ # @return [Object] Deserialized data
268
+ def _deserialize(type, value)
269
+ case type.to_sym
270
+ when :DateTime
271
+ DateTime.parse(value)
272
+ when :Date
273
+ Date.parse(value)
274
+ when :String
275
+ value.to_s
276
+ when :Integer
277
+ value.to_i
278
+ when :Float
279
+ value.to_f
280
+ when :BOOLEAN
281
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
282
+ true
283
+ else
284
+ false
285
+ end
286
+ when :Object
287
+ # generic object (usually a Hash), return directly
288
+ value
289
+ when /\AArray<(?<inner_type>.+)>\z/
290
+ inner_type = Regexp.last_match[:inner_type]
291
+ value.map { |v| _deserialize(inner_type, v) }
292
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
293
+ k_type = Regexp.last_match[:k_type]
294
+ v_type = Regexp.last_match[:v_type]
295
+ {}.tap do |hash|
296
+ value.each do |k, v|
297
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
298
+ end
299
+ end
300
+ else # model
301
+ temp_model = KatelloPulpApi.const_get(type).new
302
+ temp_model.build_from_hash(value)
303
+ end
304
+ end
305
+
306
+ # Returns the string representation of the object
307
+ # @return [String] String presentation of the object
308
+ def to_s
309
+ to_hash.to_s
310
+ end
311
+
312
+ # to_body is an alias to to_hash (backward compatibility)
313
+ # @return [Hash] Returns the object in the form of hash
314
+ def to_body
315
+ to_hash
316
+ end
317
+
318
+ # Returns the object in the form of hash
319
+ # @return [Hash] Returns the object in the form of hash
320
+ def to_hash
321
+ hash = {}
322
+ self.class.attribute_map.each_pair do |attr, param|
323
+ value = self.send(attr)
324
+ next if value.nil?
325
+ hash[param] = _to_hash(value)
326
+ end
327
+ hash
328
+ end
329
+
330
+ # Outputs non-array value in the form of hash
331
+ # For object, use to_hash. Otherwise, just return the value
332
+ # @param [Object] value Any valid value
333
+ # @return [Hash] Returns the value in the form of hash
334
+ def _to_hash(value)
335
+ if value.is_a?(Array)
336
+ value.compact.map{ |v| _to_hash(v) }
337
+ elsif value.is_a?(Hash)
338
+ {}.tap do |hash|
339
+ value.each { |k, v| hash[k] = _to_hash(v) }
340
+ end
341
+ elsif value.respond_to? :to_hash
342
+ value.to_hash
343
+ else
344
+ value
345
+ end
346
+ end
347
+
348
+ end
349
+
350
+ end
@@ -0,0 +1,272 @@
1
+ =begin
2
+ #Pulp3 API
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: v3
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module KatelloPulpApi
16
+
17
+ class FileContent
18
+ attr_accessor :_href
19
+
20
+ # Timestamp of creation.
21
+ attr_accessor :_created
22
+
23
+ attr_accessor :_type
24
+
25
+ # Artifact file representing the physical content
26
+ attr_accessor :_artifact
27
+
28
+ # Relative location of the file within the repository
29
+ attr_accessor :relative_path
30
+
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'_href' => :'_href',
36
+ :'_created' => :'_created',
37
+ :'_type' => :'_type',
38
+ :'_artifact' => :'_artifact',
39
+ :'relative_path' => :'relative_path'
40
+ }
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.swagger_types
45
+ {
46
+ :'_href' => :'String',
47
+ :'_created' => :'DateTime',
48
+ :'_type' => :'String',
49
+ :'_artifact' => :'String',
50
+ :'relative_path' => :'String'
51
+ }
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ return unless attributes.is_a?(Hash)
58
+
59
+ # convert string to symbol for hash key
60
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
61
+
62
+ if attributes.has_key?(:'_href')
63
+ self._href = attributes[:'_href']
64
+ end
65
+
66
+ if attributes.has_key?(:'_created')
67
+ self._created = attributes[:'_created']
68
+ end
69
+
70
+ if attributes.has_key?(:'_type')
71
+ self._type = attributes[:'_type']
72
+ end
73
+
74
+ if attributes.has_key?(:'_artifact')
75
+ self._artifact = attributes[:'_artifact']
76
+ end
77
+
78
+ if attributes.has_key?(:'relative_path')
79
+ self.relative_path = attributes[:'relative_path']
80
+ end
81
+
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 = Array.new
88
+ if !@_type.nil? && @_type.to_s.length < 1
89
+ invalid_properties.push("invalid value for '_type', the character length must be great than or equal to 1.")
90
+ end
91
+
92
+ if @_artifact.nil?
93
+ invalid_properties.push("invalid value for '_artifact', _artifact cannot be nil.")
94
+ end
95
+
96
+ if @relative_path.nil?
97
+ invalid_properties.push("invalid value for 'relative_path', relative_path cannot be nil.")
98
+ end
99
+
100
+ if @relative_path.to_s.length < 1
101
+ invalid_properties.push("invalid value for 'relative_path', the character length must be great than or equal to 1.")
102
+ end
103
+
104
+ return invalid_properties
105
+ end
106
+
107
+ # Check to see if the all the properties in the model are valid
108
+ # @return true if the model is valid
109
+ def valid?
110
+ return false if !@_type.nil? && @_type.to_s.length < 1
111
+ return false if @_artifact.nil?
112
+ return false if @relative_path.nil?
113
+ return false if @relative_path.to_s.length < 1
114
+ return true
115
+ end
116
+
117
+ # Custom attribute writer method with validation
118
+ # @param [Object] _type Value to be assigned
119
+ def _type=(_type)
120
+
121
+ if !_type.nil? && _type.to_s.length < 1
122
+ fail ArgumentError, "invalid value for '_type', the character length must be great than or equal to 1."
123
+ end
124
+
125
+ @_type = _type
126
+ end
127
+
128
+ # Custom attribute writer method with validation
129
+ # @param [Object] relative_path Value to be assigned
130
+ def relative_path=(relative_path)
131
+ if relative_path.nil?
132
+ fail ArgumentError, "relative_path cannot be nil"
133
+ end
134
+
135
+ if relative_path.to_s.length < 1
136
+ fail ArgumentError, "invalid value for 'relative_path', the character length must be great than or equal to 1."
137
+ end
138
+
139
+ @relative_path = relative_path
140
+ end
141
+
142
+ # Checks equality by comparing each attribute.
143
+ # @param [Object] Object to be compared
144
+ def ==(o)
145
+ return true if self.equal?(o)
146
+ self.class == o.class &&
147
+ _href == o._href &&
148
+ _created == o._created &&
149
+ _type == o._type &&
150
+ _artifact == o._artifact &&
151
+ relative_path == o.relative_path
152
+ end
153
+
154
+ # @see the `==` method
155
+ # @param [Object] Object to be compared
156
+ def eql?(o)
157
+ self == o
158
+ end
159
+
160
+ # Calculates hash code according to all attributes.
161
+ # @return [Fixnum] Hash code
162
+ def hash
163
+ [_href, _created, _type, _artifact, relative_path].hash
164
+ end
165
+
166
+ # Builds the object from hash
167
+ # @param [Hash] attributes Model attributes in the form of hash
168
+ # @return [Object] Returns the model itself
169
+ def build_from_hash(attributes)
170
+ return nil unless attributes.is_a?(Hash)
171
+ self.class.swagger_types.each_pair do |key, type|
172
+ if type =~ /\AArray<(.*)>/i
173
+ # check to ensure the input is an array given that the the attribute
174
+ # is documented as an array but the input is not
175
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
176
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
177
+ end
178
+ elsif !attributes[self.class.attribute_map[key]].nil?
179
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
180
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
181
+ end
182
+
183
+ self
184
+ end
185
+
186
+ # Deserializes the data based on type
187
+ # @param string type Data type
188
+ # @param string value Value to be deserialized
189
+ # @return [Object] Deserialized data
190
+ def _deserialize(type, value)
191
+ case type.to_sym
192
+ when :DateTime
193
+ DateTime.parse(value)
194
+ when :Date
195
+ Date.parse(value)
196
+ when :String
197
+ value.to_s
198
+ when :Integer
199
+ value.to_i
200
+ when :Float
201
+ value.to_f
202
+ when :BOOLEAN
203
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
204
+ true
205
+ else
206
+ false
207
+ end
208
+ when :Object
209
+ # generic object (usually a Hash), return directly
210
+ value
211
+ when /\AArray<(?<inner_type>.+)>\z/
212
+ inner_type = Regexp.last_match[:inner_type]
213
+ value.map { |v| _deserialize(inner_type, v) }
214
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
215
+ k_type = Regexp.last_match[:k_type]
216
+ v_type = Regexp.last_match[:v_type]
217
+ {}.tap do |hash|
218
+ value.each do |k, v|
219
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
220
+ end
221
+ end
222
+ else # model
223
+ temp_model = KatelloPulpApi.const_get(type).new
224
+ temp_model.build_from_hash(value)
225
+ end
226
+ end
227
+
228
+ # Returns the string representation of the object
229
+ # @return [String] String presentation of the object
230
+ def to_s
231
+ to_hash.to_s
232
+ end
233
+
234
+ # to_body is an alias to to_hash (backward compatibility)
235
+ # @return [Hash] Returns the object in the form of hash
236
+ def to_body
237
+ to_hash
238
+ end
239
+
240
+ # Returns the object in the form of hash
241
+ # @return [Hash] Returns the object in the form of hash
242
+ def to_hash
243
+ hash = {}
244
+ self.class.attribute_map.each_pair do |attr, param|
245
+ value = self.send(attr)
246
+ next if value.nil?
247
+ hash[param] = _to_hash(value)
248
+ end
249
+ hash
250
+ end
251
+
252
+ # Outputs non-array value in the form of hash
253
+ # For object, use to_hash. Otherwise, just return the value
254
+ # @param [Object] value Any valid value
255
+ # @return [Hash] Returns the value in the form of hash
256
+ def _to_hash(value)
257
+ if value.is_a?(Array)
258
+ value.compact.map{ |v| _to_hash(v) }
259
+ elsif value.is_a?(Hash)
260
+ {}.tap do |hash|
261
+ value.each { |k, v| hash[k] = _to_hash(v) }
262
+ end
263
+ elsif value.respond_to? :to_hash
264
+ value.to_hash
265
+ else
266
+ value
267
+ end
268
+ end
269
+
270
+ end
271
+
272
+ end