zest 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -4
- data/lib/zest/version.rb +1 -1
- data/spec/api/pulp_api_spec.rb +3 -3
- data/spec/api_client_spec.rb +29 -29
- data/spec/configuration_spec.rb +3 -3
- data/spec/models/artifact_spec.rb +3 -3
- data/spec/models/async_operation_response_spec.rb +3 -3
- data/spec/models/distribution_spec.rb +3 -3
- data/spec/models/file_content_spec.rb +3 -3
- data/spec/models/file_publisher_spec.rb +3 -3
- data/spec/models/file_remote_spec.rb +3 -3
- data/spec/models/inline_response_200_10_spec.rb +3 -3
- data/spec/models/inline_response_200_1_spec.rb +3 -3
- data/spec/models/inline_response_200_2_spec.rb +3 -3
- data/spec/models/inline_response_200_3_spec.rb +3 -3
- data/spec/models/inline_response_200_4_spec.rb +3 -3
- data/spec/models/inline_response_200_5_spec.rb +3 -3
- data/spec/models/inline_response_200_6_spec.rb +3 -3
- data/spec/models/inline_response_200_7_spec.rb +3 -3
- data/spec/models/inline_response_200_8_spec.rb +3 -3
- data/spec/models/inline_response_200_9_spec.rb +3 -3
- data/spec/models/inline_response_200_spec.rb +3 -3
- data/spec/models/progress_report_spec.rb +3 -3
- data/spec/models/publication_spec.rb +3 -3
- data/spec/models/repository_publish_url_spec.rb +3 -3
- data/spec/models/repository_spec.rb +3 -3
- data/spec/models/repository_sync_url_spec.rb +3 -3
- data/spec/models/repository_version_create_spec.rb +3 -3
- data/spec/models/repository_version_spec.rb +3 -3
- data/spec/models/task_spec.rb +3 -3
- data/spec/models/user_spec.rb +3 -3
- data/spec/models/worker_spec.rb +3 -3
- data/spec/spec_helper.rb +1 -1
- data/zest.gemspec +3 -4
- metadata +6 -44
- data/api.json +0 -1
- data/config.json +0 -6
- data/katello_pulp_api-0.0.1.gem +0 -0
- data/katello_pulp_api.gemspec +0 -46
- data/lib/katello_pulp_api.rb +0 -67
- data/lib/katello_pulp_api/api/pulp_api.rb +0 -3277
- data/lib/katello_pulp_api/api_client.rb +0 -389
- data/lib/katello_pulp_api/api_error.rb +0 -38
- data/lib/katello_pulp_api/configuration.rb +0 -209
- data/lib/katello_pulp_api/models/artifact.rb +0 -278
- data/lib/katello_pulp_api/models/async_operation_response.rb +0 -194
- data/lib/katello_pulp_api/models/distribution.rb +0 -350
- data/lib/katello_pulp_api/models/file_content.rb +0 -272
- data/lib/katello_pulp_api/models/file_publisher.rb +0 -306
- data/lib/katello_pulp_api/models/file_remote.rb +0 -452
- data/lib/katello_pulp_api/models/inline_response_200.rb +0 -227
- data/lib/katello_pulp_api/models/inline_response_200_1.rb +0 -227
- data/lib/katello_pulp_api/models/inline_response_200_10.rb +0 -227
- data/lib/katello_pulp_api/models/inline_response_200_2.rb +0 -227
- data/lib/katello_pulp_api/models/inline_response_200_3.rb +0 -227
- data/lib/katello_pulp_api/models/inline_response_200_4.rb +0 -227
- data/lib/katello_pulp_api/models/inline_response_200_5.rb +0 -227
- data/lib/katello_pulp_api/models/inline_response_200_6.rb +0 -227
- data/lib/katello_pulp_api/models/inline_response_200_7.rb +0 -227
- data/lib/katello_pulp_api/models/inline_response_200_8.rb +0 -227
- data/lib/katello_pulp_api/models/inline_response_200_9.rb +0 -227
- data/lib/katello_pulp_api/models/progress_report.rb +0 -271
- data/lib/katello_pulp_api/models/publication.rb +0 -249
- data/lib/katello_pulp_api/models/repository.rb +0 -260
- data/lib/katello_pulp_api/models/repository_publish_url.rb +0 -199
- data/lib/katello_pulp_api/models/repository_sync_url.rb +0 -206
- data/lib/katello_pulp_api/models/repository_version.rb +0 -277
- data/lib/katello_pulp_api/models/repository_version_create.rb +0 -223
- data/lib/katello_pulp_api/models/task.rb +0 -363
- data/lib/katello_pulp_api/models/user.rb +0 -284
- data/lib/katello_pulp_api/models/worker.rb +0 -254
- data/lib/katello_pulp_api/version.rb +0 -15
@@ -1,227 +0,0 @@
|
|
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 InlineResponse2009
|
18
|
-
attr_accessor :count
|
19
|
-
|
20
|
-
attr_accessor :_next
|
21
|
-
|
22
|
-
attr_accessor :previous
|
23
|
-
|
24
|
-
attr_accessor :results
|
25
|
-
|
26
|
-
|
27
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
28
|
-
def self.attribute_map
|
29
|
-
{
|
30
|
-
:'count' => :'count',
|
31
|
-
:'_next' => :'next',
|
32
|
-
:'previous' => :'previous',
|
33
|
-
:'results' => :'results'
|
34
|
-
}
|
35
|
-
end
|
36
|
-
|
37
|
-
# Attribute type mapping.
|
38
|
-
def self.swagger_types
|
39
|
-
{
|
40
|
-
:'count' => :'Integer',
|
41
|
-
:'_next' => :'String',
|
42
|
-
:'previous' => :'String',
|
43
|
-
:'results' => :'Array<User>'
|
44
|
-
}
|
45
|
-
end
|
46
|
-
|
47
|
-
# Initializes the object
|
48
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
49
|
-
def initialize(attributes = {})
|
50
|
-
return unless attributes.is_a?(Hash)
|
51
|
-
|
52
|
-
# convert string to symbol for hash key
|
53
|
-
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
54
|
-
|
55
|
-
if attributes.has_key?(:'count')
|
56
|
-
self.count = attributes[:'count']
|
57
|
-
end
|
58
|
-
|
59
|
-
if attributes.has_key?(:'next')
|
60
|
-
self._next = attributes[:'next']
|
61
|
-
end
|
62
|
-
|
63
|
-
if attributes.has_key?(:'previous')
|
64
|
-
self.previous = attributes[:'previous']
|
65
|
-
end
|
66
|
-
|
67
|
-
if attributes.has_key?(:'results')
|
68
|
-
if (value = attributes[:'results']).is_a?(Array)
|
69
|
-
self.results = value
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
end
|
74
|
-
|
75
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
76
|
-
# @return Array for valid properties with the reasons
|
77
|
-
def list_invalid_properties
|
78
|
-
invalid_properties = Array.new
|
79
|
-
if @count.nil?
|
80
|
-
invalid_properties.push("invalid value for 'count', count cannot be nil.")
|
81
|
-
end
|
82
|
-
|
83
|
-
if @results.nil?
|
84
|
-
invalid_properties.push("invalid value for 'results', results cannot be nil.")
|
85
|
-
end
|
86
|
-
|
87
|
-
return invalid_properties
|
88
|
-
end
|
89
|
-
|
90
|
-
# Check to see if the all the properties in the model are valid
|
91
|
-
# @return true if the model is valid
|
92
|
-
def valid?
|
93
|
-
return false if @count.nil?
|
94
|
-
return false if @results.nil?
|
95
|
-
return true
|
96
|
-
end
|
97
|
-
|
98
|
-
# Checks equality by comparing each attribute.
|
99
|
-
# @param [Object] Object to be compared
|
100
|
-
def ==(o)
|
101
|
-
return true if self.equal?(o)
|
102
|
-
self.class == o.class &&
|
103
|
-
count == o.count &&
|
104
|
-
_next == o._next &&
|
105
|
-
previous == o.previous &&
|
106
|
-
results == o.results
|
107
|
-
end
|
108
|
-
|
109
|
-
# @see the `==` method
|
110
|
-
# @param [Object] Object to be compared
|
111
|
-
def eql?(o)
|
112
|
-
self == o
|
113
|
-
end
|
114
|
-
|
115
|
-
# Calculates hash code according to all attributes.
|
116
|
-
# @return [Fixnum] Hash code
|
117
|
-
def hash
|
118
|
-
[count, _next, previous, results].hash
|
119
|
-
end
|
120
|
-
|
121
|
-
# Builds the object from hash
|
122
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
123
|
-
# @return [Object] Returns the model itself
|
124
|
-
def build_from_hash(attributes)
|
125
|
-
return nil unless attributes.is_a?(Hash)
|
126
|
-
self.class.swagger_types.each_pair do |key, type|
|
127
|
-
if type =~ /\AArray<(.*)>/i
|
128
|
-
# check to ensure the input is an array given that the the attribute
|
129
|
-
# is documented as an array but the input is not
|
130
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
131
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
132
|
-
end
|
133
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
134
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
135
|
-
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
136
|
-
end
|
137
|
-
|
138
|
-
self
|
139
|
-
end
|
140
|
-
|
141
|
-
# Deserializes the data based on type
|
142
|
-
# @param string type Data type
|
143
|
-
# @param string value Value to be deserialized
|
144
|
-
# @return [Object] Deserialized data
|
145
|
-
def _deserialize(type, value)
|
146
|
-
case type.to_sym
|
147
|
-
when :DateTime
|
148
|
-
DateTime.parse(value)
|
149
|
-
when :Date
|
150
|
-
Date.parse(value)
|
151
|
-
when :String
|
152
|
-
value.to_s
|
153
|
-
when :Integer
|
154
|
-
value.to_i
|
155
|
-
when :Float
|
156
|
-
value.to_f
|
157
|
-
when :BOOLEAN
|
158
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
159
|
-
true
|
160
|
-
else
|
161
|
-
false
|
162
|
-
end
|
163
|
-
when :Object
|
164
|
-
# generic object (usually a Hash), return directly
|
165
|
-
value
|
166
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
167
|
-
inner_type = Regexp.last_match[:inner_type]
|
168
|
-
value.map { |v| _deserialize(inner_type, v) }
|
169
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
170
|
-
k_type = Regexp.last_match[:k_type]
|
171
|
-
v_type = Regexp.last_match[:v_type]
|
172
|
-
{}.tap do |hash|
|
173
|
-
value.each do |k, v|
|
174
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
175
|
-
end
|
176
|
-
end
|
177
|
-
else # model
|
178
|
-
temp_model = KatelloPulpApi.const_get(type).new
|
179
|
-
temp_model.build_from_hash(value)
|
180
|
-
end
|
181
|
-
end
|
182
|
-
|
183
|
-
# Returns the string representation of the object
|
184
|
-
# @return [String] String presentation of the object
|
185
|
-
def to_s
|
186
|
-
to_hash.to_s
|
187
|
-
end
|
188
|
-
|
189
|
-
# to_body is an alias to to_hash (backward compatibility)
|
190
|
-
# @return [Hash] Returns the object in the form of hash
|
191
|
-
def to_body
|
192
|
-
to_hash
|
193
|
-
end
|
194
|
-
|
195
|
-
# Returns the object in the form of hash
|
196
|
-
# @return [Hash] Returns the object in the form of hash
|
197
|
-
def to_hash
|
198
|
-
hash = {}
|
199
|
-
self.class.attribute_map.each_pair do |attr, param|
|
200
|
-
value = self.send(attr)
|
201
|
-
next if value.nil?
|
202
|
-
hash[param] = _to_hash(value)
|
203
|
-
end
|
204
|
-
hash
|
205
|
-
end
|
206
|
-
|
207
|
-
# Outputs non-array value in the form of hash
|
208
|
-
# For object, use to_hash. Otherwise, just return the value
|
209
|
-
# @param [Object] value Any valid value
|
210
|
-
# @return [Hash] Returns the value in the form of hash
|
211
|
-
def _to_hash(value)
|
212
|
-
if value.is_a?(Array)
|
213
|
-
value.compact.map{ |v| _to_hash(v) }
|
214
|
-
elsif value.is_a?(Hash)
|
215
|
-
{}.tap do |hash|
|
216
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
217
|
-
end
|
218
|
-
elsif value.respond_to? :to_hash
|
219
|
-
value.to_hash
|
220
|
-
else
|
221
|
-
value
|
222
|
-
end
|
223
|
-
end
|
224
|
-
|
225
|
-
end
|
226
|
-
|
227
|
-
end
|
@@ -1,271 +0,0 @@
|
|
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 ProgressReport
|
18
|
-
# The message shown to the user for the progress report.
|
19
|
-
attr_accessor :message
|
20
|
-
|
21
|
-
# The current state of the progress report. The possible values are: 'waiting', 'skipped', 'running', 'completed', 'failed' and 'canceled'. The default is 'waiting'.
|
22
|
-
attr_accessor :state
|
23
|
-
|
24
|
-
# The total count of items to be handled by the ProgressBar.
|
25
|
-
attr_accessor :total
|
26
|
-
|
27
|
-
# The count of items already processed. Defaults to 0.
|
28
|
-
attr_accessor :done
|
29
|
-
|
30
|
-
# The suffix to be shown with the progress report.
|
31
|
-
attr_accessor :suffix
|
32
|
-
|
33
|
-
# The task associated with this progress report.
|
34
|
-
attr_accessor :task
|
35
|
-
|
36
|
-
|
37
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
38
|
-
def self.attribute_map
|
39
|
-
{
|
40
|
-
:'message' => :'message',
|
41
|
-
:'state' => :'state',
|
42
|
-
:'total' => :'total',
|
43
|
-
:'done' => :'done',
|
44
|
-
:'suffix' => :'suffix',
|
45
|
-
:'task' => :'task'
|
46
|
-
}
|
47
|
-
end
|
48
|
-
|
49
|
-
# Attribute type mapping.
|
50
|
-
def self.swagger_types
|
51
|
-
{
|
52
|
-
:'message' => :'String',
|
53
|
-
:'state' => :'String',
|
54
|
-
:'total' => :'Integer',
|
55
|
-
:'done' => :'Integer',
|
56
|
-
:'suffix' => :'String',
|
57
|
-
:'task' => :'String'
|
58
|
-
}
|
59
|
-
end
|
60
|
-
|
61
|
-
# Initializes the object
|
62
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
63
|
-
def initialize(attributes = {})
|
64
|
-
return unless attributes.is_a?(Hash)
|
65
|
-
|
66
|
-
# convert string to symbol for hash key
|
67
|
-
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
68
|
-
|
69
|
-
if attributes.has_key?(:'message')
|
70
|
-
self.message = attributes[:'message']
|
71
|
-
end
|
72
|
-
|
73
|
-
if attributes.has_key?(:'state')
|
74
|
-
self.state = attributes[:'state']
|
75
|
-
end
|
76
|
-
|
77
|
-
if attributes.has_key?(:'total')
|
78
|
-
self.total = attributes[:'total']
|
79
|
-
end
|
80
|
-
|
81
|
-
if attributes.has_key?(:'done')
|
82
|
-
self.done = attributes[:'done']
|
83
|
-
end
|
84
|
-
|
85
|
-
if attributes.has_key?(:'suffix')
|
86
|
-
self.suffix = attributes[:'suffix']
|
87
|
-
end
|
88
|
-
|
89
|
-
if attributes.has_key?(:'task')
|
90
|
-
self.task = attributes[:'task']
|
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 !@message.nil? && @message.to_s.length < 1
|
100
|
-
invalid_properties.push("invalid value for 'message', the character length must be great than or equal to 1.")
|
101
|
-
end
|
102
|
-
|
103
|
-
if !@state.nil? && @state.to_s.length < 1
|
104
|
-
invalid_properties.push("invalid value for 'state', the character length must be great than or equal to 1.")
|
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 !@message.nil? && @message.to_s.length < 1
|
114
|
-
return false if !@state.nil? && @state.to_s.length < 1
|
115
|
-
return true
|
116
|
-
end
|
117
|
-
|
118
|
-
# Custom attribute writer method with validation
|
119
|
-
# @param [Object] message Value to be assigned
|
120
|
-
def message=(message)
|
121
|
-
|
122
|
-
if !message.nil? && message.to_s.length < 1
|
123
|
-
fail ArgumentError, "invalid value for 'message', the character length must be great than or equal to 1."
|
124
|
-
end
|
125
|
-
|
126
|
-
@message = message
|
127
|
-
end
|
128
|
-
|
129
|
-
# Custom attribute writer method with validation
|
130
|
-
# @param [Object] state Value to be assigned
|
131
|
-
def state=(state)
|
132
|
-
|
133
|
-
if !state.nil? && state.to_s.length < 1
|
134
|
-
fail ArgumentError, "invalid value for 'state', the character length must be great than or equal to 1."
|
135
|
-
end
|
136
|
-
|
137
|
-
@state = state
|
138
|
-
end
|
139
|
-
|
140
|
-
# Checks equality by comparing each attribute.
|
141
|
-
# @param [Object] Object to be compared
|
142
|
-
def ==(o)
|
143
|
-
return true if self.equal?(o)
|
144
|
-
self.class == o.class &&
|
145
|
-
message == o.message &&
|
146
|
-
state == o.state &&
|
147
|
-
total == o.total &&
|
148
|
-
done == o.done &&
|
149
|
-
suffix == o.suffix &&
|
150
|
-
task == o.task
|
151
|
-
end
|
152
|
-
|
153
|
-
# @see the `==` method
|
154
|
-
# @param [Object] Object to be compared
|
155
|
-
def eql?(o)
|
156
|
-
self == o
|
157
|
-
end
|
158
|
-
|
159
|
-
# Calculates hash code according to all attributes.
|
160
|
-
# @return [Fixnum] Hash code
|
161
|
-
def hash
|
162
|
-
[message, state, total, done, suffix, task].hash
|
163
|
-
end
|
164
|
-
|
165
|
-
# Builds the object from hash
|
166
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
167
|
-
# @return [Object] Returns the model itself
|
168
|
-
def build_from_hash(attributes)
|
169
|
-
return nil unless attributes.is_a?(Hash)
|
170
|
-
self.class.swagger_types.each_pair do |key, type|
|
171
|
-
if type =~ /\AArray<(.*)>/i
|
172
|
-
# check to ensure the input is an array given that the the attribute
|
173
|
-
# is documented as an array but the input is not
|
174
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
175
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
176
|
-
end
|
177
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
178
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
179
|
-
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
180
|
-
end
|
181
|
-
|
182
|
-
self
|
183
|
-
end
|
184
|
-
|
185
|
-
# Deserializes the data based on type
|
186
|
-
# @param string type Data type
|
187
|
-
# @param string value Value to be deserialized
|
188
|
-
# @return [Object] Deserialized data
|
189
|
-
def _deserialize(type, value)
|
190
|
-
case type.to_sym
|
191
|
-
when :DateTime
|
192
|
-
DateTime.parse(value)
|
193
|
-
when :Date
|
194
|
-
Date.parse(value)
|
195
|
-
when :String
|
196
|
-
value.to_s
|
197
|
-
when :Integer
|
198
|
-
value.to_i
|
199
|
-
when :Float
|
200
|
-
value.to_f
|
201
|
-
when :BOOLEAN
|
202
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
203
|
-
true
|
204
|
-
else
|
205
|
-
false
|
206
|
-
end
|
207
|
-
when :Object
|
208
|
-
# generic object (usually a Hash), return directly
|
209
|
-
value
|
210
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
211
|
-
inner_type = Regexp.last_match[:inner_type]
|
212
|
-
value.map { |v| _deserialize(inner_type, v) }
|
213
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
214
|
-
k_type = Regexp.last_match[:k_type]
|
215
|
-
v_type = Regexp.last_match[:v_type]
|
216
|
-
{}.tap do |hash|
|
217
|
-
value.each do |k, v|
|
218
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
219
|
-
end
|
220
|
-
end
|
221
|
-
else # model
|
222
|
-
temp_model = KatelloPulpApi.const_get(type).new
|
223
|
-
temp_model.build_from_hash(value)
|
224
|
-
end
|
225
|
-
end
|
226
|
-
|
227
|
-
# Returns the string representation of the object
|
228
|
-
# @return [String] String presentation of the object
|
229
|
-
def to_s
|
230
|
-
to_hash.to_s
|
231
|
-
end
|
232
|
-
|
233
|
-
# to_body is an alias to to_hash (backward compatibility)
|
234
|
-
# @return [Hash] Returns the object in the form of hash
|
235
|
-
def to_body
|
236
|
-
to_hash
|
237
|
-
end
|
238
|
-
|
239
|
-
# Returns the object in the form of hash
|
240
|
-
# @return [Hash] Returns the object in the form of hash
|
241
|
-
def to_hash
|
242
|
-
hash = {}
|
243
|
-
self.class.attribute_map.each_pair do |attr, param|
|
244
|
-
value = self.send(attr)
|
245
|
-
next if value.nil?
|
246
|
-
hash[param] = _to_hash(value)
|
247
|
-
end
|
248
|
-
hash
|
249
|
-
end
|
250
|
-
|
251
|
-
# Outputs non-array value in the form of hash
|
252
|
-
# For object, use to_hash. Otherwise, just return the value
|
253
|
-
# @param [Object] value Any valid value
|
254
|
-
# @return [Hash] Returns the value in the form of hash
|
255
|
-
def _to_hash(value)
|
256
|
-
if value.is_a?(Array)
|
257
|
-
value.compact.map{ |v| _to_hash(v) }
|
258
|
-
elsif value.is_a?(Hash)
|
259
|
-
{}.tap do |hash|
|
260
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
261
|
-
end
|
262
|
-
elsif value.respond_to? :to_hash
|
263
|
-
value.to_hash
|
264
|
-
else
|
265
|
-
value
|
266
|
-
end
|
267
|
-
end
|
268
|
-
|
269
|
-
end
|
270
|
-
|
271
|
-
end
|