cloudmersive-configuration-api-client 1.7.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/README.md +121 -0
  4. data/Rakefile +8 -0
  5. data/cloudmersive-configuration-api-client.gemspec +45 -0
  6. data/docs/CreateSettingRequest.md +14 -0
  7. data/docs/CreateSettingResponse.md +11 -0
  8. data/docs/HttpFormDataParameter.md +11 -0
  9. data/docs/HttpGetParameter.md +10 -0
  10. data/docs/HttpOrchestrationHeader.md +10 -0
  11. data/docs/HttpOrchestrationRequest.md +8 -0
  12. data/docs/HttpOrchestrationResponse.md +11 -0
  13. data/docs/HttpOrchestrationTask.md +16 -0
  14. data/docs/HttpRawBinaryParameter.md +9 -0
  15. data/docs/HttpRawTextParameter.md +9 -0
  16. data/docs/HttpWwwFormUrlEncodedParameter.md +10 -0
  17. data/docs/ListSettingsRequest.md +9 -0
  18. data/docs/ListSettingsResponse.md +8 -0
  19. data/docs/OrchestratorApi.md +61 -0
  20. data/docs/SettingValue.md +15 -0
  21. data/docs/SettingsApi.md +167 -0
  22. data/docs/TaskOutputReference.md +9 -0
  23. data/docs/UpdateSettingRequest.md +10 -0
  24. data/docs/UpdateSettingResponse.md +9 -0
  25. data/git_push.sh +55 -0
  26. data/lib/cloudmersive-configuration-api-client.rb +58 -0
  27. data/lib/cloudmersive-configuration-api-client/api/orchestrator_api.rb +78 -0
  28. data/lib/cloudmersive-configuration-api-client/api/settings_api.rb +188 -0
  29. data/lib/cloudmersive-configuration-api-client/api_client.rb +389 -0
  30. data/lib/cloudmersive-configuration-api-client/api_error.rb +38 -0
  31. data/lib/cloudmersive-configuration-api-client/configuration.rb +209 -0
  32. data/lib/cloudmersive-configuration-api-client/models/create_setting_request.rb +249 -0
  33. data/lib/cloudmersive-configuration-api-client/models/create_setting_response.rb +219 -0
  34. data/lib/cloudmersive-configuration-api-client/models/http_form_data_parameter.rb +235 -0
  35. data/lib/cloudmersive-configuration-api-client/models/http_get_parameter.rb +209 -0
  36. data/lib/cloudmersive-configuration-api-client/models/http_orchestration_header.rb +209 -0
  37. data/lib/cloudmersive-configuration-api-client/models/http_orchestration_request.rb +191 -0
  38. data/lib/cloudmersive-configuration-api-client/models/http_orchestration_response.rb +235 -0
  39. data/lib/cloudmersive-configuration-api-client/models/http_orchestration_task.rb +277 -0
  40. data/lib/cloudmersive-configuration-api-client/models/http_raw_binary_parameter.rb +215 -0
  41. data/lib/cloudmersive-configuration-api-client/models/http_raw_text_parameter.rb +199 -0
  42. data/lib/cloudmersive-configuration-api-client/models/http_www_form_url_encoded_parameter.rb +209 -0
  43. data/lib/cloudmersive-configuration-api-client/models/list_settings_request.rb +199 -0
  44. data/lib/cloudmersive-configuration-api-client/models/list_settings_response.rb +191 -0
  45. data/lib/cloudmersive-configuration-api-client/models/setting_value.rb +259 -0
  46. data/lib/cloudmersive-configuration-api-client/models/task_output_reference.rb +199 -0
  47. data/lib/cloudmersive-configuration-api-client/models/update_setting_request.rb +206 -0
  48. data/lib/cloudmersive-configuration-api-client/models/update_setting_response.rb +197 -0
  49. data/lib/cloudmersive-configuration-api-client/version.rb +15 -0
  50. data/spec/api/orchestrator_api_spec.rb +47 -0
  51. data/spec/api/settings_api_spec.rb +71 -0
  52. data/spec/api_client_spec.rb +226 -0
  53. data/spec/configuration_spec.rb +42 -0
  54. data/spec/models/create_setting_request_spec.rb +78 -0
  55. data/spec/models/create_setting_response_spec.rb +60 -0
  56. data/spec/models/http_form_data_parameter_spec.rb +60 -0
  57. data/spec/models/http_get_parameter_spec.rb +54 -0
  58. data/spec/models/http_orchestration_header_spec.rb +54 -0
  59. data/spec/models/http_orchestration_request_spec.rb +42 -0
  60. data/spec/models/http_orchestration_response_spec.rb +60 -0
  61. data/spec/models/http_orchestration_task_spec.rb +90 -0
  62. data/spec/models/http_raw_binary_parameter_spec.rb +48 -0
  63. data/spec/models/http_raw_text_parameter_spec.rb +48 -0
  64. data/spec/models/http_www_form_url_encoded_parameter_spec.rb +54 -0
  65. data/spec/models/list_settings_request_spec.rb +48 -0
  66. data/spec/models/list_settings_response_spec.rb +42 -0
  67. data/spec/models/setting_value_spec.rb +84 -0
  68. data/spec/models/task_output_reference_spec.rb +48 -0
  69. data/spec/models/update_setting_request_spec.rb +54 -0
  70. data/spec/models/update_setting_response_spec.rb +48 -0
  71. data/spec/spec_helper.rb +111 -0
  72. metadata +294 -0
