groupdocs_platform_cloud 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +22 -0
  3. data/README.md +160 -0
  4. data/Ruby Mustache Templates/ReadMe.txt +1 -0
  5. data/Ruby Mustache Templates/api_client.mustache +441 -0
  6. data/Swagger Specs File/platform.json +1683 -0
  7. data/groupdocs_platform_cloud.gemspec +26 -0
  8. data/lib/groupdocs_platform_cloud.rb +72 -0
  9. data/lib/groupdocs_platform_cloud/api/app_api.rb +359 -0
  10. data/lib/groupdocs_platform_cloud/api/app_statistics_api.rb +572 -0
  11. data/lib/groupdocs_platform_cloud/api/auth_api.rb +176 -0
  12. data/lib/groupdocs_platform_cloud/api/file_api.rb +282 -0
  13. data/lib/groupdocs_platform_cloud/api/folder_api.rb +267 -0
  14. data/lib/groupdocs_platform_cloud/api/heroku_api.rb +241 -0
  15. data/lib/groupdocs_platform_cloud/api/storage_api.rb +249 -0
  16. data/lib/groupdocs_platform_cloud/api/usage_api.rb +233 -0
  17. data/lib/groupdocs_platform_cloud/api_client.rb +446 -0
  18. data/lib/groupdocs_platform_cloud/api_error.rb +38 -0
  19. data/lib/groupdocs_platform_cloud/configuration.rb +216 -0
  20. data/lib/groupdocs_platform_cloud/groupdocs_app.rb +20 -0
  21. data/lib/groupdocs_platform_cloud/models/access_token_list_response.rb +213 -0
  22. data/lib/groupdocs_platform_cloud/models/access_token_response.rb +211 -0
  23. data/lib/groupdocs_platform_cloud/models/app.rb +243 -0
  24. data/lib/groupdocs_platform_cloud/models/app_usage.rb +235 -0
  25. data/lib/groupdocs_platform_cloud/models/application_usage_response.rb +202 -0
  26. data/lib/groupdocs_platform_cloud/models/disc_usage.rb +207 -0
  27. data/lib/groupdocs_platform_cloud/models/disc_usage_response.rb +211 -0
  28. data/lib/groupdocs_platform_cloud/models/file.rb +253 -0
  29. data/lib/groupdocs_platform_cloud/models/file_exist.rb +207 -0
  30. data/lib/groupdocs_platform_cloud/models/file_exist_response.rb +211 -0
  31. data/lib/groupdocs_platform_cloud/models/file_response.rb +224 -0
  32. data/lib/groupdocs_platform_cloud/models/file_version.rb +276 -0
  33. data/lib/groupdocs_platform_cloud/models/file_versions_response.rb +213 -0
  34. data/lib/groupdocs_platform_cloud/models/folder_response.rb +208 -0
  35. data/lib/groupdocs_platform_cloud/models/heroku_request.rb +233 -0
  36. data/lib/groupdocs_platform_cloud/models/heroku_request_options.rb +188 -0
  37. data/lib/groupdocs_platform_cloud/models/move_file_response.rb +202 -0
  38. data/lib/groupdocs_platform_cloud/models/move_folder_response.rb +202 -0
  39. data/lib/groupdocs_platform_cloud/models/remove_file_response.rb +202 -0
  40. data/lib/groupdocs_platform_cloud/models/remove_folder_response.rb +202 -0
  41. data/lib/groupdocs_platform_cloud/models/saa_spose_response.rb +202 -0
  42. data/lib/groupdocs_platform_cloud/models/storage_exist_response.rb +216 -0
  43. data/lib/groupdocs_platform_cloud/models/user_usage_summary_response.rb +211 -0
  44. data/lib/groupdocs_platform_cloud/models/user_usage_summary_statistics.rb +291 -0
  45. data/lib/groupdocs_platform_cloud/version.rb +15 -0
  46. data/test/data/SampleExecuteTemplate.doc +0 -0
  47. data/test/data/SampleExecuteTemplateData.txt +49 -0
  48. data/test/data/SampleWordDocument.docx +0 -0
  49. data/test/data/buzz.png +0 -0
  50. data/test/data/testfile.txt +1 -0
  51. data/test/platform_tests.rb +144 -0
  52. metadata +156 -0
