swagger_aem 3.8.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +107 -34
  3. data/README.md +8 -12
  4. data/bin/byebug +16 -0
  5. data/bin/coderay +16 -0
  6. data/bin/htmldiff +16 -0
  7. data/bin/ldiff +16 -0
  8. data/bin/pry +16 -0
  9. data/bin/racc +16 -0
  10. data/bin/rake +16 -0
  11. data/bin/rspec +16 -0
  12. data/bin/rubocop +16 -0
  13. data/bin/ruby-parse +16 -0
  14. data/bin/ruby-rewrite +16 -0
  15. data/docs/BundleData.md +24 -23
  16. data/docs/BundleDataProp.md +10 -9
  17. data/docs/BundleInfo.md +12 -11
  18. data/docs/ConsoleApi.md +188 -79
  19. data/docs/CqApi.md +52 -16
  20. data/docs/CrxApi.md +192 -64
  21. data/docs/CustomApi.md +85 -32
  22. data/docs/GraniteApi.md +37 -20
  23. data/docs/InstallStatus.md +8 -7
  24. data/docs/InstallStatusStatus.md +10 -9
  25. data/docs/KeystoreChainItems.md +16 -15
  26. data/docs/KeystoreInfo.md +10 -9
  27. data/docs/KeystoreItems.md +16 -15
  28. data/docs/SamlConfigurationInfo.md +18 -17
  29. data/docs/SamlConfigurationProperties.md +54 -53
  30. data/docs/SamlConfigurationPropertyItemsArray.md +18 -17
  31. data/docs/SamlConfigurationPropertyItemsBoolean.md +18 -17
  32. data/docs/SamlConfigurationPropertyItemsLong.md +18 -17
  33. data/docs/SamlConfigurationPropertyItemsString.md +18 -17
  34. data/docs/SlingApi.md +1021 -496
  35. data/docs/TruststoreInfo.md +10 -9
  36. data/docs/TruststoreItems.md +20 -19
  37. data/git_push.sh +3 -4
  38. data/lib/swagger_aem/api/console_api.rb +33 -27
  39. data/lib/swagger_aem/api/cq_api.rb +11 -9
  40. data/lib/swagger_aem/api/crx_api.rb +42 -32
  41. data/lib/swagger_aem/api/custom_api.rb +15 -12
  42. data/lib/swagger_aem/api/granite_api.rb +11 -7
  43. data/lib/swagger_aem/api/sling_api.rb +342 -298
  44. data/lib/swagger_aem/api_client.rb +73 -64
  45. data/lib/swagger_aem/api_error.rb +3 -2
  46. data/lib/swagger_aem/api_model_base.rb +88 -0
  47. data/lib/swagger_aem/configuration.rb +75 -15
  48. data/lib/swagger_aem/models/bundle_data.rb +32 -91
  49. data/lib/swagger_aem/models/bundle_data_prop.rb +32 -91
  50. data/lib/swagger_aem/models/bundle_info.rb +32 -91
  51. data/lib/swagger_aem/models/install_status.rb +32 -91
  52. data/lib/swagger_aem/models/install_status_status.rb +32 -91
  53. data/lib/swagger_aem/models/keystore_chain_items.rb +32 -91
  54. data/lib/swagger_aem/models/keystore_info.rb +32 -91
  55. data/lib/swagger_aem/models/keystore_items.rb +32 -91
  56. data/lib/swagger_aem/models/saml_configuration_info.rb +32 -91
  57. data/lib/swagger_aem/models/saml_configuration_properties.rb +32 -91
  58. data/lib/swagger_aem/models/saml_configuration_property_items_array.rb +32 -91
  59. data/lib/swagger_aem/models/saml_configuration_property_items_boolean.rb +32 -91
  60. data/lib/swagger_aem/models/saml_configuration_property_items_long.rb +32 -91
  61. data/lib/swagger_aem/models/saml_configuration_property_items_string.rb +32 -91
  62. data/lib/swagger_aem/models/truststore_info.rb +32 -91
  63. data/lib/swagger_aem/models/truststore_items.rb +32 -91
  64. data/lib/swagger_aem/version.rb +3 -3
  65. data/lib/swagger_aem.rb +3 -8
  66. data/spec/api/console_api_spec.rb +8 -8
  67. data/spec/api/cq_api_spec.rb +4 -4
  68. data/spec/api/crx_api_spec.rb +9 -9
  69. data/spec/api/custom_api_spec.rb +5 -5
  70. data/spec/api/granite_api_spec.rb +3 -3
  71. data/spec/api/sling_api_spec.rb +89 -87
  72. data/spec/models/bundle_data_prop_spec.rb +8 -6
  73. data/spec/models/bundle_data_spec.rb +15 -13
  74. data/spec/models/bundle_info_spec.rb +9 -7
  75. data/spec/models/install_status_spec.rb +7 -5
  76. data/spec/models/install_status_status_spec.rb +8 -6
  77. data/spec/models/keystore_chain_items_spec.rb +11 -9
  78. data/spec/models/keystore_info_spec.rb +8 -6
  79. data/spec/models/keystore_items_spec.rb +11 -9
  80. data/spec/models/saml_configuration_info_spec.rb +12 -10
  81. data/spec/models/saml_configuration_properties_spec.rb +30 -28
  82. data/spec/models/saml_configuration_property_items_array_spec.rb +12 -10
  83. data/spec/models/saml_configuration_property_items_boolean_spec.rb +12 -10
  84. data/spec/models/saml_configuration_property_items_long_spec.rb +12 -10
  85. data/spec/models/saml_configuration_property_items_string_spec.rb +12 -10
  86. data/spec/models/truststore_info_spec.rb +8 -6
  87. data/spec/models/truststore_items_spec.rb +13 -11
  88. data/spec/spec_helper.rb +2 -2
  89. data/swagger_aem.gemspec +4 -4
  90. metadata +15 -54
  91. data/docs/InlineObject.md +0 -17
  92. data/docs/InlineObject1.md +0 -17
  93. data/docs/InlineObject2.md +0 -17
  94. data/docs/InlineObject3.md +0 -17
  95. data/docs/InlineObject4.md +0 -21
  96. data/docs/InlineObject5.md +0 -19
  97. data/lib/swagger_aem/models/inline_object.rb +0 -206
  98. data/lib/swagger_aem/models/inline_object1.rb +0 -206
  99. data/lib/swagger_aem/models/inline_object2.rb +0 -206
  100. data/lib/swagger_aem/models/inline_object3.rb +0 -206
  101. data/lib/swagger_aem/models/inline_object4.rb +0 -224
  102. data/lib/swagger_aem/models/inline_object5.rb +0 -215
  103. data/spec/api_client_spec.rb +0 -226
  104. data/spec/configuration_spec.rb +0 -42
  105. data/spec/models/inline_object1_spec.rb +0 -41
  106. data/spec/models/inline_object2_spec.rb +0 -41
  107. data/spec/models/inline_object3_spec.rb +0 -41
  108. data/spec/models/inline_object4_spec.rb +0 -53
  109. data/spec/models/inline_object5_spec.rb +0 -47
  110. data/spec/models/inline_object_spec.rb +0 -41
