zest 0.0.1 → 0.0.2

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