@@ -0,0 +1,207 @@
1
+ =begin
2
+ #Web API Swagger specification
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 1.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module GroupDocsPlatformCloud
16
+
17
+ class FileExist
18
+ attr_accessor :is_exist
19
+
20
+ attr_accessor :is_folder
21
+
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'is_exist' => :'isExist',
27
+ :'is_folder' => :'isFolder'
28
+ }
29
+ end
30
+
31
+ # Attribute type mapping.
32
+ def self.swagger_types
33
+ {
34
+ :'is_exist' => :'BOOLEAN',
35
+ :'is_folder' => :'BOOLEAN'
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?(:'isExist')
48
+ self.is_exist = attributes[:'isExist']
49
+ end
50
+
51
+ if attributes.has_key?(:'isFolder')
52
+ self.is_folder = attributes[:'isFolder']
53
+ end
54
+
55
+ end
56
+
57
+ # Show invalid properties with the reasons. Usually used together with valid?
58
+ # @return Array for valid properies with the reasons
59
+ def list_invalid_properties
60
+ invalid_properties = Array.new
61
+ if @is_exist.nil?
62
+ invalid_properties.push("invalid value for 'is_exist', is_exist cannot be nil.")
63
+ end
64
+
65
+ if @is_folder.nil?
66
+ invalid_properties.push("invalid value for 'is_folder', is_folder cannot be nil.")
67
+ end
68
+
69
+ return invalid_properties
70
+ end
71
+
72
+ # Check to see if the all the properties in the model are valid
73
+ # @return true if the model is valid
74
+ def valid?
75
+ return false if @is_exist.nil?
76
+ return false if @is_folder.nil?
77
+ return true
78
+ end
79
+
80
+ # Checks equality by comparing each attribute.
81
+ # @param [Object] Object to be compared
82
+ def ==(o)
83
+ return true if self.equal?(o)
84
+ self.class == o.class &&
85
+ is_exist == o.is_exist &&
86
+ is_folder == o.is_folder
87
+ end
88
+
89
+ # @see the `==` method
90
+ # @param [Object] Object to be compared
91
+ def eql?(o)
92
+ self == o
93
+ end
94
+
95
+ # Calculates hash code according to all attributes.
96
+ # @return [Fixnum] Hash code
97
+ def hash
98
+ [is_exist, is_folder].hash
99
+ end
100
+
101
+ # Builds the object from hash
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ # @return [Object] Returns the model itself
104
+ def build_from_hash(attributes)
105
+ return nil unless attributes.is_a?(Hash)
106
+ self.class.swagger_types.each_pair do |key, type|
107
+ if type =~ /\AArray<(.*)>/i
108
+ # check to ensure the input is an array given that the the attribute
109
+ # is documented as an array but the input is not
110
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
111
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
112
+ end
113
+ elsif !attributes[self.class.attribute_map[key]].nil?
114
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
115
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
116
+ end
117
+
118
+ self
119
+ end
120
+
121
+ # Deserializes the data based on type
122
+ # @param string type Data type
123
+ # @param string value Value to be deserialized
124
+ # @return [Object] Deserialized data
125
+ def _deserialize(type, value)
126
+ case type.to_sym
127
+ when :DateTime
128
+ DateTime.parse(value)
129
+ when :Date
130
+ Date.parse(value)
131
+ when :String
132
+ value.to_s
133
+ when :Integer
134
+ value.to_i
135
+ when :Float
136
+ value.to_f
137
+ when :BOOLEAN
138
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
139
+ true
140
+ else
141
+ false
142
+ end
143
+ when :Object
144
+ # generic object (usually a Hash), return directly
145
+ value
146
+ when /\AArray<(?<inner_type>.+)>\z/
147
+ inner_type = Regexp.last_match[:inner_type]
148
+ value.map { |v| _deserialize(inner_type, v) }
149
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
150
+ k_type = Regexp.last_match[:k_type]
151
+ v_type = Regexp.last_match[:v_type]
152
+ {}.tap do |hash|
153
+ value.each do |k, v|
154
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
155
+ end
156
+ end
157
+ else # model
158
+ temp_model = GroupDocsPlatformCloud.const_get(type).new
159
+ temp_model.build_from_hash(value)
160
+ end
161
+ end
162
+
163
+ # Returns the string representation of the object
164
+ # @return [String] String presentation of the object
165
+ def to_s
166
+ to_hash.to_s
167
+ end
168
+
169
+ # to_body is an alias to to_hash (backward compatibility)
170
+ # @return [Hash] Returns the object in the form of hash
171
+ def to_body
172
+ to_hash
173
+ end
174
+
175
+ # Returns the object in the form of hash
176
+ # @return [Hash] Returns the object in the form of hash
177
+ def to_hash
178
+ hash = {}
179
+ self.class.attribute_map.each_pair do |attr, param|
180
+ value = self.send(attr)
181
+ next if value.nil?
182
+ hash[param] = _to_hash(value)
183
+ end
184
+ hash
185
+ end
186
+
187
+ # Outputs non-array value in the form of hash
188
+ # For object, use to_hash. Otherwise, just return the value
189
+ # @param [Object] value Any valid value
190
+ # @return [Hash] Returns the value in the form of hash
191
+ def _to_hash(value)
192
+ if value.is_a?(Array)
193
+ value.compact.map{ |v| _to_hash(v) }
194
+ elsif value.is_a?(Hash)
195
+ {}.tap do |hash|
196
+ value.each { |k, v| hash[k] = _to_hash(v) }
197
+ end
198
+ elsif value.respond_to? :to_hash
199
+ value.to_hash
200
+ else
201
+ value
202
+ end
203
+ end
204
+
205
+ end
206
+
207
+ end
@@ -0,0 +1,211 @@
1
+ =begin
2
+ #Web API Swagger specification
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 1.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module GroupDocsPlatformCloud
16
+
17
+ class FileExistResponse
18
+ attr_accessor :code
19
+
20
+ attr_accessor :status
21
+
22
+ attr_accessor :file_exist
23
+
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'code' => :'code',
29
+ :'status' => :'status',
30
+ :'file_exist' => :'fileExist'
31
+ }
32
+ end
33
+
34
+ # Attribute type mapping.
35
+ def self.swagger_types
36
+ {
37
+ :'code' => :'Integer',
38
+ :'status' => :'String',
39
+ :'file_exist' => :'FileExist'
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?(:'code')
52
+ self.code = attributes[:'code']
53
+ end
54
+
55
+ if attributes.has_key?(:'status')
56
+ self.status = attributes[:'status']
57
+ end
58
+
59
+ if attributes.has_key?(:'fileExist')
60
+ self.file_exist = attributes[:'fileExist']
61
+ end
62
+
63
+ end
64
+
65
+ # Show invalid properties with the reasons. Usually used together with valid?
66
+ # @return Array for valid properies with the reasons
67
+ def list_invalid_properties
68
+ invalid_properties = Array.new
69
+ if @code.nil?
70
+ invalid_properties.push("invalid value for 'code', code cannot be nil.")
71
+ end
72
+
73
+ return invalid_properties
74
+ end
75
+
76
+ # Check to see if the all the properties in the model are valid
77
+ # @return true if the model is valid
78
+ def valid?
79
+ return false if @code.nil?
80
+ return true
81
+ end
82
+
83
+ # Checks equality by comparing each attribute.
84
+ # @param [Object] Object to be compared
85
+ def ==(o)
86
+ return true if self.equal?(o)
87
+ self.class == o.class &&
88
+ code == o.code &&
89
+ status == o.status &&
90
+ file_exist == o.file_exist
91
+ end
92
+
93
+ # @see the `==` method
94
+ # @param [Object] Object to be compared
95
+ def eql?(o)
96
+ self == o
97
+ end
98
+
99
+ # Calculates hash code according to all attributes.
100
+ # @return [Fixnum] Hash code
101
+ def hash
102
+ [code, status, file_exist].hash
103
+ end
104
+
105
+ # Builds the object from hash
106
+ # @param [Hash] attributes Model attributes in the form of hash
107
+ # @return [Object] Returns the model itself
108
+ def build_from_hash(attributes)
109
+ return nil unless attributes.is_a?(Hash)
110
+ self.class.swagger_types.each_pair do |key, type|
111
+ if type =~ /\AArray<(.*)>/i
112
+ # check to ensure the input is an array given that the the attribute
113
+ # is documented as an array but the input is not
114
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
115
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
116
+ end
117
+ elsif !attributes[self.class.attribute_map[key]].nil?
118
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
119
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
120
+ end
121
+
122
+ self
123
+ end
124
+
125
+ # Deserializes the data based on type
126
+ # @param string type Data type
127
+ # @param string value Value to be deserialized
128
+ # @return [Object] Deserialized data
129
+ def _deserialize(type, value)
130
+ case type.to_sym
131
+ when :DateTime
132
+ DateTime.parse(value)
133
+ when :Date
134
+ Date.parse(value)
135
+ when :String
136
+ value.to_s
137
+ when :Integer
138
+ value.to_i
139
+ when :Float
140
+ value.to_f
141
+ when :BOOLEAN
142
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
143
+ true
144
+ else
145
+ false
146
+ end
147
+ when :Object
148
+ # generic object (usually a Hash), return directly
149
+ value
150
+ when /\AArray<(?<inner_type>.+)>\z/
151
+ inner_type = Regexp.last_match[:inner_type]
152
+ value.map { |v| _deserialize(inner_type, v) }
153
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
154
+ k_type = Regexp.last_match[:k_type]
155
+ v_type = Regexp.last_match[:v_type]
156
+ {}.tap do |hash|
157
+ value.each do |k, v|
158
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
159
+ end
160
+ end
161
+ else # model
162
+ temp_model = GroupDocsPlatformCloud.const_get(type).new
163
+ temp_model.build_from_hash(value)
164
+ end
165
+ end
166
+
167
+ # Returns the string representation of the object
168
+ # @return [String] String presentation of the object
169
+ def to_s
170
+ to_hash.to_s
171
+ end
172
+
173
+ # to_body is an alias to to_hash (backward compatibility)
174
+ # @return [Hash] Returns the object in the form of hash
175
+ def to_body
176
+ to_hash
177
+ end
178
+
179
+ # Returns the object in the form of hash
180
+ # @return [Hash] Returns the object in the form of hash
181
+ def to_hash
182
+ hash = {}
183
+ self.class.attribute_map.each_pair do |attr, param|
184
+ value = self.send(attr)
185
+ next if value.nil?
186
+ hash[param] = _to_hash(value)
187
+ end
188
+ hash
189
+ end
190
+
191
+ # Outputs non-array value in the form of hash
192
+ # For object, use to_hash. Otherwise, just return the value
193
+ # @param [Object] value Any valid value
194
+ # @return [Hash] Returns the value in the form of hash
195
+ def _to_hash(value)
196
+ if value.is_a?(Array)
197
+ value.compact.map{ |v| _to_hash(v) }
198
+ elsif value.is_a?(Hash)
199
+ {}.tap do |hash|
200
+ value.each { |k, v| hash[k] = _to_hash(v) }
201
+ end
202
+ elsif value.respond_to? :to_hash
203
+ value.to_hash
204
+ else
205
+ value
206
+ end
207
+ end
208
+
209
+ end
210
+
211
+ end
@@ -0,0 +1,224 @@
1
+ =begin
2
+ #Web API Swagger specification
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 1.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module GroupDocsPlatformCloud
16
+
17
+ class FileResponse
18
+ attr_accessor :name
19
+
20
+ attr_accessor :path
21
+
22
+ attr_accessor :modified_date
23
+
24
+ attr_accessor :is_folder
25
+
26
+ attr_accessor :size
27
+
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'name' => :'Name',
33
+ :'path' => :'Path',
34
+ :'modified_date' => :'ModifiedDate',
35
+ :'is_folder' => :'IsFolder',
36
+ :'size' => :'Size'
37
+ }
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.swagger_types
42
+ {
43
+ :'name' => :'String',
44
+ :'path' => :'String',
45
+ :'modified_date' => :'String',
46
+ :'is_folder' => :'BOOLEAN',
47
+ :'size' => :'Integer'
48
+ }
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ return unless attributes.is_a?(Hash)
55
+
56
+ # convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
58
+
59
+ if attributes.has_key?(:'Name')
60
+ self.name = attributes[:'Name']
61
+ end
62
+
63
+ if attributes.has_key?(:'Path')
64
+ self.path = attributes[:'Path']
65
+ end
66
+
67
+ if attributes.has_key?(:'ModifiedDate')
68
+ self.modified_date = attributes[:'ModifiedDate']
69
+ end
70
+
71
+ if attributes.has_key?(:'IsFolder')
72
+ self.is_folder = attributes[:'IsFolder']
73
+ end
74
+
75
+ if attributes.has_key?(:'Size')
76
+ self.size = attributes[:'Size']
77
+ end
78
+
79
+ end
80
+
81
+ # Show invalid properties with the reasons. Usually used together with valid?
82
+ # @return Array for valid properies with the reasons
83
+ def list_invalid_properties
84
+ invalid_properties = Array.new
85
+ return invalid_properties
86
+ end
87
+
88
+ # Check to see if the all the properties in the model are valid
89
+ # @return true if the model is valid
90
+ def valid?
91
+ return true
92
+ end
93
+
94
+ # Checks equality by comparing each attribute.
95
+ # @param [Object] Object to be compared
96
+ def ==(o)
97
+ return true if self.equal?(o)
98
+ self.class == o.class &&
99
+ name == o.name &&
100
+ path == o.path &&
101
+ modified_date == o.modified_date &&
102
+ is_folder == o.is_folder &&
103
+ size == o.size
104
+ end
105
+
106
+ # @see the `==` method
107
+ # @param [Object] Object to be compared
108
+ def eql?(o)
109
+ self == o
110
+ end
111
+
112
+ # Calculates hash code according to all attributes.
113
+ # @return [Fixnum] Hash code
114
+ def hash
115
+ [name, path, modified_date, is_folder, size].hash
116
+ end
117
+
118
+ # Builds the object from hash
119
+ # @param [Hash] attributes Model attributes in the form of hash
120
+ # @return [Object] Returns the model itself
121
+ def build_from_hash(attributes)
122
+ return nil unless attributes.is_a?(Hash)
123
+ self.class.swagger_types.each_pair do |key, type|
124
+ if type =~ /\AArray<(.*)>/i
125
+ # check to ensure the input is an array given that the the attribute
126
+ # is documented as an array but the input is not
127
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
128
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
129
+ end
130
+ elsif !attributes[self.class.attribute_map[key]].nil?
131
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
132
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
133
+ end
134
+
135
+ self
136
+ end
137
+
138
+ # Deserializes the data based on type
139
+ # @param string type Data type
140
+ # @param string value Value to be deserialized
141
+ # @return [Object] Deserialized data
142
+ def _deserialize(type, value)
143
+ case type.to_sym
144
+ when :DateTime
145
+ DateTime.parse(value)
146
+ when :Date
147
+ Date.parse(value)
148
+ when :String
149
+ value.to_s
150
+ when :Integer
151
+ value.to_i
152
+ when :Float
153
+ value.to_f
154
+ when :BOOLEAN
155
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
156
+ true
157
+ else
158
+ false
159
+ end
160
+ when :Object
161
+ # generic object (usually a Hash), return directly
162
+ value
163
+ when /\AArray<(?<inner_type>.+)>\z/
164
+ inner_type = Regexp.last_match[:inner_type]
165
+ value.map { |v| _deserialize(inner_type, v) }
166
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
167
+ k_type = Regexp.last_match[:k_type]
168
+ v_type = Regexp.last_match[:v_type]
169
+ {}.tap do |hash|
170
+ value.each do |k, v|
171
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
172
+ end
173
+ end
174
+ else # model
175
+ temp_model = GroupDocsPlatformCloud.const_get(type).new
176
+ temp_model.build_from_hash(value)
177
+ end
178
+ end
179
+
180
+ # Returns the string representation of the object
181
+ # @return [String] String presentation of the object
182
+ def to_s
183
+ to_hash.to_s
184
+ end
185
+
186
+ # to_body is an alias to to_hash (backward compatibility)
187
+ # @return [Hash] Returns the object in the form of hash
188
+ def to_body
189
+ to_hash
190
+ end
191
+
192
+ # Returns the object in the form of hash
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_hash
195
+ hash = {}
196
+ self.class.attribute_map.each_pair do |attr, param|
197
+ value = self.send(attr)
198
+ next if value.nil?
199
+ hash[param] = _to_hash(value)
200
+ end
201
+ hash
202
+ end
203
+
204
+ # Outputs non-array value in the form of hash
205
+ # For object, use to_hash. Otherwise, just return the value
206
+ # @param [Object] value Any valid value
207
+ # @return [Hash] Returns the value in the form of hash
208
+ def _to_hash(value)
209
+ if value.is_a?(Array)
210
+ value.compact.map{ |v| _to_hash(v) }
211
+ elsif value.is_a?(Hash)
212
+ {}.tap do |hash|
213
+ value.each { |k, v| hash[k] = _to_hash(v) }
214
+ end
215
+ elsif value.respond_to? :to_hash
216
+ value.to_hash
217
+ else
218
+ value
219
+ end
220
+ end
221
+
222
+ end
223
+
224
+ end