@@ -3,17 +3,18 @@
3
3
 
4
4
  #Swagger AEM is an OpenAPI specification for Adobe Experience Manager (AEM) API
5
5
 
6
- The version of the OpenAPI document: 3.7.1-pre.0
6
+ The version of the OpenAPI document: 4.0.0
7
7
  Contact: opensource@shinesolutions.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ Generator version: 7.24.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module SwaggerAemClient
16
- class KeystoreInfo
17
+ class KeystoreInfo < ApiModelBase
17
18
  attr_accessor :aliases
18
19
 
19
20
  # False if truststore don't exist
@@ -27,6 +28,16 @@ module SwaggerAemClient
27
28
  }
28
29
  end
29
30
 
31
+ # Returns attribute mapping this model knows about
32
+ def self.acceptable_attribute_map
33
+ attribute_map
34
+ end
35
+
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ acceptable_attribute_map.values
39
+ end
40
+
30
41
  # Attribute type mapping.
31
42
  def self.openapi_types
32
43
  {
@@ -49,9 +60,10 @@ module SwaggerAemClient
49
60
  end
50
61
 
51
62
  # check to see if the attribute exists and convert string to symbol for hash key
63
+ acceptable_attribute_map = self.class.acceptable_attribute_map
52
64
  attributes = attributes.each_with_object({}) { |(k, v), h|
53
- if (!self.class.attribute_map.key?(k.to_sym))
54
- fail ArgumentError, "`#{k}` is not a valid attribute in `SwaggerAemClient::KeystoreInfo`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
65
+ if (!acceptable_attribute_map.key?(k.to_sym))
66
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SwaggerAemClient::KeystoreInfo`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
55
67
  end
56
68
  h[k.to_sym] = v
57
69
  }
@@ -70,6 +82,7 @@ module SwaggerAemClient
70
82
  # Show invalid properties with the reasons. Usually used together with valid?
71
83
  # @return Array for valid properties with the reasons
72
84
  def list_invalid_properties
85
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
73
86
  invalid_properties = Array.new
74
87
  invalid_properties
75
88
  end
@@ -77,6 +90,7 @@ module SwaggerAemClient
77
90
  # Check to see if the all the properties in the model are valid
78
91
  # @return true if the model is valid
79
92
  def valid?
93
+ warn '[DEPRECATED] the `valid?` method is obsolete'
80
94
  true
81
95
  end
82
96
 
@@ -105,80 +119,23 @@ module SwaggerAemClient
105
119
  # @param [Hash] attributes Model attributes in the form of hash
106
120
  # @return [Object] Returns the model itself
107
121
  def self.build_from_hash(attributes)
108
- new.build_from_hash(attributes)
109
- end
110
-
111
- # Builds the object from hash
112
- # @param [Hash] attributes Model attributes in the form of hash
113
- # @return [Object] Returns the model itself
114
- def build_from_hash(attributes)
115
122
  return nil unless attributes.is_a?(Hash)
116
- self.class.openapi_types.each_pair do |key, type|
117
- if type =~ /\AArray<(.*)>/i
123
+ attributes = attributes.transform_keys(&:to_sym)
124
+ transformed_hash = {}
125
+ openapi_types.each_pair do |key, type|
126
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
127
+ transformed_hash["#{key}"] = nil
128
+ elsif type =~ /\AArray<(.*)>/i
118
129
  # check to ensure the input is an array given that the attribute
119
130
  # is documented as an array but the input is not
120
- if attributes[self.class.attribute_map[key]].is_a?(Array)
121
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
131
+ if attributes[attribute_map[key]].is_a?(Array)
132
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
122
133
  end
123
- elsif !attributes[self.class.attribute_map[key]].nil?
124
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
125
- end # or else data not found in attributes(hash), not an issue as the data can be optional
126
- end
127
-
128
- self
129
- end
130
-
131
- # Deserializes the data based on type
132
- # @param string type Data type
133
- # @param string value Value to be deserialized
134
- # @return [Object] Deserialized data
135
- def _deserialize(type, value)
136
- case type.to_sym
137
- when :DateTime
138
- DateTime.parse(value)
139
- when :Date
140
- Date.parse(value)
141
- when :String
142
- value.to_s
143
- when :Integer
144
- value.to_i
145
- when :Float
146
- value.to_f
147
- when :Boolean
148
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
149
- true
150
- else
151
- false
134
+ elsif !attributes[attribute_map[key]].nil?
135
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
152
136
  end
153
- when :Object
154
- # generic object (usually a Hash), return directly
155
- value
156
- when /\AArray<(?<inner_type>.+)>\z/
157
- inner_type = Regexp.last_match[:inner_type]
158
- value.map { |v| _deserialize(inner_type, v) }
159
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
160
- k_type = Regexp.last_match[:k_type]
161
- v_type = Regexp.last_match[:v_type]
162
- {}.tap do |hash|
163
- value.each do |k, v|
164
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
165
- end
166
- end
167
- else # model
168
- SwaggerAemClient.const_get(type).build_from_hash(value)
169
137
  end
170
- end
171
-
172
- # Returns the string representation of the object
173
- # @return [String] String presentation of the object
174
- def to_s
175
- to_hash.to_s
176
- end
177
-
178
- # to_body is an alias to to_hash (backward compatibility)
179
- # @return [Hash] Returns the object in the form of hash
180
- def to_body
181
- to_hash
138
+ new(transformed_hash)
182
139
  end
183
140
 
184
141
  # Returns the object in the form of hash
@@ -191,28 +148,12 @@ module SwaggerAemClient
191
148
  is_nullable = self.class.openapi_nullable.include?(attr)
192
149
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
193
150
  end
194
-
151
+
195
152
  hash[param] = _to_hash(value)
196
153
  end
197
154
  hash
198
155
  end
199
156
 
200
- # Outputs non-array value in the form of hash
201
- # For object, use to_hash. Otherwise, just return the value
202
- # @param [Object] value Any valid value
203
- # @return [Hash] Returns the value in the form of hash
204
- def _to_hash(value)
205
- if value.is_a?(Array)
206
- value.compact.map { |v| _to_hash(v) }
207
- elsif value.is_a?(Hash)
208
- {}.tap do |hash|
209
- value.each { |k, v| hash[k] = _to_hash(v) }
210
- end
211
- elsif value.respond_to? :to_hash
212
- value.to_hash
213
- else
214
- value
215
- end
216
- end
217
157
  end
158
+
218
159
  end
@@ -3,17 +3,18 @@
3
3
 
4
4
  #Swagger AEM is an OpenAPI specification for Adobe Experience Manager (AEM) API
5
5
 
6
- The version of the OpenAPI document: 3.7.1-pre.0
6
+ The version of the OpenAPI document: 4.0.0
7
7
  Contact: opensource@shinesolutions.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ Generator version: 7.24.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module SwaggerAemClient
16
- class KeystoreItems
17
+ class KeystoreItems < ApiModelBase
17
18
  # Keystore alias name
18
19
  attr_accessor :_alias
19
20
 
@@ -39,6 +40,16 @@ module SwaggerAemClient
39
40
  }
40
41
  end
41
42
 
43
+ # Returns attribute mapping this model knows about
44
+ def self.acceptable_attribute_map
45
+ attribute_map
46
+ end
47
+
48
+ # Returns all the JSON keys this model knows about
49
+ def self.acceptable_attributes
50
+ acceptable_attribute_map.values
51
+ end
52
+
42
53
  # Attribute type mapping.
43
54
  def self.openapi_types
44
55
  {
@@ -64,9 +75,10 @@ module SwaggerAemClient
64
75
  end
65
76
 
66
77
  # check to see if the attribute exists and convert string to symbol for hash key
78
+ acceptable_attribute_map = self.class.acceptable_attribute_map
67
79
  attributes = attributes.each_with_object({}) { |(k, v), h|
68
- if (!self.class.attribute_map.key?(k.to_sym))
69
- fail ArgumentError, "`#{k}` is not a valid attribute in `SwaggerAemClient::KeystoreItems`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
80
+ if (!acceptable_attribute_map.key?(k.to_sym))
81
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SwaggerAemClient::KeystoreItems`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
70
82
  end
71
83
  h[k.to_sym] = v
72
84
  }
@@ -97,6 +109,7 @@ module SwaggerAemClient
97
109
  # Show invalid properties with the reasons. Usually used together with valid?
98
110
  # @return Array for valid properties with the reasons
99
111
  def list_invalid_properties
112
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
100
113
  invalid_properties = Array.new
101
114
  invalid_properties
102
115
  end
@@ -104,6 +117,7 @@ module SwaggerAemClient
104
117
  # Check to see if the all the properties in the model are valid
105
118
  # @return true if the model is valid
106
119
  def valid?
120
+ warn '[DEPRECATED] the `valid?` method is obsolete'
107
121
  true
108
122
  end
109
123
 
@@ -135,80 +149,23 @@ module SwaggerAemClient
135
149
  # @param [Hash] attributes Model attributes in the form of hash
136
150
  # @return [Object] Returns the model itself
137
151
  def self.build_from_hash(attributes)
138
- new.build_from_hash(attributes)
139
- end
140
-
141
- # Builds the object from hash
142
- # @param [Hash] attributes Model attributes in the form of hash
143
- # @return [Object] Returns the model itself
144
- def build_from_hash(attributes)
145
152
  return nil unless attributes.is_a?(Hash)
146
- self.class.openapi_types.each_pair do |key, type|
147
- if type =~ /\AArray<(.*)>/i
153
+ attributes = attributes.transform_keys(&:to_sym)
154
+ transformed_hash = {}
155
+ openapi_types.each_pair do |key, type|
156
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
157
+ transformed_hash["#{key}"] = nil
158
+ elsif type =~ /\AArray<(.*)>/i
148
159
  # check to ensure the input is an array given that the attribute
149
160
  # is documented as an array but the input is not
150
- if attributes[self.class.attribute_map[key]].is_a?(Array)
151
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
161
+ if attributes[attribute_map[key]].is_a?(Array)
162
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
152
163
  end
153
- elsif !attributes[self.class.attribute_map[key]].nil?
154
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
155
- end # or else data not found in attributes(hash), not an issue as the data can be optional
156
- end
157
-
158
- self
159
- end
160
-
161
- # Deserializes the data based on type
162
- # @param string type Data type
163
- # @param string value Value to be deserialized
164
- # @return [Object] Deserialized data
165
- def _deserialize(type, value)
166
- case type.to_sym
167
- when :DateTime
168
- DateTime.parse(value)
169
- when :Date
170
- Date.parse(value)
171
- when :String
172
- value.to_s
173
- when :Integer
174
- value.to_i
175
- when :Float
176
- value.to_f
177
- when :Boolean
178
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
179
- true
180
- else
181
- false
164
+ elsif !attributes[attribute_map[key]].nil?
165
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
182
166
  end
183
- when :Object
184
- # generic object (usually a Hash), return directly
185
- value
186
- when /\AArray<(?<inner_type>.+)>\z/
187
- inner_type = Regexp.last_match[:inner_type]
188
- value.map { |v| _deserialize(inner_type, v) }
189
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
190
- k_type = Regexp.last_match[:k_type]
191
- v_type = Regexp.last_match[:v_type]
192
- {}.tap do |hash|
193
- value.each do |k, v|
194
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
195
- end
196
- end
197
- else # model
198
- SwaggerAemClient.const_get(type).build_from_hash(value)
199
167
  end
200
- end
201
-
202
- # Returns the string representation of the object
203
- # @return [String] String presentation of the object
204
- def to_s
205
- to_hash.to_s
206
- end
207
-
208
- # to_body is an alias to to_hash (backward compatibility)
209
- # @return [Hash] Returns the object in the form of hash
210
- def to_body
211
- to_hash
168
+ new(transformed_hash)
212
169
  end
213
170
 
214
171
  # Returns the object in the form of hash
@@ -221,28 +178,12 @@ module SwaggerAemClient
221
178
  is_nullable = self.class.openapi_nullable.include?(attr)
222
179
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
223
180
  end
224
-
181
+
225
182
  hash[param] = _to_hash(value)
226
183
  end
227
184
  hash
228
185
  end
229
186
 
230
- # Outputs non-array value in the form of hash
231
- # For object, use to_hash. Otherwise, just return the value
232
- # @param [Object] value Any valid value
233
- # @return [Hash] Returns the value in the form of hash
234
- def _to_hash(value)
235
- if value.is_a?(Array)
236
- value.compact.map { |v| _to_hash(v) }
237
- elsif value.is_a?(Hash)
238
- {}.tap do |hash|
239
- value.each { |k, v| hash[k] = _to_hash(v) }
240
- end
241
- elsif value.respond_to? :to_hash
242
- value.to_hash
243
- else
244
- value
245
- end
246
- end
247
187
  end
188
+
248
189
  end
@@ -3,17 +3,18 @@
3
3
 
4
4
  #Swagger AEM is an OpenAPI specification for Adobe Experience Manager (AEM) API
5
5
 
6
- The version of the OpenAPI document: 3.7.1-pre.0
6
+ The version of the OpenAPI document: 4.0.0
7
7
  Contact: opensource@shinesolutions.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ Generator version: 7.24.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module SwaggerAemClient
16
- class SamlConfigurationInfo
17
+ class SamlConfigurationInfo < ApiModelBase
17
18
  # Persistent Identity (PID)
18
19
  attr_accessor :pid
19
20
 
@@ -43,6 +44,16 @@ module SwaggerAemClient
43
44
  }
44
45
  end
45
46
 
47
+ # Returns attribute mapping this model knows about
48
+ def self.acceptable_attribute_map
49
+ attribute_map
50
+ end
51
+
52
+ # Returns all the JSON keys this model knows about
53
+ def self.acceptable_attributes
54
+ acceptable_attribute_map.values
55
+ end
56
+
46
57
  # Attribute type mapping.
47
58
  def self.openapi_types
48
59
  {
@@ -69,9 +80,10 @@ module SwaggerAemClient
69
80
  end
70
81
 
71
82
  # check to see if the attribute exists and convert string to symbol for hash key
83
+ acceptable_attribute_map = self.class.acceptable_attribute_map
72
84
  attributes = attributes.each_with_object({}) { |(k, v), h|
73
- if (!self.class.attribute_map.key?(k.to_sym))
74
- fail ArgumentError, "`#{k}` is not a valid attribute in `SwaggerAemClient::SamlConfigurationInfo`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
85
+ if (!acceptable_attribute_map.key?(k.to_sym))
86
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SwaggerAemClient::SamlConfigurationInfo`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
75
87
  end
76
88
  h[k.to_sym] = v
77
89
  }
@@ -104,6 +116,7 @@ module SwaggerAemClient
104
116
  # Show invalid properties with the reasons. Usually used together with valid?
105
117
  # @return Array for valid properties with the reasons
106
118
  def list_invalid_properties
119
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
107
120
  invalid_properties = Array.new
108
121
  invalid_properties
109
122
  end
@@ -111,6 +124,7 @@ module SwaggerAemClient
111
124
  # Check to see if the all the properties in the model are valid
112
125
  # @return true if the model is valid
113
126
  def valid?
127
+ warn '[DEPRECATED] the `valid?` method is obsolete'
114
128
  true
115
129
  end
116
130
 
@@ -143,80 +157,23 @@ module SwaggerAemClient
143
157
  # @param [Hash] attributes Model attributes in the form of hash
144
158
  # @return [Object] Returns the model itself
145
159
  def self.build_from_hash(attributes)
146
- new.build_from_hash(attributes)
147
- end
148
-
149
- # Builds the object from hash
150
- # @param [Hash] attributes Model attributes in the form of hash
151
- # @return [Object] Returns the model itself
152
- def build_from_hash(attributes)
153
160
  return nil unless attributes.is_a?(Hash)
154
- self.class.openapi_types.each_pair do |key, type|
155
- if type =~ /\AArray<(.*)>/i
161
+ attributes = attributes.transform_keys(&:to_sym)
162
+ transformed_hash = {}
163
+ openapi_types.each_pair do |key, type|
164
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
165
+ transformed_hash["#{key}"] = nil
166
+ elsif type =~ /\AArray<(.*)>/i
156
167
  # check to ensure the input is an array given that the attribute
157
168
  # is documented as an array but the input is not
158
- if attributes[self.class.attribute_map[key]].is_a?(Array)
159
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
169
+ if attributes[attribute_map[key]].is_a?(Array)
170
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
160
171
  end
161
- elsif !attributes[self.class.attribute_map[key]].nil?
162
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
163
- end # or else data not found in attributes(hash), not an issue as the data can be optional
164
- end
165
-
166
- self
167
- end
168
-
169
- # Deserializes the data based on type
170
- # @param string type Data type
171
- # @param string value Value to be deserialized
172
- # @return [Object] Deserialized data
173
- def _deserialize(type, value)
174
- case type.to_sym
175
- when :DateTime
176
- DateTime.parse(value)
177
- when :Date
178
- Date.parse(value)
179
- when :String
180
- value.to_s
181
- when :Integer
182
- value.to_i
183
- when :Float
184
- value.to_f
185
- when :Boolean
186
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
187
- true
188
- else
189
- false
172
+ elsif !attributes[attribute_map[key]].nil?
173
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
190
174
  end
191
- when :Object
192
- # generic object (usually a Hash), return directly
193
- value
194
- when /\AArray<(?<inner_type>.+)>\z/
195
- inner_type = Regexp.last_match[:inner_type]
196
- value.map { |v| _deserialize(inner_type, v) }
197
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
198
- k_type = Regexp.last_match[:k_type]
199
- v_type = Regexp.last_match[:v_type]
200
- {}.tap do |hash|
201
- value.each do |k, v|
202
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
203
- end
204
- end
205
- else # model
206
- SwaggerAemClient.const_get(type).build_from_hash(value)
207
175
  end
208
- end
209
-
210
- # Returns the string representation of the object
211
- # @return [String] String presentation of the object
212
- def to_s
213
- to_hash.to_s
214
- end
215
-
216
- # to_body is an alias to to_hash (backward compatibility)
217
- # @return [Hash] Returns the object in the form of hash
218
- def to_body
219
- to_hash
176
+ new(transformed_hash)
220
177
  end
221
178
 
222
179
  # Returns the object in the form of hash
@@ -229,28 +186,12 @@ module SwaggerAemClient
229
186
  is_nullable = self.class.openapi_nullable.include?(attr)
230
187
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
231
188
  end
232
-
189
+
233
190
  hash[param] = _to_hash(value)
234
191
  end
235
192
  hash
236
193
  end
237
194
 
238
- # Outputs non-array value in the form of hash
239
- # For object, use to_hash. Otherwise, just return the value
240
- # @param [Object] value Any valid value
241
- # @return [Hash] Returns the value in the form of hash
242
- def _to_hash(value)
243
- if value.is_a?(Array)
244
- value.compact.map { |v| _to_hash(v) }
245
- elsif value.is_a?(Hash)
246
- {}.tap do |hash|
247
- value.each { |k, v| hash[k] = _to_hash(v) }
248
- end
249
- elsif value.respond_to? :to_hash
250
- value.to_hash
251
- else
252
- value
253
- end
254
- end
255
195
  end
196
+
256
197
  end