messente_api 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/Gemfile.lock +79 -0
  4. data/README.md +118 -0
  5. data/Rakefile +10 -0
  6. data/docs/BlacklistApi.md +209 -0
  7. data/docs/Channel.md +16 -0
  8. data/docs/ContactEnvelope.md +17 -0
  9. data/docs/ContactFields.md +35 -0
  10. data/docs/ContactListEnvelope.md +17 -0
  11. data/docs/ContactUpdateFields.md +33 -0
  12. data/docs/ContactsApi.md +430 -0
  13. data/docs/DeliveryReportApi.md +60 -0
  14. data/docs/DeliveryReportResponse.md +21 -0
  15. data/docs/DeliveryResult.md +27 -0
  16. data/docs/ErrorCodeOmnichannel.md +16 -0
  17. data/docs/ErrorCodeOmnichannelMachine.md +16 -0
  18. data/docs/ErrorCodePhonebook.md +16 -0
  19. data/docs/ErrorItemOmnichannel.md +23 -0
  20. data/docs/ErrorItemPhonebook.md +21 -0
  21. data/docs/ErrorOmnichannel.md +17 -0
  22. data/docs/ErrorPhonebook.md +17 -0
  23. data/docs/ErrorTitleOmnichannel.md +16 -0
  24. data/docs/ErrorTitlePhonebook.md +16 -0
  25. data/docs/FetchBlacklistSuccess.md +17 -0
  26. data/docs/GroupEnvelope.md +17 -0
  27. data/docs/GroupListEnvelope.md +17 -0
  28. data/docs/GroupName.md +17 -0
  29. data/docs/GroupResponseFields.md +23 -0
  30. data/docs/GroupsApi.md +265 -0
  31. data/docs/MessageResult.md +21 -0
  32. data/docs/NumberToBlacklist.md +17 -0
  33. data/docs/OmniMessageCreateSuccessResponse.md +21 -0
  34. data/docs/Omnimessage.md +25 -0
  35. data/docs/OmnimessageApi.md +111 -0
  36. data/docs/SMS.md +27 -0
  37. data/docs/Status.md +16 -0
  38. data/docs/TextStore.md +16 -0
  39. data/docs/Viber.md +29 -0
  40. data/docs/WhatsApp.md +29 -0
  41. data/docs/WhatsAppAudio.md +17 -0
  42. data/docs/WhatsAppDocument.md +19 -0
  43. data/docs/WhatsAppImage.md +19 -0
  44. data/docs/WhatsAppText.md +19 -0
  45. data/git_push.sh +55 -0
  46. data/lib/messente_api.rb +78 -0
  47. data/lib/messente_api/api/blacklist_api.rb +258 -0
  48. data/lib/messente_api/api/contacts_api.rb +521 -0
  49. data/lib/messente_api/api/delivery_report_api.rb +82 -0
  50. data/lib/messente_api/api/groups_api.rb +326 -0
  51. data/lib/messente_api/api/omnimessage_api.rb +144 -0
  52. data/lib/messente_api/api_client.rb +387 -0
  53. data/lib/messente_api/api_error.rb +57 -0
  54. data/lib/messente_api/configuration.rb +251 -0
  55. data/lib/messente_api/models/channel.rb +37 -0
  56. data/lib/messente_api/models/contact_envelope.rb +196 -0
  57. data/lib/messente_api/models/contact_fields.rb +283 -0
  58. data/lib/messente_api/models/contact_list_envelope.rb +198 -0
  59. data/lib/messente_api/models/contact_update_fields.rb +268 -0
  60. data/lib/messente_api/models/delivery_report_response.rb +234 -0
  61. data/lib/messente_api/models/delivery_result.rb +244 -0
  62. data/lib/messente_api/models/error_code_omnichannel.rb +41 -0
  63. data/lib/messente_api/models/error_code_omnichannel_machine.rb +46 -0
  64. data/lib/messente_api/models/error_code_phonebook.rb +40 -0
  65. data/lib/messente_api/models/error_item_omnichannel.rb +245 -0
  66. data/lib/messente_api/models/error_item_phonebook.rb +230 -0
  67. data/lib/messente_api/models/error_omnichannel.rb +203 -0
  68. data/lib/messente_api/models/error_phonebook.rb +203 -0
  69. data/lib/messente_api/models/error_title_omnichannel.rb +41 -0
  70. data/lib/messente_api/models/error_title_phonebook.rb +40 -0
  71. data/lib/messente_api/models/fetch_blacklist_success.rb +198 -0
  72. data/lib/messente_api/models/group_envelope.rb +196 -0
  73. data/lib/messente_api/models/group_list_envelope.rb +198 -0
  74. data/lib/messente_api/models/group_name.rb +220 -0
  75. data/lib/messente_api/models/group_response_fields.rb +240 -0
  76. data/lib/messente_api/models/message_result.rb +231 -0
  77. data/lib/messente_api/models/number_to_blacklist.rb +202 -0
  78. data/lib/messente_api/models/omni_message_create_success_response.rb +234 -0
  79. data/lib/messente_api/models/omnimessage.rb +247 -0
  80. data/lib/messente_api/models/sms.rb +300 -0
  81. data/lib/messente_api/models/status.rb +45 -0
  82. data/lib/messente_api/models/text_store.rb +37 -0
  83. data/lib/messente_api/models/viber.rb +293 -0
  84. data/lib/messente_api/models/whats_app.rb +289 -0
  85. data/lib/messente_api/models/whats_app_audio.rb +202 -0
  86. data/lib/messente_api/models/whats_app_document.rb +212 -0
  87. data/lib/messente_api/models/whats_app_image.rb +212 -0
  88. data/lib/messente_api/models/whats_app_text.rb +214 -0
  89. data/lib/messente_api/version.rb +15 -0
  90. data/messente_api.gemspec +45 -0
  91. data/spec/api/blacklist_api_spec.rb +78 -0
  92. data/spec/api/contacts_api_spec.rb +126 -0
  93. data/spec/api/delivery_report_api_spec.rb +46 -0
  94. data/spec/api/groups_api_spec.rb +90 -0
  95. data/spec/api/omnimessage_api_spec.rb +57 -0
  96. data/spec/api_client_spec.rb +226 -0
  97. data/spec/configuration_spec.rb +42 -0
  98. data/spec/models/channel_spec.rb +35 -0
  99. data/spec/models/contact_envelope_spec.rb +41 -0
  100. data/spec/models/contact_fields_spec.rb +95 -0
  101. data/spec/models/contact_list_envelope_spec.rb +41 -0
  102. data/spec/models/contact_update_fields_spec.rb +89 -0
  103. data/spec/models/delivery_report_response_spec.rb +53 -0
  104. data/spec/models/delivery_result_spec.rb +71 -0
  105. data/spec/models/error_code_omnichannel_machine_spec.rb +35 -0
  106. data/spec/models/error_code_omnichannel_spec.rb +35 -0
  107. data/spec/models/error_code_phonebook_spec.rb +35 -0
  108. data/spec/models/error_item_omnichannel_spec.rb +59 -0
  109. data/spec/models/error_item_phonebook_spec.rb +53 -0
  110. data/spec/models/error_omnichannel_spec.rb +41 -0
  111. data/spec/models/error_phonebook_spec.rb +41 -0
  112. data/spec/models/error_title_omnichannel_spec.rb +35 -0
  113. data/spec/models/error_title_phonebook_spec.rb +35 -0
  114. data/spec/models/fetch_blacklist_success_spec.rb +41 -0
  115. data/spec/models/group_envelope_spec.rb +41 -0
  116. data/spec/models/group_list_envelope_spec.rb +41 -0
  117. data/spec/models/group_name_spec.rb +41 -0
  118. data/spec/models/group_response_fields_spec.rb +59 -0
  119. data/spec/models/message_result_spec.rb +53 -0
  120. data/spec/models/number_to_blacklist_spec.rb +41 -0
  121. data/spec/models/omni_message_create_success_response_spec.rb +53 -0
  122. data/spec/models/omnimessage_spec.rb +65 -0
  123. data/spec/models/sms_spec.rb +79 -0
  124. data/spec/models/status_spec.rb +35 -0
  125. data/spec/models/text_store_spec.rb +35 -0
  126. data/spec/models/viber_spec.rb +81 -0
  127. data/spec/models/whats_app_audio_spec.rb +41 -0
  128. data/spec/models/whats_app_document_spec.rb +47 -0
  129. data/spec/models/whats_app_image_spec.rb +47 -0
  130. data/spec/models/whats_app_spec.rb +81 -0
  131. data/spec/models/whats_app_text_spec.rb +47 -0
  132. data/spec/spec_helper.rb +111 -0
  133. metadata +401 -0
