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,306 @@
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 Zest
16
+
17
+ class FilePublisher
18
+ attr_accessor :_href
19
+
20
+ # Timestamp of creation.
21
+ attr_accessor :_created
22
+
23
+ attr_accessor :_type
24
+
25
+ # A unique name for this publisher.
26
+ attr_accessor :name
27
+
28
+ # Timestamp of the most recent update of the publisher configuration.
29
+ attr_accessor :_last_updated
30
+
31
+ attr_accessor :distributions
32
+
33
+ # Name of the file manifest, the full path will be url/manifest
34
+ attr_accessor :manifest
35
+
36
+
37
+ # Attribute mapping from ruby-style variable name to JSON key.
38
+ def self.attribute_map
39
+ {
40
+ :'_href' => :'_href',
41
+ :'_created' => :'_created',
42
+ :'_type' => :'_type',
43
+ :'name' => :'name',
44
+ :'_last_updated' => :'_last_updated',
45
+ :'distributions' => :'distributions',
46
+ :'manifest' => :'manifest'
47
+ }
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.swagger_types
52
+ {
53
+ :'_href' => :'String',
54
+ :'_created' => :'DateTime',
55
+ :'_type' => :'String',
56
+ :'name' => :'String',
57
+ :'_last_updated' => :'DateTime',
58
+ :'distributions' => :'Array<String>',
59
+ :'manifest' => :'String'
60
+ }
61
+ end
62
+
63
+ # Initializes the object
64
+ # @param [Hash] attributes Model attributes in the form of hash
65
+ def initialize(attributes = {})
66
+ return unless attributes.is_a?(Hash)
67
+
68
+ # convert string to symbol for hash key
69
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
70
+
71
+ if attributes.has_key?(:'_href')
72
+ self._href = attributes[:'_href']
73
+ end
74
+
75
+ if attributes.has_key?(:'_created')
76
+ self._created = attributes[:'_created']
77
+ end
78
+
79
+ if attributes.has_key?(:'_type')
80
+ self._type = attributes[:'_type']
81
+ end
82
+
83
+ if attributes.has_key?(:'name')
84
+ self.name = attributes[:'name']
85
+ end
86
+
87
+ if attributes.has_key?(:'_last_updated')
88
+ self._last_updated = attributes[:'_last_updated']
89
+ end
90
+
91
+ if attributes.has_key?(:'distributions')
92
+ if (value = attributes[:'distributions']).is_a?(Array)
93
+ self.distributions = value
94
+ end
95
+ end
96
+
97
+ if attributes.has_key?(:'manifest')
98
+ self.manifest = attributes[:'manifest']
99
+ else
100
+ self.manifest = "PULP_MANIFEST"
101
+ end
102
+
103
+ end
104
+
105
+ # Show invalid properties with the reasons. Usually used together with valid?
106
+ # @return Array for valid properties with the reasons
107
+ def list_invalid_properties
108
+ invalid_properties = Array.new
109
+ if !@_type.nil? && @_type.to_s.length < 1
110
+ invalid_properties.push("invalid value for '_type', the character length must be great than or equal to 1.")
111
+ end
112
+
113
+ if @name.nil?
114
+ invalid_properties.push("invalid value for 'name', name cannot be nil.")
115
+ end
116
+
117
+ if @name.to_s.length < 1
118
+ invalid_properties.push("invalid value for 'name', the character length must be great than or equal to 1.")
119
+ end
120
+
121
+ if !@manifest.nil? && @manifest.to_s.length < 1
122
+ invalid_properties.push("invalid value for 'manifest', the character length must be great than or equal to 1.")
123
+ end
124
+
125
+ return 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 !@_type.nil? && @_type.to_s.length < 1
132
+ return false if @name.nil?
133
+ return false if @name.to_s.length < 1
134
+ return false if !@manifest.nil? && @manifest.to_s.length < 1
135
+ return true
136
+ end
137
+
138
+ # Custom attribute writer method with validation
139
+ # @param [Object] _type Value to be assigned
140
+ def _type=(_type)
141
+
142
+ if !_type.nil? && _type.to_s.length < 1
143
+ fail ArgumentError, "invalid value for '_type', the character length must be great than or equal to 1."
144
+ end
145
+
146
+ @_type = _type
147
+ end
148
+
149
+ # Custom attribute writer method with validation
150
+ # @param [Object] name Value to be assigned
151
+ def name=(name)
152
+ if name.nil?
153
+ fail ArgumentError, "name cannot be nil"
154
+ end
155
+
156
+ if name.to_s.length < 1
157
+ fail ArgumentError, "invalid value for 'name', the character length must be great than or equal to 1."
158
+ end
159
+
160
+ @name = name
161
+ end
162
+
163
+ # Custom attribute writer method with validation
164
+ # @param [Object] manifest Value to be assigned
165
+ def manifest=(manifest)
166
+
167
+ if !manifest.nil? && manifest.to_s.length < 1
168
+ fail ArgumentError, "invalid value for 'manifest', the character length must be great than or equal to 1."
169
+ end
170
+
171
+ @manifest = manifest
172
+ end
173
+
174
+ # Checks equality by comparing each attribute.
175
+ # @param [Object] Object to be compared
176
+ def ==(o)
177
+ return true if self.equal?(o)
178
+ self.class == o.class &&
179
+ _href == o._href &&
180
+ _created == o._created &&
181
+ _type == o._type &&
182
+ name == o.name &&
183
+ _last_updated == o._last_updated &&
184
+ distributions == o.distributions &&
185
+ manifest == o.manifest
186
+ end
187
+
188
+ # @see the `==` method
189
+ # @param [Object] Object to be compared
190
+ def eql?(o)
191
+ self == o
192
+ end
193
+
194
+ # Calculates hash code according to all attributes.
195
+ # @return [Fixnum] Hash code
196
+ def hash
197
+ [_href, _created, _type, name, _last_updated, distributions, manifest].hash
198
+ end
199
+
200
+ # Builds the object from hash
201
+ # @param [Hash] attributes Model attributes in the form of hash
202
+ # @return [Object] Returns the model itself
203
+ def build_from_hash(attributes)
204
+ return nil unless attributes.is_a?(Hash)
205
+ self.class.swagger_types.each_pair do |key, type|
206
+ if type =~ /\AArray<(.*)>/i
207
+ # check to ensure the input is an array given that the the attribute
208
+ # is documented as an array but the input is not
209
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
210
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
211
+ end
212
+ elsif !attributes[self.class.attribute_map[key]].nil?
213
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
214
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
215
+ end
216
+
217
+ self
218
+ end
219
+
220
+ # Deserializes the data based on type
221
+ # @param string type Data type
222
+ # @param string value Value to be deserialized
223
+ # @return [Object] Deserialized data
224
+ def _deserialize(type, value)
225
+ case type.to_sym
226
+ when :DateTime
227
+ DateTime.parse(value)
228
+ when :Date
229
+ Date.parse(value)
230
+ when :String
231
+ value.to_s
232
+ when :Integer
233
+ value.to_i
234
+ when :Float
235
+ value.to_f
236
+ when :BOOLEAN
237
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
238
+ true
239
+ else
240
+ false
241
+ end
242
+ when :Object
243
+ # generic object (usually a Hash), return directly
244
+ value
245
+ when /\AArray<(?<inner_type>.+)>\z/
246
+ inner_type = Regexp.last_match[:inner_type]
247
+ value.map { |v| _deserialize(inner_type, v) }
248
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
249
+ k_type = Regexp.last_match[:k_type]
250
+ v_type = Regexp.last_match[:v_type]
251
+ {}.tap do |hash|
252
+ value.each do |k, v|
253
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
254
+ end
255
+ end
256
+ else # model
257
+ temp_model = Zest.const_get(type).new
258
+ temp_model.build_from_hash(value)
259
+ end
260
+ end
261
+
262
+ # Returns the string representation of the object
263
+ # @return [String] String presentation of the object
264
+ def to_s
265
+ to_hash.to_s
266
+ end
267
+
268
+ # to_body is an alias to to_hash (backward compatibility)
269
+ # @return [Hash] Returns the object in the form of hash
270
+ def to_body
271
+ to_hash
272
+ end
273
+
274
+ # Returns the object in the form of hash
275
+ # @return [Hash] Returns the object in the form of hash
276
+ def to_hash
277
+ hash = {}
278
+ self.class.attribute_map.each_pair do |attr, param|
279
+ value = self.send(attr)
280
+ next if value.nil?
281
+ hash[param] = _to_hash(value)
282
+ end
283
+ hash
284
+ end
285
+
286
+ # Outputs non-array value in the form of hash
287
+ # For object, use to_hash. Otherwise, just return the value
288
+ # @param [Object] value Any valid value
289
+ # @return [Hash] Returns the value in the form of hash
290
+ def _to_hash(value)
291
+ if value.is_a?(Array)
292
+ value.compact.map{ |v| _to_hash(v) }
293
+ elsif value.is_a?(Hash)
294
+ {}.tap do |hash|
295
+ value.each { |k, v| hash[k] = _to_hash(v) }
296
+ end
297
+ elsif value.respond_to? :to_hash
298
+ value.to_hash
299
+ else
300
+ value
301
+ end
302
+ end
303
+
304
+ end
305
+
306
+ end
@@ -0,0 +1,452 @@
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 Zest
16
+
17
+ class FileRemote
18
+ attr_accessor :_href
19
+
20
+ # Timestamp of creation.
21
+ attr_accessor :_created
22
+
23
+ attr_accessor :_type
24
+
25
+ # A unique name for this remote.
26
+ attr_accessor :name
27
+
28
+ # The URL of an external content source.
29
+ attr_accessor :url
30
+
31
+ # If True, the plugin will validate imported artifacts.
32
+ attr_accessor :validate
33
+
34
+ # A PEM encoded CA certificate used to validate the server certificate presented by the remote server.
35
+ attr_accessor :ssl_ca_certificate
36
+
37
+ # A PEM encoded client certificate used for authentication.
38
+ attr_accessor :ssl_client_certificate
39
+
40
+ # A PEM encoded private key used for authentication.
41
+ attr_accessor :ssl_client_key
42
+
43
+ # If True, SSL peer validation must be performed.
44
+ attr_accessor :ssl_validation
45
+
46
+ # The proxy URL. Format: scheme://user:password@host:port
47
+ attr_accessor :proxy_url
48
+
49
+ # The username to be used for authentication when syncing.
50
+ attr_accessor :username
51
+
52
+ # The password to be used for authentication when syncing.
53
+ attr_accessor :password
54
+
55
+ # Timestamp of the most recent update of the remote.
56
+ attr_accessor :_last_updated
57
+
58
+ # Total number of simultaneous connections.
59
+ attr_accessor :download_concurrency
60
+
61
+ # The policy to use when downloading content. The possible values include: 'immediate', 'on_demand', and 'cache_only'. 'immediate' is the default.
62
+ attr_accessor :policy
63
+
64
+ class EnumAttributeValidator
65
+ attr_reader :datatype
66
+ attr_reader :allowable_values
67
+
68
+ def initialize(datatype, allowable_values)
69
+ @allowable_values = allowable_values.map do |value|
70
+ case datatype.to_s
71
+ when /Integer/i
72
+ value.to_i
73
+ when /Float/i
74
+ value.to_f
75
+ else
76
+ value
77
+ end
78
+ end
79
+ end
80
+
81
+ def valid?(value)
82
+ !value || allowable_values.include?(value)
83
+ end
84
+ end
85
+
86
+ # Attribute mapping from ruby-style variable name to JSON key.
87
+ def self.attribute_map
88
+ {
89
+ :'_href' => :'_href',
90
+ :'_created' => :'_created',
91
+ :'_type' => :'_type',
92
+ :'name' => :'name',
93
+ :'url' => :'url',
94
+ :'validate' => :'validate',
95
+ :'ssl_ca_certificate' => :'ssl_ca_certificate',
96
+ :'ssl_client_certificate' => :'ssl_client_certificate',
97
+ :'ssl_client_key' => :'ssl_client_key',
98
+ :'ssl_validation' => :'ssl_validation',
99
+ :'proxy_url' => :'proxy_url',
100
+ :'username' => :'username',
101
+ :'password' => :'password',
102
+ :'_last_updated' => :'_last_updated',
103
+ :'download_concurrency' => :'download_concurrency',
104
+ :'policy' => :'policy'
105
+ }
106
+ end
107
+
108
+ # Attribute type mapping.
109
+ def self.swagger_types
110
+ {
111
+ :'_href' => :'String',
112
+ :'_created' => :'DateTime',
113
+ :'_type' => :'String',
114
+ :'name' => :'String',
115
+ :'url' => :'String',
116
+ :'validate' => :'BOOLEAN',
117
+ :'ssl_ca_certificate' => :'String',
118
+ :'ssl_client_certificate' => :'String',
119
+ :'ssl_client_key' => :'String',
120
+ :'ssl_validation' => :'BOOLEAN',
121
+ :'proxy_url' => :'String',
122
+ :'username' => :'String',
123
+ :'password' => :'String',
124
+ :'_last_updated' => :'DateTime',
125
+ :'download_concurrency' => :'Integer',
126
+ :'policy' => :'String'
127
+ }
128
+ end
129
+
130
+ # Initializes the object
131
+ # @param [Hash] attributes Model attributes in the form of hash
132
+ def initialize(attributes = {})
133
+ return unless attributes.is_a?(Hash)
134
+
135
+ # convert string to symbol for hash key
136
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
137
+
138
+ if attributes.has_key?(:'_href')
139
+ self._href = attributes[:'_href']
140
+ end
141
+
142
+ if attributes.has_key?(:'_created')
143
+ self._created = attributes[:'_created']
144
+ end
145
+
146
+ if attributes.has_key?(:'_type')
147
+ self._type = attributes[:'_type']
148
+ end
149
+
150
+ if attributes.has_key?(:'name')
151
+ self.name = attributes[:'name']
152
+ end
153
+
154
+ if attributes.has_key?(:'url')
155
+ self.url = attributes[:'url']
156
+ end
157
+
158
+ if attributes.has_key?(:'validate')
159
+ self.validate = attributes[:'validate']
160
+ end
161
+
162
+ if attributes.has_key?(:'ssl_ca_certificate')
163
+ self.ssl_ca_certificate = attributes[:'ssl_ca_certificate']
164
+ end
165
+
166
+ if attributes.has_key?(:'ssl_client_certificate')
167
+ self.ssl_client_certificate = attributes[:'ssl_client_certificate']
168
+ end
169
+
170
+ if attributes.has_key?(:'ssl_client_key')
171
+ self.ssl_client_key = attributes[:'ssl_client_key']
172
+ end
173
+
174
+ if attributes.has_key?(:'ssl_validation')
175
+ self.ssl_validation = attributes[:'ssl_validation']
176
+ end
177
+
178
+ if attributes.has_key?(:'proxy_url')
179
+ self.proxy_url = attributes[:'proxy_url']
180
+ end
181
+
182
+ if attributes.has_key?(:'username')
183
+ self.username = attributes[:'username']
184
+ end
185
+
186
+ if attributes.has_key?(:'password')
187
+ self.password = attributes[:'password']
188
+ end
189
+
190
+ if attributes.has_key?(:'_last_updated')
191
+ self._last_updated = attributes[:'_last_updated']
192
+ end
193
+
194
+ if attributes.has_key?(:'download_concurrency')
195
+ self.download_concurrency = attributes[:'download_concurrency']
196
+ end
197
+
198
+ if attributes.has_key?(:'policy')
199
+ self.policy = attributes[:'policy']
200
+ else
201
+ self.policy = "immediate"
202
+ end
203
+
204
+ end
205
+
206
+ # Show invalid properties with the reasons. Usually used together with valid?
207
+ # @return Array for valid properties with the reasons
208
+ def list_invalid_properties
209
+ invalid_properties = Array.new
210
+ if !@_type.nil? && @_type.to_s.length < 1
211
+ invalid_properties.push("invalid value for '_type', the character length must be great than or equal to 1.")
212
+ end
213
+
214
+ if @name.nil?
215
+ invalid_properties.push("invalid value for 'name', name cannot be nil.")
216
+ end
217
+
218
+ if @name.to_s.length < 1
219
+ invalid_properties.push("invalid value for 'name', the character length must be great than or equal to 1.")
220
+ end
221
+
222
+ if @url.nil?
223
+ invalid_properties.push("invalid value for 'url', url cannot be nil.")
224
+ end
225
+
226
+ if @url.to_s.length < 1
227
+ invalid_properties.push("invalid value for 'url', the character length must be great than or equal to 1.")
228
+ end
229
+
230
+ if !@download_concurrency.nil? && @download_concurrency < 1
231
+ invalid_properties.push("invalid value for 'download_concurrency', must be greater than or equal to 1.")
232
+ end
233
+
234
+ return invalid_properties
235
+ end
236
+
237
+ # Check to see if the all the properties in the model are valid
238
+ # @return true if the model is valid
239
+ def valid?
240
+ return false if !@_type.nil? && @_type.to_s.length < 1
241
+ return false if @name.nil?
242
+ return false if @name.to_s.length < 1
243
+ return false if @url.nil?
244
+ return false if @url.to_s.length < 1
245
+ return false if !@download_concurrency.nil? && @download_concurrency < 1
246
+ policy_validator = EnumAttributeValidator.new('String', ["immediate", "on_demand", "streamed"])
247
+ return false unless policy_validator.valid?(@policy)
248
+ return true
249
+ end
250
+
251
+ # Custom attribute writer method with validation
252
+ # @param [Object] _type Value to be assigned
253
+ def _type=(_type)
254
+
255
+ if !_type.nil? && _type.to_s.length < 1
256
+ fail ArgumentError, "invalid value for '_type', the character length must be great than or equal to 1."
257
+ end
258
+
259
+ @_type = _type
260
+ end
261
+
262
+ # Custom attribute writer method with validation
263
+ # @param [Object] name Value to be assigned
264
+ def name=(name)
265
+ if name.nil?
266
+ fail ArgumentError, "name cannot be nil"
267
+ end
268
+
269
+ if name.to_s.length < 1
270
+ fail ArgumentError, "invalid value for 'name', the character length must be great than or equal to 1."
271
+ end
272
+
273
+ @name = name
274
+ end
275
+
276
+ # Custom attribute writer method with validation
277
+ # @param [Object] url Value to be assigned
278
+ def url=(url)
279
+ if url.nil?
280
+ fail ArgumentError, "url cannot be nil"
281
+ end
282
+
283
+ if url.to_s.length < 1
284
+ fail ArgumentError, "invalid value for 'url', the character length must be great than or equal to 1."
285
+ end
286
+
287
+ @url = url
288
+ end
289
+
290
+ # Custom attribute writer method with validation
291
+ # @param [Object] download_concurrency Value to be assigned
292
+ def download_concurrency=(download_concurrency)
293
+
294
+ if !download_concurrency.nil? && download_concurrency < 1
295
+ fail ArgumentError, "invalid value for 'download_concurrency', must be greater than or equal to 1."
296
+ end
297
+
298
+ @download_concurrency = download_concurrency
299
+ end
300
+
301
+ # Custom attribute writer method checking allowed values (enum).
302
+ # @param [Object] policy Object to be assigned
303
+ def policy=(policy)
304
+ validator = EnumAttributeValidator.new('String', ["immediate", "on_demand", "streamed"])
305
+ unless validator.valid?(policy)
306
+ fail ArgumentError, "invalid value for 'policy', must be one of #{validator.allowable_values}."
307
+ end
308
+ @policy = policy
309
+ end
310
+
311
+ # Checks equality by comparing each attribute.
312
+ # @param [Object] Object to be compared
313
+ def ==(o)
314
+ return true if self.equal?(o)
315
+ self.class == o.class &&
316
+ _href == o._href &&
317
+ _created == o._created &&
318
+ _type == o._type &&
319
+ name == o.name &&
320
+ url == o.url &&
321
+ validate == o.validate &&
322
+ ssl_ca_certificate == o.ssl_ca_certificate &&
323
+ ssl_client_certificate == o.ssl_client_certificate &&
324
+ ssl_client_key == o.ssl_client_key &&
325
+ ssl_validation == o.ssl_validation &&
326
+ proxy_url == o.proxy_url &&
327
+ username == o.username &&
328
+ password == o.password &&
329
+ _last_updated == o._last_updated &&
330
+ download_concurrency == o.download_concurrency &&
331
+ policy == o.policy
332
+ end
333
+
334
+ # @see the `==` method
335
+ # @param [Object] Object to be compared
336
+ def eql?(o)
337
+ self == o
338
+ end
339
+
340
+ # Calculates hash code according to all attributes.
341
+ # @return [Fixnum] Hash code
342
+ def hash
343
+ [_href, _created, _type, name, url, validate, ssl_ca_certificate, ssl_client_certificate, ssl_client_key, ssl_validation, proxy_url, username, password, _last_updated, download_concurrency, policy].hash
344
+ end
345
+
346
+ # Builds the object from hash
347
+ # @param [Hash] attributes Model attributes in the form of hash
348
+ # @return [Object] Returns the model itself
349
+ def build_from_hash(attributes)
350
+ return nil unless attributes.is_a?(Hash)
351
+ self.class.swagger_types.each_pair do |key, type|
352
+ if type =~ /\AArray<(.*)>/i
353
+ # check to ensure the input is an array given that the the attribute
354
+ # is documented as an array but the input is not
355
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
356
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
357
+ end
358
+ elsif !attributes[self.class.attribute_map[key]].nil?
359
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
360
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
361
+ end
362
+
363
+ self
364
+ end
365
+
366
+ # Deserializes the data based on type
367
+ # @param string type Data type
368
+ # @param string value Value to be deserialized
369
+ # @return [Object] Deserialized data
370
+ def _deserialize(type, value)
371
+ case type.to_sym
372
+ when :DateTime
373
+ DateTime.parse(value)
374
+ when :Date
375
+ Date.parse(value)
376
+ when :String
377
+ value.to_s
378
+ when :Integer
379
+ value.to_i
380
+ when :Float
381
+ value.to_f
382
+ when :BOOLEAN
383
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
384
+ true
385
+ else
386
+ false
387
+ end
388
+ when :Object
389
+ # generic object (usually a Hash), return directly
390
+ value
391
+ when /\AArray<(?<inner_type>.+)>\z/
392
+ inner_type = Regexp.last_match[:inner_type]
393
+ value.map { |v| _deserialize(inner_type, v) }
394
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
395
+ k_type = Regexp.last_match[:k_type]
396
+ v_type = Regexp.last_match[:v_type]
397
+ {}.tap do |hash|
398
+ value.each do |k, v|
399
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
400
+ end
401
+ end
402
+ else # model
403
+ temp_model = Zest.const_get(type).new
404
+ temp_model.build_from_hash(value)
405
+ end
406
+ end
407
+
408
+ # Returns the string representation of the object
409
+ # @return [String] String presentation of the object
410
+ def to_s
411
+ to_hash.to_s
412
+ end
413
+
414
+ # to_body is an alias to to_hash (backward compatibility)
415
+ # @return [Hash] Returns the object in the form of hash
416
+ def to_body
417
+ to_hash
418
+ end
419
+
420
+ # Returns the object in the form of hash
421
+ # @return [Hash] Returns the object in the form of hash
422
+ def to_hash
423
+ hash = {}
424
+ self.class.attribute_map.each_pair do |attr, param|
425
+ value = self.send(attr)
426
+ next if value.nil?
427
+ hash[param] = _to_hash(value)
428
+ end
429
+ hash
430
+ end
431
+
432
+ # Outputs non-array value in the form of hash
433
+ # For object, use to_hash. Otherwise, just return the value
434
+ # @param [Object] value Any valid value
435
+ # @return [Hash] Returns the value in the form of hash
436
+ def _to_hash(value)
437
+ if value.is_a?(Array)
438
+ value.compact.map{ |v| _to_hash(v) }
439
+ elsif value.is_a?(Hash)
440
+ {}.tap do |hash|
441
+ value.each { |k, v| hash[k] = _to_hash(v) }
442
+ end
443
+ elsif value.respond_to? :to_hash
444
+ value.to_hash
445
+ else
446
+ value
447
+ end
448
+ end
449
+
450
+ end
451
+
452
+ end