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