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
+ # Re-use the output from a previously-completed task
17
+ class TaskOutputReference
18
+ # Name of the task to use the output from
19
+ attr_accessor :task_name
20
+
21
+ # Type to convert the output from the referenced task to; possible values are string, binary
22
+ attr_accessor :target_type
23
+
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'task_name' => :'TaskName',
29
+ :'target_type' => :'TargetType'
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.swagger_types
35
+ {
36
+ :'task_name' => :'String',
37
+ :'target_type' => :'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?(:'TaskName')
50
+ self.task_name = attributes[:'TaskName']
51
+ end
52
+
53
+ if attributes.has_key?(:'TargetType')
54
+ self.target_type = attributes[:'TargetType']
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
+ task_name == o.task_name &&
78
+ target_type == o.target_type
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
+ [task_name, target_type].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,206 @@
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 update a setting
17
+ class UpdateSettingRequest
18
+ attr_accessor :bucket_id
19
+
20
+ attr_accessor :bucket_secret_key
21
+
22
+ attr_accessor :setting_to_update
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
+ :'setting_to_update' => :'SettingToUpdate'
31
+ }
32
+ end
33
+
34
+ # Attribute type mapping.
35
+ def self.swagger_types
36
+ {
37
+ :'bucket_id' => :'String',
38
+ :'bucket_secret_key' => :'String',
39
+ :'setting_to_update' => :'SettingValue'
40
+ }
41
+ end
42
+
43
+ # Initializes the object
44
+ # @param [Hash] attributes Model attributes in the form of hash
45
+ def initialize(attributes = {})
46
+ return unless attributes.is_a?(Hash)
47
+
48
+ # convert string to symbol for hash key
49
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
50
+
51
+ if attributes.has_key?(:'BucketID')
52
+ self.bucket_id = attributes[:'BucketID']
53
+ end
54
+
55
+ if attributes.has_key?(:'BucketSecretKey')
56
+ self.bucket_secret_key = attributes[:'BucketSecretKey']
57
+ end
58
+
59
+ if attributes.has_key?(:'SettingToUpdate')
60
+ self.setting_to_update = attributes[:'SettingToUpdate']
61
+ end
62
+
63
+ end
64
+
65
+ # Show invalid properties with the reasons. Usually used together with valid?
66
+ # @return Array for valid properties with the reasons
67
+ def list_invalid_properties
68
+ invalid_properties = Array.new
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 true
76
+ end
77
+
78
+ # Checks equality by comparing each attribute.
79
+ # @param [Object] Object to be compared
80
+ def ==(o)
81
+ return true if self.equal?(o)
82
+ self.class == o.class &&
83
+ bucket_id == o.bucket_id &&
84
+ bucket_secret_key == o.bucket_secret_key &&
85
+ setting_to_update == o.setting_to_update
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
+ [bucket_id, bucket_secret_key, setting_to_update].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 = CloudmersiveConfigurationApiClient.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
@@ -0,0 +1,197 @@
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
+
17
+ class UpdateSettingResponse
18
+ attr_accessor :successful
19
+
20
+ attr_accessor :error_message
21
+
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'successful' => :'Successful',
27
+ :'error_message' => :'ErrorMessage'
28
+ }
29
+ end
30
+
31
+ # Attribute type mapping.
32
+ def self.swagger_types
33
+ {
34
+ :'successful' => :'BOOLEAN',
35
+ :'error_message' => :'String'
36
+ }
37
+ end
38
+
39
+ # Initializes the object
40
+ # @param [Hash] attributes Model attributes in the form of hash
41
+ def initialize(attributes = {})
42
+ return unless attributes.is_a?(Hash)
43
+
44
+ # convert string to symbol for hash key
45
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
46
+
47
+ if attributes.has_key?(:'Successful')
48
+ self.successful = attributes[:'Successful']
49
+ end
50
+
51
+ if attributes.has_key?(:'ErrorMessage')
52
+ self.error_message = attributes[:'ErrorMessage']
53
+ end
54
+
55
+ end
56
+
57
+ # Show invalid properties with the reasons. Usually used together with valid?
58
+ # @return Array for valid properties with the reasons
59
+ def list_invalid_properties
60
+ invalid_properties = Array.new
61
+ return invalid_properties
62
+ end
63
+
64
+ # Check to see if the all the properties in the model are valid
65
+ # @return true if the model is valid
66
+ def valid?
67
+ return true
68
+ end
69
+
70
+ # Checks equality by comparing each attribute.
71
+ # @param [Object] Object to be compared
72
+ def ==(o)
73
+ return true if self.equal?(o)
74
+ self.class == o.class &&
75
+ successful == o.successful &&
76
+ error_message == o.error_message
77
+ end
78
+
79
+ # @see the `==` method
80
+ # @param [Object] Object to be compared
81
+ def eql?(o)
82
+ self == o
83
+ end
84
+
85
+ # Calculates hash code according to all attributes.
86
+ # @return [Fixnum] Hash code
87
+ def hash
88
+ [successful, error_message].hash
89
+ end
90
+
91
+ # Builds the object from hash
92
+ # @param [Hash] attributes Model attributes in the form of hash
93
+ # @return [Object] Returns the model itself
94
+ def build_from_hash(attributes)
95
+ return nil unless attributes.is_a?(Hash)
96
+ self.class.swagger_types.each_pair do |key, type|
97
+ if type =~ /\AArray<(.*)>/i
98
+ # check to ensure the input is an array given that the the attribute
99
+ # is documented as an array but the input is not
100
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
101
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
102
+ end
103
+ elsif !attributes[self.class.attribute_map[key]].nil?
104
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
105
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
106
+ end
107
+
108
+ self
109
+ end
110
+
111
+ # Deserializes the data based on type
112
+ # @param string type Data type
113
+ # @param string value Value to be deserialized
114
+ # @return [Object] Deserialized data
115
+ def _deserialize(type, value)
116
+ case type.to_sym
117
+ when :DateTime
118
+ DateTime.parse(value)
119
+ when :Date
120
+ Date.parse(value)
121
+ when :String
122
+ value.to_s
123
+ when :Integer
124
+ value.to_i
125
+ when :Float
126
+ value.to_f
127
+ when :BOOLEAN
128
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
129
+ true
130
+ else
131
+ false
132
+ end
133
+ when :Object
134
+ # generic object (usually a Hash), return directly
135
+ value
136
+ when /\AArray<(?<inner_type>.+)>\z/
137
+ inner_type = Regexp.last_match[:inner_type]
138
+ value.map { |v| _deserialize(inner_type, v) }
139
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
140
+ k_type = Regexp.last_match[:k_type]
141
+ v_type = Regexp.last_match[:v_type]
142
+ {}.tap do |hash|
143
+ value.each do |k, v|
144
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
145
+ end
146
+ end
147
+ else # model
148
+ temp_model = CloudmersiveConfigurationApiClient.const_get(type).new
149
+ temp_model.build_from_hash(value)
150
+ end
151
+ end
152
+
153
+ # Returns the string representation of the object
154
+ # @return [String] String presentation of the object
155
+ def to_s
156
+ to_hash.to_s
157
+ end
158
+
159
+ # to_body is an alias to to_hash (backward compatibility)
160
+ # @return [Hash] Returns the object in the form of hash
161
+ def to_body
162
+ to_hash
163
+ end
164
+
165
+ # Returns the object in the form of hash
166
+ # @return [Hash] Returns the object in the form of hash
167
+ def to_hash
168
+ hash = {}
169
+ self.class.attribute_map.each_pair do |attr, param|
170
+ value = self.send(attr)
171
+ next if value.nil?
172
+ hash[param] = _to_hash(value)
173
+ end
174
+ hash
175
+ end
176
+
177
+ # Outputs non-array value in the form of hash
178
+ # For object, use to_hash. Otherwise, just return the value
179
+ # @param [Object] value Any valid value
180
+ # @return [Hash] Returns the value in the form of hash
181
+ def _to_hash(value)
182
+ if value.is_a?(Array)
183
+ value.compact.map{ |v| _to_hash(v) }
184
+ elsif value.is_a?(Hash)
185
+ {}.tap do |hash|
186
+ value.each { |k, v| hash[k] = _to_hash(v) }
187
+ end
188
+ elsif value.respond_to? :to_hash
189
+ value.to_hash
190
+ else
191
+ value
192
+ end
193
+ end
194
+
195
+ end
196
+
197
+ end