@@ -0,0 +1,215 @@
1
+ =begin
2
+ #configapi
3
+
4
+ #Config API lets you easily manage configuration at scale.
5
+
6
+ OpenAPI spec version: v1
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 CloudmersiveConfigurationApiClient
16
+ # Raw binary parameter that defines the entire body oft he HTTP payload; cannot be used with other parameter types
17
+ class HttpRawBinaryParameter
18
+ # Binary bytes value of the parameter
19
+ attr_accessor :parameter_value
20
+
21
+ # Optional; use the output from a previous task as the input to this parameter. Set to null (default) to ignore.
22
+ attr_accessor :use_output_from_previous_task
23
+
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'parameter_value' => :'ParameterValue',
29
+ :'use_output_from_previous_task' => :'UseOutputFromPreviousTask'
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.swagger_types
35
+ {
36
+ :'parameter_value' => :'String',
37
+ :'use_output_from_previous_task' => :'TaskOutputReference'
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?(:'ParameterValue')
50
+ self.parameter_value = attributes[:'ParameterValue']
51
+ end
52
+
53
+ if attributes.has_key?(:'UseOutputFromPreviousTask')
54
+ self.use_output_from_previous_task = attributes[:'UseOutputFromPreviousTask']
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
+ if !@parameter_value.nil? && @parameter_value !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
64
+ invalid_properties.push("invalid value for 'parameter_value', must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.")
65
+ end
66
+
67
+ return invalid_properties
68
+ end
69
+
70
+ # Check to see if the all the properties in the model are valid
71
+ # @return true if the model is valid
72
+ def valid?
73
+ return false if !@parameter_value.nil? && @parameter_value !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
74
+ return true
75
+ end
76
+
77
+ # Custom attribute writer method with validation
78
+ # @param [Object] parameter_value Value to be assigned
79
+ def parameter_value=(parameter_value)
80
+
81
+ if !parameter_value.nil? && parameter_value !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
82
+ fail ArgumentError, "invalid value for 'parameter_value', must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."
83
+ end
84
+
85
+ @parameter_value = parameter_value
86
+ end
87
+
88
+ # Checks equality by comparing each attribute.
89
+ # @param [Object] Object to be compared
90
+ def ==(o)
91
+ return true if self.equal?(o)
92
+ self.class == o.class &&
93
+ parameter_value == o.parameter_value &&
94
+ use_output_from_previous_task == o.use_output_from_previous_task
95
+ end
96
+
97
+ # @see the `==` method
98
+ # @param [Object] Object to be compared
99
+ def eql?(o)
100
+ self == o
101
+ end
102
+
103
+ # Calculates hash code according to all attributes.
104
+ # @return [Fixnum] Hash code
105
+ def hash
106
+ [parameter_value, use_output_from_previous_task].hash
107
+ end
108
+
109
+ # Builds the object from hash
110
+ # @param [Hash] attributes Model attributes in the form of hash
111
+ # @return [Object] Returns the model itself
112
+ def build_from_hash(attributes)
113
+ return nil unless attributes.is_a?(Hash)
114
+ self.class.swagger_types.each_pair do |key, type|
115
+ if type =~ /\AArray<(.*)>/i
116
+ # check to ensure the input is an array given that the the attribute
117
+ # is documented as an array but the input is not
118
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
119
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
120
+ end
121
+ elsif !attributes[self.class.attribute_map[key]].nil?
122
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
123
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
124
+ end
125
+
126
+ self
127
+ end
128
+
129
+ # Deserializes the data based on type
130
+ # @param string type Data type
131
+ # @param string value Value to be deserialized
132
+ # @return [Object] Deserialized data
133
+ def _deserialize(type, value)
134
+ case type.to_sym
135
+ when :DateTime
136
+ DateTime.parse(value)
137
+ when :Date
138
+ Date.parse(value)
139
+ when :String
140
+ value.to_s
141
+ when :Integer
142
+ value.to_i
143
+ when :Float
144
+ value.to_f
145
+ when :BOOLEAN
146
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
147
+ true
148
+ else
149
+ false
150
+ end
151
+ when :Object
152
+ # generic object (usually a Hash), return directly
153
+ value
154
+ when /\AArray<(?<inner_type>.+)>\z/
155
+ inner_type = Regexp.last_match[:inner_type]
156
+ value.map { |v| _deserialize(inner_type, v) }
157
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
158
+ k_type = Regexp.last_match[:k_type]
159
+ v_type = Regexp.last_match[:v_type]
160
+ {}.tap do |hash|
161
+ value.each do |k, v|
162
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
163
+ end
164
+ end
165
+ else # model
166
+ temp_model = CloudmersiveConfigurationApiClient.const_get(type).new
167
+ temp_model.build_from_hash(value)
168
+ end
169
+ end
170
+
171
+ # Returns the string representation of the object
172
+ # @return [String] String presentation of the object
173
+ def to_s
174
+ to_hash.to_s
175
+ end
176
+
177
+ # to_body is an alias to to_hash (backward compatibility)
178
+ # @return [Hash] Returns the object in the form of hash
179
+ def to_body
180
+ to_hash
181
+ end
182
+
183
+ # Returns the object in the form of hash
184
+ # @return [Hash] Returns the object in the form of hash
185
+ def to_hash
186
+ hash = {}
187
+ self.class.attribute_map.each_pair do |attr, param|
188
+ value = self.send(attr)
189
+ next if value.nil?
190
+ hash[param] = _to_hash(value)
191
+ end
192
+ hash
193
+ end
194
+
195
+ # Outputs non-array value in the form of hash
196
+ # For object, use to_hash. Otherwise, just return the value
197
+ # @param [Object] value Any valid value
198
+ # @return [Hash] Returns the value in the form of hash
199
+ def _to_hash(value)
200
+ if value.is_a?(Array)
201
+ value.compact.map{ |v| _to_hash(v) }
202
+ elsif value.is_a?(Hash)
203
+ {}.tap do |hash|
204
+ value.each { |k, v| hash[k] = _to_hash(v) }
205
+ end
206
+ elsif value.respond_to? :to_hash
207
+ value.to_hash
208
+ else
209
+ value
210
+ end
211
+ end
212
+
213
+ end
214
+
215
+ end
@@ -0,0 +1,199 @@
1
+ =begin
2
+ #configapi
3
+
4
+ #Config API lets you easily manage configuration at scale.
5
+
6
+ OpenAPI spec version: v1
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 CloudmersiveConfigurationApiClient
16
+ # Raw text parameter that defines the entire body of the HTTP payload; cannot be used with other parameter types
17
+ class HttpRawTextParameter
18
+ # Text value of the parameter
19
+ attr_accessor :parameter_value
20
+
21
+ # Optional; use the output from a previous task as the input to this parameter. Set to null (default) to ignore.
22
+ attr_accessor :use_output_from_previous_task
23
+
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'parameter_value' => :'ParameterValue',
29
+ :'use_output_from_previous_task' => :'UseOutputFromPreviousTask'
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.swagger_types
35
+ {
36
+ :'parameter_value' => :'String',
37
+ :'use_output_from_previous_task' => :'TaskOutputReference'
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?(:'ParameterValue')
50
+ self.parameter_value = attributes[:'ParameterValue']
51
+ end
52
+
53
+ if attributes.has_key?(:'UseOutputFromPreviousTask')
54
+ self.use_output_from_previous_task = attributes[:'UseOutputFromPreviousTask']
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
+ parameter_value == o.parameter_value &&
78
+ use_output_from_previous_task == o.use_output_from_previous_task
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
+ [parameter_value, use_output_from_previous_task].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 = CloudmersiveConfigurationApiClient.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
@@ -0,0 +1,209 @@
1
+ =begin
2
+ #configapi
3
+
4
+ #Config API lets you easily manage configuration at scale.
5
+
6
+ OpenAPI spec version: v1
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 CloudmersiveConfigurationApiClient
16
+ # Defines an x-www-form-urlencoded parameter
17
+ class HttpWwwFormUrlEncodedParameter
18
+ # Key name of the parameter
19
+ attr_accessor :key_name
20
+
21
+ # Key value of the paramer (must be of type text); if set, do not use UseOutputFromPreviousTask
22
+ attr_accessor :key_value
23
+
24
+ # Optional; use the output from a previous task as the input to this parameter. Set to null (default) to ignore.
25
+ attr_accessor :use_output_from_previous_task
26
+
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'key_name' => :'KeyName',
32
+ :'key_value' => :'KeyValue',
33
+ :'use_output_from_previous_task' => :'UseOutputFromPreviousTask'
34
+ }
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.swagger_types
39
+ {
40
+ :'key_name' => :'String',
41
+ :'key_value' => :'String',
42
+ :'use_output_from_previous_task' => :'TaskOutputReference'
43
+ }
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ return unless attributes.is_a?(Hash)
50
+
51
+ # convert string to symbol for hash key
52
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
53
+
54
+ if attributes.has_key?(:'KeyName')
55
+ self.key_name = attributes[:'KeyName']
56
+ end
57
+
58
+ if attributes.has_key?(:'KeyValue')
59
+ self.key_value = attributes[:'KeyValue']
60
+ end
61
+
62
+ if attributes.has_key?(:'UseOutputFromPreviousTask')
63
+ self.use_output_from_previous_task = attributes[:'UseOutputFromPreviousTask']
64
+ end
65
+
66
+ end
67
+
68
+ # Show invalid properties with the reasons. Usually used together with valid?
69
+ # @return Array for valid properties with the reasons
70
+ def list_invalid_properties
71
+ invalid_properties = Array.new
72
+ return invalid_properties
73
+ end
74
+
75
+ # Check to see if the all the properties in the model are valid
76
+ # @return true if the model is valid
77
+ def valid?
78
+ return true
79
+ end
80
+
81
+ # Checks equality by comparing each attribute.
82
+ # @param [Object] Object to be compared
83
+ def ==(o)
84
+ return true if self.equal?(o)
85
+ self.class == o.class &&
86
+ key_name == o.key_name &&
87
+ key_value == o.key_value &&
88
+ use_output_from_previous_task == o.use_output_from_previous_task
89
+ end
90
+
91
+ # @see the `==` method
92
+ # @param [Object] Object to be compared
93
+ def eql?(o)
94
+ self == o
95
+ end
96
+
97
+ # Calculates hash code according to all attributes.
98
+ # @return [Fixnum] Hash code
99
+ def hash
100
+ [key_name, key_value, use_output_from_previous_task].hash
101
+ end
102
+
103
+ # Builds the object from hash
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ # @return [Object] Returns the model itself
106
+ def build_from_hash(attributes)
107
+ return nil unless attributes.is_a?(Hash)
108
+ self.class.swagger_types.each_pair do |key, type|
109
+ if type =~ /\AArray<(.*)>/i
110
+ # check to ensure the input is an array given that the the attribute
111
+ # is documented as an array but the input is not
112
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
113
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
114
+ end
115
+ elsif !attributes[self.class.attribute_map[key]].nil?
116
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
117
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
118
+ end
119
+
120
+ self
121
+ end
122
+
123
+ # Deserializes the data based on type
124
+ # @param string type Data type
125
+ # @param string value Value to be deserialized
126
+ # @return [Object] Deserialized data
127
+ def _deserialize(type, value)
128
+ case type.to_sym
129
+ when :DateTime
130
+ DateTime.parse(value)
131
+ when :Date
132
+ Date.parse(value)
133
+ when :String
134
+ value.to_s
135
+ when :Integer
136
+ value.to_i
137
+ when :Float
138
+ value.to_f
139
+ when :BOOLEAN
140
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
141
+ true
142
+ else
143
+ false
144
+ end
145
+ when :Object
146
+ # generic object (usually a Hash), return directly
147
+ value
148
+ when /\AArray<(?<inner_type>.+)>\z/
149
+ inner_type = Regexp.last_match[:inner_type]
150
+ value.map { |v| _deserialize(inner_type, v) }
151
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
152
+ k_type = Regexp.last_match[:k_type]
153
+ v_type = Regexp.last_match[:v_type]
154
+ {}.tap do |hash|
155
+ value.each do |k, v|
156
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
157
+ end
158
+ end
159
+ else # model
160
+ temp_model = CloudmersiveConfigurationApiClient.const_get(type).new
161
+ temp_model.build_from_hash(value)
162
+ end
163
+ end
164
+
165
+ # Returns the string representation of the object
166
+ # @return [String] String presentation of the object
167
+ def to_s
168
+ to_hash.to_s
169
+ end
170
+
171
+ # to_body is an alias to to_hash (backward compatibility)
172
+ # @return [Hash] Returns the object in the form of hash
173
+ def to_body
174
+ to_hash
175
+ end
176
+
177
+ # Returns the object in the form of hash
178
+ # @return [Hash] Returns the object in the form of hash
179
+ def to_hash
180
+ hash = {}
181
+ self.class.attribute_map.each_pair do |attr, param|
182
+ value = self.send(attr)
183
+ next if value.nil?
184
+ hash[param] = _to_hash(value)
185
+ end
186
+ hash
187
+ end
188
+
189
+ # Outputs non-array value in the form of hash
190
+ # For object, use to_hash. Otherwise, just return the value
191
+ # @param [Object] value Any valid value
192
+ # @return [Hash] Returns the value in the form of hash
193
+ def _to_hash(value)
194
+ if value.is_a?(Array)
195
+ value.compact.map{ |v| _to_hash(v) }
196
+ elsif value.is_a?(Hash)
197
+ {}.tap do |hash|
198
+ value.each { |k, v| hash[k] = _to_hash(v) }
199
+ end
200
+ elsif value.respond_to? :to_hash
201
+ value.to_hash
202
+ else
203
+ value
204
+ end
205
+ end
206
+
207
+ end
208
+
209
+ end