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,249 @@
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 Publication
18
+ attr_accessor :_href
19
+
20
+ # Timestamp of creation.
21
+ attr_accessor :_created
22
+
23
+ # The publication is a pass-through for the repository version.
24
+ attr_accessor :pass_through
25
+
26
+ # The publisher that created this publication.
27
+ attr_accessor :publisher
28
+
29
+ # This publication is currently being served asdefined by these distributions.
30
+ attr_accessor :distributions
31
+
32
+ attr_accessor :repository_version
33
+
34
+
35
+ # Attribute mapping from ruby-style variable name to JSON key.
36
+ def self.attribute_map
37
+ {
38
+ :'_href' => :'_href',
39
+ :'_created' => :'_created',
40
+ :'pass_through' => :'pass_through',
41
+ :'publisher' => :'publisher',
42
+ :'distributions' => :'distributions',
43
+ :'repository_version' => :'repository_version'
44
+ }
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.swagger_types
49
+ {
50
+ :'_href' => :'String',
51
+ :'_created' => :'DateTime',
52
+ :'pass_through' => :'BOOLEAN',
53
+ :'publisher' => :'String',
54
+ :'distributions' => :'Array<String>',
55
+ :'repository_version' => :'String'
56
+ }
57
+ end
58
+
59
+ # Initializes the object
60
+ # @param [Hash] attributes Model attributes in the form of hash
61
+ def initialize(attributes = {})
62
+ return unless attributes.is_a?(Hash)
63
+
64
+ # convert string to symbol for hash key
65
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
66
+
67
+ if attributes.has_key?(:'_href')
68
+ self._href = attributes[:'_href']
69
+ end
70
+
71
+ if attributes.has_key?(:'_created')
72
+ self._created = attributes[:'_created']
73
+ end
74
+
75
+ if attributes.has_key?(:'pass_through')
76
+ self.pass_through = attributes[:'pass_through']
77
+ end
78
+
79
+ if attributes.has_key?(:'publisher')
80
+ self.publisher = attributes[:'publisher']
81
+ end
82
+
83
+ if attributes.has_key?(:'distributions')
84
+ if (value = attributes[:'distributions']).is_a?(Array)
85
+ self.distributions = value
86
+ end
87
+ end
88
+
89
+ if attributes.has_key?(:'repository_version')
90
+ self.repository_version = attributes[:'repository_version']
91
+ end
92
+
93
+ end
94
+
95
+ # Show invalid properties with the reasons. Usually used together with valid?
96
+ # @return Array for valid properties with the reasons
97
+ def list_invalid_properties
98
+ invalid_properties = Array.new
99
+ if @pass_through.nil?
100
+ invalid_properties.push("invalid value for 'pass_through', pass_through cannot be nil.")
101
+ end
102
+
103
+ if @publisher.nil?
104
+ invalid_properties.push("invalid value for 'publisher', publisher cannot be nil.")
105
+ end
106
+
107
+ return invalid_properties
108
+ end
109
+
110
+ # Check to see if the all the properties in the model are valid
111
+ # @return true if the model is valid
112
+ def valid?
113
+ return false if @pass_through.nil?
114
+ return false if @publisher.nil?
115
+ return true
116
+ end
117
+
118
+ # Checks equality by comparing each attribute.
119
+ # @param [Object] Object to be compared
120
+ def ==(o)
121
+ return true if self.equal?(o)
122
+ self.class == o.class &&
123
+ _href == o._href &&
124
+ _created == o._created &&
125
+ pass_through == o.pass_through &&
126
+ publisher == o.publisher &&
127
+ distributions == o.distributions &&
128
+ repository_version == o.repository_version
129
+ end
130
+
131
+ # @see the `==` method
132
+ # @param [Object] Object to be compared
133
+ def eql?(o)
134
+ self == o
135
+ end
136
+
137
+ # Calculates hash code according to all attributes.
138
+ # @return [Fixnum] Hash code
139
+ def hash
140
+ [_href, _created, pass_through, publisher, distributions, repository_version].hash
141
+ end
142
+
143
+ # Builds the object from hash
144
+ # @param [Hash] attributes Model attributes in the form of hash
145
+ # @return [Object] Returns the model itself
146
+ def build_from_hash(attributes)
147
+ return nil unless attributes.is_a?(Hash)
148
+ self.class.swagger_types.each_pair do |key, type|
149
+ if type =~ /\AArray<(.*)>/i
150
+ # check to ensure the input is an array given that the the attribute
151
+ # is documented as an array but the input is not
152
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
153
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
154
+ end
155
+ elsif !attributes[self.class.attribute_map[key]].nil?
156
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
157
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
158
+ end
159
+
160
+ self
161
+ end
162
+
163
+ # Deserializes the data based on type
164
+ # @param string type Data type
165
+ # @param string value Value to be deserialized
166
+ # @return [Object] Deserialized data
167
+ def _deserialize(type, value)
168
+ case type.to_sym
169
+ when :DateTime
170
+ DateTime.parse(value)
171
+ when :Date
172
+ Date.parse(value)
173
+ when :String
174
+ value.to_s
175
+ when :Integer
176
+ value.to_i
177
+ when :Float
178
+ value.to_f
179
+ when :BOOLEAN
180
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
181
+ true
182
+ else
183
+ false
184
+ end
185
+ when :Object
186
+ # generic object (usually a Hash), return directly
187
+ value
188
+ when /\AArray<(?<inner_type>.+)>\z/
189
+ inner_type = Regexp.last_match[:inner_type]
190
+ value.map { |v| _deserialize(inner_type, v) }
191
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
192
+ k_type = Regexp.last_match[:k_type]
193
+ v_type = Regexp.last_match[:v_type]
194
+ {}.tap do |hash|
195
+ value.each do |k, v|
196
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
197
+ end
198
+ end
199
+ else # model
200
+ temp_model = KatelloPulpApi.const_get(type).new
201
+ temp_model.build_from_hash(value)
202
+ end
203
+ end
204
+
205
+ # Returns the string representation of the object
206
+ # @return [String] String presentation of the object
207
+ def to_s
208
+ to_hash.to_s
209
+ end
210
+
211
+ # to_body is an alias to to_hash (backward compatibility)
212
+ # @return [Hash] Returns the object in the form of hash
213
+ def to_body
214
+ to_hash
215
+ end
216
+
217
+ # Returns the object in the form of hash
218
+ # @return [Hash] Returns the object in the form of hash
219
+ def to_hash
220
+ hash = {}
221
+ self.class.attribute_map.each_pair do |attr, param|
222
+ value = self.send(attr)
223
+ next if value.nil?
224
+ hash[param] = _to_hash(value)
225
+ end
226
+ hash
227
+ end
228
+
229
+ # Outputs non-array value in the form of hash
230
+ # For object, use to_hash. Otherwise, just return the value
231
+ # @param [Object] value Any valid value
232
+ # @return [Hash] Returns the value in the form of hash
233
+ def _to_hash(value)
234
+ if value.is_a?(Array)
235
+ value.compact.map{ |v| _to_hash(v) }
236
+ elsif value.is_a?(Hash)
237
+ {}.tap do |hash|
238
+ value.each { |k, v| hash[k] = _to_hash(v) }
239
+ end
240
+ elsif value.respond_to? :to_hash
241
+ value.to_hash
242
+ else
243
+ value
244
+ end
245
+ end
246
+
247
+ end
248
+
249
+ end
@@ -0,0 +1,260 @@
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 Repository
18
+ attr_accessor :_href
19
+
20
+ # Timestamp of creation.
21
+ attr_accessor :_created
22
+
23
+ attr_accessor :_versions_href
24
+
25
+ attr_accessor :_latest_version_href
26
+
27
+ # A unique name for this repository.
28
+ attr_accessor :name
29
+
30
+ # An optional description.
31
+ attr_accessor :description
32
+
33
+
34
+ # Attribute mapping from ruby-style variable name to JSON key.
35
+ def self.attribute_map
36
+ {
37
+ :'_href' => :'_href',
38
+ :'_created' => :'_created',
39
+ :'_versions_href' => :'_versions_href',
40
+ :'_latest_version_href' => :'_latest_version_href',
41
+ :'name' => :'name',
42
+ :'description' => :'description'
43
+ }
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.swagger_types
48
+ {
49
+ :'_href' => :'String',
50
+ :'_created' => :'DateTime',
51
+ :'_versions_href' => :'String',
52
+ :'_latest_version_href' => :'String',
53
+ :'name' => :'String',
54
+ :'description' => :'String'
55
+ }
56
+ end
57
+
58
+ # Initializes the object
59
+ # @param [Hash] attributes Model attributes in the form of hash
60
+ def initialize(attributes = {})
61
+ return unless attributes.is_a?(Hash)
62
+
63
+ # convert string to symbol for hash key
64
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
65
+
66
+ if attributes.has_key?(:'_href')
67
+ self._href = attributes[:'_href']
68
+ end
69
+
70
+ if attributes.has_key?(:'_created')
71
+ self._created = attributes[:'_created']
72
+ end
73
+
74
+ if attributes.has_key?(:'_versions_href')
75
+ self._versions_href = attributes[:'_versions_href']
76
+ end
77
+
78
+ if attributes.has_key?(:'_latest_version_href')
79
+ self._latest_version_href = attributes[:'_latest_version_href']
80
+ end
81
+
82
+ if attributes.has_key?(:'name')
83
+ self.name = attributes[:'name']
84
+ end
85
+
86
+ if attributes.has_key?(:'description')
87
+ self.description = attributes[:'description']
88
+ end
89
+
90
+ end
91
+
92
+ # Show invalid properties with the reasons. Usually used together with valid?
93
+ # @return Array for valid properties with the reasons
94
+ def list_invalid_properties
95
+ invalid_properties = Array.new
96
+ if @name.nil?
97
+ invalid_properties.push("invalid value for 'name', name cannot be nil.")
98
+ end
99
+
100
+ if @name.to_s.length < 1
101
+ invalid_properties.push("invalid value for 'name', 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 @name.nil?
111
+ return false if @name.to_s.length < 1
112
+ return true
113
+ end
114
+
115
+ # Custom attribute writer method with validation
116
+ # @param [Object] name Value to be assigned
117
+ def name=(name)
118
+ if name.nil?
119
+ fail ArgumentError, "name cannot be nil"
120
+ end
121
+
122
+ if name.to_s.length < 1
123
+ fail ArgumentError, "invalid value for 'name', the character length must be great than or equal to 1."
124
+ end
125
+
126
+ @name = name
127
+ end
128
+
129
+ # Checks equality by comparing each attribute.
130
+ # @param [Object] Object to be compared
131
+ def ==(o)
132
+ return true if self.equal?(o)
133
+ self.class == o.class &&
134
+ _href == o._href &&
135
+ _created == o._created &&
136
+ _versions_href == o._versions_href &&
137
+ _latest_version_href == o._latest_version_href &&
138
+ name == o.name &&
139
+ description == o.description
140
+ end
141
+
142
+ # @see the `==` method
143
+ # @param [Object] Object to be compared
144
+ def eql?(o)
145
+ self == o
146
+ end
147
+
148
+ # Calculates hash code according to all attributes.
149
+ # @return [Fixnum] Hash code
150
+ def hash
151
+ [_href, _created, _versions_href, _latest_version_href, name, description].hash
152
+ end
153
+
154
+ # Builds the object from hash
155
+ # @param [Hash] attributes Model attributes in the form of hash
156
+ # @return [Object] Returns the model itself
157
+ def build_from_hash(attributes)
158
+ return nil unless attributes.is_a?(Hash)
159
+ self.class.swagger_types.each_pair do |key, type|
160
+ if type =~ /\AArray<(.*)>/i
161
+ # check to ensure the input is an array given that the the attribute
162
+ # is documented as an array but the input is not
163
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
164
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
165
+ end
166
+ elsif !attributes[self.class.attribute_map[key]].nil?
167
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
168
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
169
+ end
170
+
171
+ self
172
+ end
173
+
174
+ # Deserializes the data based on type
175
+ # @param string type Data type
176
+ # @param string value Value to be deserialized
177
+ # @return [Object] Deserialized data
178
+ def _deserialize(type, value)
179
+ case type.to_sym
180
+ when :DateTime
181
+ DateTime.parse(value)
182
+ when :Date
183
+ Date.parse(value)
184
+ when :String
185
+ value.to_s
186
+ when :Integer
187
+ value.to_i
188
+ when :Float
189
+ value.to_f
190
+ when :BOOLEAN
191
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
192
+ true
193
+ else
194
+ false
195
+ end
196
+ when :Object
197
+ # generic object (usually a Hash), return directly
198
+ value
199
+ when /\AArray<(?<inner_type>.+)>\z/
200
+ inner_type = Regexp.last_match[:inner_type]
201
+ value.map { |v| _deserialize(inner_type, v) }
202
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
203
+ k_type = Regexp.last_match[:k_type]
204
+ v_type = Regexp.last_match[:v_type]
205
+ {}.tap do |hash|
206
+ value.each do |k, v|
207
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
208
+ end
209
+ end
210
+ else # model
211
+ temp_model = KatelloPulpApi.const_get(type).new
212
+ temp_model.build_from_hash(value)
213
+ end
214
+ end
215
+
216
+ # Returns the string representation of the object
217
+ # @return [String] String presentation of the object
218
+ def to_s
219
+ to_hash.to_s
220
+ end
221
+
222
+ # to_body is an alias to to_hash (backward compatibility)
223
+ # @return [Hash] Returns the object in the form of hash
224
+ def to_body
225
+ to_hash
226
+ end
227
+
228
+ # Returns the object in the form of hash
229
+ # @return [Hash] Returns the object in the form of hash
230
+ def to_hash
231
+ hash = {}
232
+ self.class.attribute_map.each_pair do |attr, param|
233
+ value = self.send(attr)
234
+ next if value.nil?
235
+ hash[param] = _to_hash(value)
236
+ end
237
+ hash
238
+ end
239
+
240
+ # Outputs non-array value in the form of hash
241
+ # For object, use to_hash. Otherwise, just return the value
242
+ # @param [Object] value Any valid value
243
+ # @return [Hash] Returns the value in the form of hash
244
+ def _to_hash(value)
245
+ if value.is_a?(Array)
246
+ value.compact.map{ |v| _to_hash(v) }
247
+ elsif value.is_a?(Hash)
248
+ {}.tap do |hash|
249
+ value.each { |k, v| hash[k] = _to_hash(v) }
250
+ end
251
+ elsif value.respond_to? :to_hash
252
+ value.to_hash
253
+ else
254
+ value
255
+ end
256
+ end
257
+
258
+ end
259
+
260
+ end