@@ -0,0 +1,234 @@
1
+ =begin
2
+ #Messente API
3
+
4
+ #[Messente](https://messente.com) is a global provider of messaging and user verification services. Use Messente API library to send and receive SMS, Viber and WhatsApp messages, blacklist phone numbers to make sure you're not sending any unwanted messages, manage contacts and groups. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world.
5
+
6
+ The version of the OpenAPI document: 1.0.1
7
+ Contact: messente@messente.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.0.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module MessenteApi
16
+ class DeliveryReportResponse
17
+ # Contains the delivery reports for each channnel, ordered by send order
18
+ attr_accessor :statuses
19
+
20
+ # Phone number in e.164 format
21
+ attr_accessor :to
22
+
23
+ # Unique identifier for the Omnimessage
24
+ attr_accessor :omnimessage_id
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'statuses' => :'statuses',
30
+ :'to' => :'to',
31
+ :'omnimessage_id' => :'omnimessage_id'
32
+ }
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'statuses' => :'Array<DeliveryResult>',
39
+ :'to' => :'String',
40
+ :'omnimessage_id' => :'String'
41
+ }
42
+ end
43
+
44
+ # Initializes the object
45
+ # @param [Hash] attributes Model attributes in the form of hash
46
+ def initialize(attributes = {})
47
+ if (!attributes.is_a?(Hash))
48
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MessenteApi::DeliveryReportResponse` initialize method"
49
+ end
50
+
51
+ # check to see if the attribute exists and convert string to symbol for hash key
52
+ attributes = attributes.each_with_object({}) { |(k, v), h|
53
+ if (!self.class.attribute_map.key?(k.to_sym))
54
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MessenteApi::DeliveryReportResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
55
+ end
56
+ h[k.to_sym] = v
57
+ }
58
+
59
+ if attributes.key?(:'statuses')
60
+ if (value = attributes[:'statuses']).is_a?(Array)
61
+ self.statuses = value
62
+ end
63
+ end
64
+
65
+ if attributes.key?(:'to')
66
+ self.to = attributes[:'to']
67
+ end
68
+
69
+ if attributes.key?(:'omnimessage_id')
70
+ self.omnimessage_id = attributes[:'omnimessage_id']
71
+ end
72
+ end
73
+
74
+ # Show invalid properties with the reasons. Usually used together with valid?
75
+ # @return Array for valid properties with the reasons
76
+ def list_invalid_properties
77
+ invalid_properties = Array.new
78
+ if @statuses.nil?
79
+ invalid_properties.push('invalid value for "statuses", statuses cannot be nil.')
80
+ end
81
+
82
+ if @to.nil?
83
+ invalid_properties.push('invalid value for "to", to cannot be nil.')
84
+ end
85
+
86
+ if @omnimessage_id.nil?
87
+ invalid_properties.push('invalid value for "omnimessage_id", omnimessage_id cannot be nil.')
88
+ end
89
+
90
+ invalid_properties
91
+ end
92
+
93
+ # Check to see if the all the properties in the model are valid
94
+ # @return true if the model is valid
95
+ def valid?
96
+ return false if @statuses.nil?
97
+ return false if @to.nil?
98
+ return false if @omnimessage_id.nil?
99
+ true
100
+ end
101
+
102
+ # Checks equality by comparing each attribute.
103
+ # @param [Object] Object to be compared
104
+ def ==(o)
105
+ return true if self.equal?(o)
106
+ self.class == o.class &&
107
+ statuses == o.statuses &&
108
+ to == o.to &&
109
+ omnimessage_id == o.omnimessage_id
110
+ end
111
+
112
+ # @see the `==` method
113
+ # @param [Object] Object to be compared
114
+ def eql?(o)
115
+ self == o
116
+ end
117
+
118
+ # Calculates hash code according to all attributes.
119
+ # @return [Integer] Hash code
120
+ def hash
121
+ [statuses, to, omnimessage_id].hash
122
+ end
123
+
124
+ # Builds the object from hash
125
+ # @param [Hash] attributes Model attributes in the form of hash
126
+ # @return [Object] Returns the model itself
127
+ def self.build_from_hash(attributes)
128
+ new.build_from_hash(attributes)
129
+ end
130
+
131
+ # Builds the object from hash
132
+ # @param [Hash] attributes Model attributes in the form of hash
133
+ # @return [Object] Returns the model itself
134
+ def build_from_hash(attributes)
135
+ return nil unless attributes.is_a?(Hash)
136
+ self.class.openapi_types.each_pair do |key, type|
137
+ if type =~ /\AArray<(.*)>/i
138
+ # check to ensure the input is an array given that the attribute
139
+ # is documented as an array but the input is not
140
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
141
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
142
+ end
143
+ elsif !attributes[self.class.attribute_map[key]].nil?
144
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
145
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
146
+ end
147
+
148
+ self
149
+ end
150
+
151
+ # Deserializes the data based on type
152
+ # @param string type Data type
153
+ # @param string value Value to be deserialized
154
+ # @return [Object] Deserialized data
155
+ def _deserialize(type, value)
156
+ case type.to_sym
157
+ when :DateTime
158
+ DateTime.parse(value)
159
+ when :Date
160
+ Date.parse(value)
161
+ when :String
162
+ value.to_s
163
+ when :Integer
164
+ value.to_i
165
+ when :Float
166
+ value.to_f
167
+ when :Boolean
168
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
169
+ true
170
+ else
171
+ false
172
+ end
173
+ when :Object
174
+ # generic object (usually a Hash), return directly
175
+ value
176
+ when /\AArray<(?<inner_type>.+)>\z/
177
+ inner_type = Regexp.last_match[:inner_type]
178
+ value.map { |v| _deserialize(inner_type, v) }
179
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
180
+ k_type = Regexp.last_match[:k_type]
181
+ v_type = Regexp.last_match[:v_type]
182
+ {}.tap do |hash|
183
+ value.each do |k, v|
184
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
185
+ end
186
+ end
187
+ else # model
188
+ MessenteApi.const_get(type).build_from_hash(value)
189
+ end
190
+ end
191
+
192
+ # Returns the string representation of the object
193
+ # @return [String] String presentation of the object
194
+ def to_s
195
+ to_hash.to_s
196
+ end
197
+
198
+ # to_body is an alias to to_hash (backward compatibility)
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_body
201
+ to_hash
202
+ end
203
+
204
+ # Returns the object in the form of hash
205
+ # @return [Hash] Returns the object in the form of hash
206
+ def to_hash
207
+ hash = {}
208
+ self.class.attribute_map.each_pair do |attr, param|
209
+ value = self.send(attr)
210
+ next if value.nil?
211
+ hash[param] = _to_hash(value)
212
+ end
213
+ hash
214
+ end
215
+
216
+ # Outputs non-array value in the form of hash
217
+ # For object, use to_hash. Otherwise, just return the value
218
+ # @param [Object] value Any valid value
219
+ # @return [Hash] Returns the value in the form of hash
220
+ def _to_hash(value)
221
+ if value.is_a?(Array)
222
+ value.compact.map { |v| _to_hash(v) }
223
+ elsif value.is_a?(Hash)
224
+ {}.tap do |hash|
225
+ value.each { |k, v| hash[k] = _to_hash(v) }
226
+ end
227
+ elsif value.respond_to? :to_hash
228
+ value.to_hash
229
+ else
230
+ value
231
+ end
232
+ end
233
+ end
234
+ end
@@ -0,0 +1,244 @@
1
+ =begin
2
+ #Messente API
3
+
4
+ #[Messente](https://messente.com) is a global provider of messaging and user verification services. Use Messente API library to send and receive SMS, Viber and WhatsApp messages, blacklist phone numbers to make sure you're not sending any unwanted messages, manage contacts and groups. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world.
5
+
6
+ The version of the OpenAPI document: 1.0.1
7
+ Contact: messente@messente.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.0.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module MessenteApi
16
+ class DeliveryResult
17
+ attr_accessor :status
18
+
19
+ attr_accessor :channel
20
+
21
+ # Unique identifier for the message
22
+ attr_accessor :message_id
23
+
24
+ # Human-readable description of what went wrong, *null* in case of success or if the messages has not been processed yet
25
+ attr_accessor :error
26
+
27
+ attr_accessor :err
28
+
29
+ # When this status was received by Omnichannel API
30
+ attr_accessor :timestamp
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'status' => :'status',
36
+ :'channel' => :'channel',
37
+ :'message_id' => :'message_id',
38
+ :'error' => :'error',
39
+ :'err' => :'err',
40
+ :'timestamp' => :'timestamp'
41
+ }
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.openapi_types
46
+ {
47
+ :'status' => :'Status',
48
+ :'channel' => :'Channel',
49
+ :'message_id' => :'String',
50
+ :'error' => :'String',
51
+ :'err' => :'ErrorCodeOmnichannelMachine',
52
+ :'timestamp' => :'DateTime'
53
+ }
54
+ end
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ def initialize(attributes = {})
59
+ if (!attributes.is_a?(Hash))
60
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MessenteApi::DeliveryResult` initialize method"
61
+ end
62
+
63
+ # check to see if the attribute exists and convert string to symbol for hash key
64
+ attributes = attributes.each_with_object({}) { |(k, v), h|
65
+ if (!self.class.attribute_map.key?(k.to_sym))
66
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MessenteApi::DeliveryResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
67
+ end
68
+ h[k.to_sym] = v
69
+ }
70
+
71
+ if attributes.key?(:'status')
72
+ self.status = attributes[:'status']
73
+ end
74
+
75
+ if attributes.key?(:'channel')
76
+ self.channel = attributes[:'channel']
77
+ end
78
+
79
+ if attributes.key?(:'message_id')
80
+ self.message_id = attributes[:'message_id']
81
+ end
82
+
83
+ if attributes.key?(:'error')
84
+ self.error = attributes[:'error']
85
+ end
86
+
87
+ if attributes.key?(:'err')
88
+ self.err = attributes[:'err']
89
+ end
90
+
91
+ if attributes.key?(:'timestamp')
92
+ self.timestamp = attributes[:'timestamp']
93
+ end
94
+ end
95
+
96
+ # Show invalid properties with the reasons. Usually used together with valid?
97
+ # @return Array for valid properties with the reasons
98
+ def list_invalid_properties
99
+ invalid_properties = Array.new
100
+ invalid_properties
101
+ end
102
+
103
+ # Check to see if the all the properties in the model are valid
104
+ # @return true if the model is valid
105
+ def valid?
106
+ true
107
+ end
108
+
109
+ # Checks equality by comparing each attribute.
110
+ # @param [Object] Object to be compared
111
+ def ==(o)
112
+ return true if self.equal?(o)
113
+ self.class == o.class &&
114
+ status == o.status &&
115
+ channel == o.channel &&
116
+ message_id == o.message_id &&
117
+ error == o.error &&
118
+ err == o.err &&
119
+ timestamp == o.timestamp
120
+ end
121
+
122
+ # @see the `==` method
123
+ # @param [Object] Object to be compared
124
+ def eql?(o)
125
+ self == o
126
+ end
127
+
128
+ # Calculates hash code according to all attributes.
129
+ # @return [Integer] Hash code
130
+ def hash
131
+ [status, channel, message_id, error, err, timestamp].hash
132
+ end
133
+
134
+ # Builds the object from hash
135
+ # @param [Hash] attributes Model attributes in the form of hash
136
+ # @return [Object] Returns the model itself
137
+ def self.build_from_hash(attributes)
138
+ new.build_from_hash(attributes)
139
+ end
140
+
141
+ # Builds the object from hash
142
+ # @param [Hash] attributes Model attributes in the form of hash
143
+ # @return [Object] Returns the model itself
144
+ def build_from_hash(attributes)
145
+ return nil unless attributes.is_a?(Hash)
146
+ self.class.openapi_types.each_pair do |key, type|
147
+ if type =~ /\AArray<(.*)>/i
148
+ # check to ensure the input is an array given that the attribute
149
+ # is documented as an array but the input is not
150
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
151
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
152
+ end
153
+ elsif !attributes[self.class.attribute_map[key]].nil?
154
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
155
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
156
+ end
157
+
158
+ self
159
+ end
160
+
161
+ # Deserializes the data based on type
162
+ # @param string type Data type
163
+ # @param string value Value to be deserialized
164
+ # @return [Object] Deserialized data
165
+ def _deserialize(type, value)
166
+ case type.to_sym
167
+ when :DateTime
168
+ DateTime.parse(value)
169
+ when :Date
170
+ Date.parse(value)
171
+ when :String
172
+ value.to_s
173
+ when :Integer
174
+ value.to_i
175
+ when :Float
176
+ value.to_f
177
+ when :Boolean
178
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
179
+ true
180
+ else
181
+ false
182
+ end
183
+ when :Object
184
+ # generic object (usually a Hash), return directly
185
+ value
186
+ when /\AArray<(?<inner_type>.+)>\z/
187
+ inner_type = Regexp.last_match[:inner_type]
188
+ value.map { |v| _deserialize(inner_type, v) }
189
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
190
+ k_type = Regexp.last_match[:k_type]
191
+ v_type = Regexp.last_match[:v_type]
192
+ {}.tap do |hash|
193
+ value.each do |k, v|
194
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
195
+ end
196
+ end
197
+ else # model
198
+ MessenteApi.const_get(type).build_from_hash(value)
199
+ end
200
+ end
201
+
202
+ # Returns the string representation of the object
203
+ # @return [String] String presentation of the object
204
+ def to_s
205
+ to_hash.to_s
206
+ end
207
+
208
+ # to_body is an alias to to_hash (backward compatibility)
209
+ # @return [Hash] Returns the object in the form of hash
210
+ def to_body
211
+ to_hash
212
+ end
213
+
214
+ # Returns the object in the form of hash
215
+ # @return [Hash] Returns the object in the form of hash
216
+ def to_hash
217
+ hash = {}
218
+ self.class.attribute_map.each_pair do |attr, param|
219
+ value = self.send(attr)
220
+ next if value.nil?
221
+ hash[param] = _to_hash(value)
222
+ end
223
+ hash
224
+ end
225
+
226
+ # Outputs non-array value in the form of hash
227
+ # For object, use to_hash. Otherwise, just return the value
228
+ # @param [Object] value Any valid value
229
+ # @return [Hash] Returns the value in the form of hash
230
+ def _to_hash(value)
231
+ if value.is_a?(Array)
232
+ value.compact.map { |v| _to_hash(v) }
233
+ elsif value.is_a?(Hash)
234
+ {}.tap do |hash|
235
+ value.each { |k, v| hash[k] = _to_hash(v) }
236
+ end
237
+ elsif value.respond_to? :to_hash
238
+ value.to_hash
239
+ else
240
+ value
241
+ end
242
+ end
243
+ end
244
+ end