messente_api 1.1.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/README.md +11 -3
  4. data/docs/ContactEnvelope.md +1 -1
  5. data/docs/ContactListEnvelope.md +1 -1
  6. data/docs/ContactResponseFields.md +37 -0
  7. data/docs/ErrorCodeStatistics.md +16 -0
  8. data/docs/ErrorItemNumberLookup.md +17 -0
  9. data/docs/ErrorItemNumberLookupError.md +19 -0
  10. data/docs/ErrorItemStatistics.md +21 -0
  11. data/docs/ErrorNumberLookup.md +17 -0
  12. data/docs/ErrorStatistics.md +17 -0
  13. data/docs/MobileNetwork.md +25 -0
  14. data/docs/NumberLookupApi.md +60 -0
  15. data/docs/NumbersToInvestigate.md +17 -0
  16. data/docs/OmnimessageApi.md +4 -3
  17. data/docs/StatisticsApi.md +60 -0
  18. data/docs/StatisticsReport.md +21 -0
  19. data/docs/StatisticsReportSettings.md +21 -0
  20. data/docs/StatisticsReportSuccess.md +17 -0
  21. data/docs/SyncNumberLookupResult.md +33 -0
  22. data/docs/SyncNumberLookupSuccess.md +19 -0
  23. data/git_push.sh +10 -7
  24. data/lib/messente_api.rb +19 -3
  25. data/lib/messente_api/api/blacklist_api.rb +3 -3
  26. data/lib/messente_api/api/contacts_api.rb +3 -3
  27. data/lib/messente_api/api/delivery_report_api.rb +3 -3
  28. data/lib/messente_api/api/groups_api.rb +3 -3
  29. data/lib/messente_api/api/number_lookup_api.rb +84 -0
  30. data/lib/messente_api/api/omnimessage_api.rb +8 -8
  31. data/lib/messente_api/api/statistics_api.rb +84 -0
  32. data/lib/messente_api/api_client.rb +38 -36
  33. data/lib/messente_api/api_error.rb +3 -3
  34. data/lib/messente_api/configuration.rb +4 -4
  35. data/lib/messente_api/models/channel.rb +3 -3
  36. data/lib/messente_api/models/contact_envelope.rb +15 -5
  37. data/lib/messente_api/models/contact_fields.rb +24 -5
  38. data/lib/messente_api/models/contact_list_envelope.rb +15 -5
  39. data/lib/messente_api/models/contact_response_fields.rb +318 -0
  40. data/lib/messente_api/models/contact_update_fields.rb +23 -4
  41. data/lib/messente_api/models/delivery_report_response.rb +14 -4
  42. data/lib/messente_api/models/delivery_result.rb +14 -4
  43. data/lib/messente_api/models/error_code_omnichannel.rb +3 -3
  44. data/lib/messente_api/models/error_code_omnichannel_machine.rb +3 -3
  45. data/lib/messente_api/models/error_code_phonebook.rb +3 -3
  46. data/lib/messente_api/models/error_code_statistics.rb +38 -0
  47. data/lib/messente_api/models/error_item_number_lookup.rb +212 -0
  48. data/lib/messente_api/models/error_item_number_lookup_error.rb +256 -0
  49. data/lib/messente_api/models/error_item_omnichannel.rb +15 -9
  50. data/lib/messente_api/models/error_item_phonebook.rb +14 -4
  51. data/lib/messente_api/models/error_item_statistics.rb +242 -0
  52. data/lib/messente_api/models/error_number_lookup.rb +215 -0
  53. data/lib/messente_api/models/error_omnichannel.rb +14 -4
  54. data/lib/messente_api/models/error_phonebook.rb +14 -4
  55. data/lib/messente_api/models/error_statistics.rb +215 -0
  56. data/lib/messente_api/models/error_title_omnichannel.rb +3 -3
  57. data/lib/messente_api/models/error_title_phonebook.rb +3 -3
  58. data/lib/messente_api/models/fetch_blacklist_success.rb +14 -4
  59. data/lib/messente_api/models/group_envelope.rb +14 -4
  60. data/lib/messente_api/models/group_list_envelope.rb +14 -4
  61. data/lib/messente_api/models/group_name.rb +14 -4
  62. data/lib/messente_api/models/group_response_fields.rb +15 -4
  63. data/lib/messente_api/models/message_result.rb +14 -4
  64. data/lib/messente_api/models/mobile_network.rb +248 -0
  65. data/lib/messente_api/models/number_to_blacklist.rb +14 -4
  66. data/lib/messente_api/models/numbers_to_investigate.rb +215 -0
  67. data/lib/messente_api/models/omni_message_create_success_response.rb +14 -4
  68. data/lib/messente_api/models/omnimessage.rb +14 -4
  69. data/lib/messente_api/models/sms.rb +14 -4
  70. data/lib/messente_api/models/statistics_report.rb +243 -0
  71. data/lib/messente_api/models/statistics_report_settings.rb +240 -0
  72. data/lib/messente_api/models/statistics_report_success.rb +215 -0
  73. data/lib/messente_api/models/status.rb +3 -3
  74. data/lib/messente_api/models/sync_number_lookup_result.rb +329 -0
  75. data/lib/messente_api/models/sync_number_lookup_success.rb +230 -0
  76. data/lib/messente_api/models/telegram.rb +14 -4
  77. data/lib/messente_api/models/text_store.rb +3 -3
  78. data/lib/messente_api/models/viber.rb +14 -4
  79. data/lib/messente_api/models/whats_app.rb +14 -4
  80. data/lib/messente_api/models/whats_app_audio.rb +14 -4
  81. data/lib/messente_api/models/whats_app_document.rb +14 -4
  82. data/lib/messente_api/models/whats_app_image.rb +14 -4
  83. data/lib/messente_api/models/whats_app_text.rb +14 -4
  84. data/lib/messente_api/version.rb +4 -4
  85. data/messente_api-1.3.0.gem +0 -0
  86. data/messente_api.gemspec +4 -10
  87. data/spec/api_client_spec.rb +4 -4
  88. data/spec/configuration_spec.rb +3 -3
  89. data/spec/spec_helper.rb +3 -3
  90. metadata +49 -136
  91. data/Gemfile.lock +0 -79
@@ -0,0 +1,215 @@
1
+ =begin
2
+ #Messente API
3
+
4
+ #[Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. 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.3.0
7
+ Contact: messente@messente.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module MessenteApi
16
+ # A container for statistics reports
17
+ class StatisticsReportSuccess
18
+ # Array of report objects
19
+ attr_accessor :reports
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'reports' => :'reports'
25
+ }
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.openapi_types
30
+ {
31
+ :'reports' => :'Array<StatisticsReport>'
32
+ }
33
+ end
34
+
35
+ # List of attributes with nullable: true
36
+ def self.openapi_nullable
37
+ Set.new([
38
+ ])
39
+ end
40
+
41
+ # Initializes the object
42
+ # @param [Hash] attributes Model attributes in the form of hash
43
+ def initialize(attributes = {})
44
+ if (!attributes.is_a?(Hash))
45
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MessenteApi::StatisticsReportSuccess` initialize method"
46
+ end
47
+
48
+ # check to see if the attribute exists and convert string to symbol for hash key
49
+ attributes = attributes.each_with_object({}) { |(k, v), h|
50
+ if (!self.class.attribute_map.key?(k.to_sym))
51
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MessenteApi::StatisticsReportSuccess`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
52
+ end
53
+ h[k.to_sym] = v
54
+ }
55
+
56
+ if attributes.key?(:'reports')
57
+ if (value = attributes[:'reports']).is_a?(Array)
58
+ self.reports = value
59
+ end
60
+ end
61
+ end
62
+
63
+ # Show invalid properties with the reasons. Usually used together with valid?
64
+ # @return Array for valid properties with the reasons
65
+ def list_invalid_properties
66
+ invalid_properties = Array.new
67
+ if @reports.nil?
68
+ invalid_properties.push('invalid value for "reports", reports cannot be nil.')
69
+ end
70
+
71
+ invalid_properties
72
+ end
73
+
74
+ # Check to see if the all the properties in the model are valid
75
+ # @return true if the model is valid
76
+ def valid?
77
+ return false if @reports.nil?
78
+ 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
+ reports == o.reports
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 [Integer] Hash code
97
+ def hash
98
+ [reports].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 self.build_from_hash(attributes)
105
+ new.build_from_hash(attributes)
106
+ end
107
+
108
+ # Builds the object from hash
109
+ # @param [Hash] attributes Model attributes in the form of hash
110
+ # @return [Object] Returns the model itself
111
+ def build_from_hash(attributes)
112
+ return nil unless attributes.is_a?(Hash)
113
+ self.class.openapi_types.each_pair do |key, type|
114
+ if type =~ /\AArray<(.*)>/i
115
+ # check to ensure the input is an array given that the attribute
116
+ # is documented as an array but the input is not
117
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
118
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
119
+ end
120
+ elsif !attributes[self.class.attribute_map[key]].nil?
121
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
122
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
123
+ end
124
+
125
+ self
126
+ end
127
+
128
+ # Deserializes the data based on type
129
+ # @param string type Data type
130
+ # @param string value Value to be deserialized
131
+ # @return [Object] Deserialized data
132
+ def _deserialize(type, value)
133
+ case type.to_sym
134
+ when :DateTime
135
+ DateTime.parse(value)
136
+ when :Date
137
+ Date.parse(value)
138
+ when :String
139
+ value.to_s
140
+ when :Integer
141
+ value.to_i
142
+ when :Float
143
+ value.to_f
144
+ when :Boolean
145
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
146
+ true
147
+ else
148
+ false
149
+ end
150
+ when :Object
151
+ # generic object (usually a Hash), return directly
152
+ value
153
+ when /\AArray<(?<inner_type>.+)>\z/
154
+ inner_type = Regexp.last_match[:inner_type]
155
+ value.map { |v| _deserialize(inner_type, v) }
156
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
157
+ k_type = Regexp.last_match[:k_type]
158
+ v_type = Regexp.last_match[:v_type]
159
+ {}.tap do |hash|
160
+ value.each do |k, v|
161
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
162
+ end
163
+ end
164
+ else # model
165
+ MessenteApi.const_get(type).build_from_hash(value)
166
+ end
167
+ end
168
+
169
+ # Returns the string representation of the object
170
+ # @return [String] String presentation of the object
171
+ def to_s
172
+ to_hash.to_s
173
+ end
174
+
175
+ # to_body is an alias to to_hash (backward compatibility)
176
+ # @return [Hash] Returns the object in the form of hash
177
+ def to_body
178
+ to_hash
179
+ end
180
+
181
+ # Returns the object in the form of hash
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_hash
184
+ hash = {}
185
+ self.class.attribute_map.each_pair do |attr, param|
186
+ value = self.send(attr)
187
+ if value.nil?
188
+ is_nullable = self.class.openapi_nullable.include?(attr)
189
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
190
+ end
191
+
192
+ hash[param] = _to_hash(value)
193
+ end
194
+ hash
195
+ end
196
+
197
+ # Outputs non-array value in the form of hash
198
+ # For object, use to_hash. Otherwise, just return the value
199
+ # @param [Object] value Any valid value
200
+ # @return [Hash] Returns the value in the form of hash
201
+ def _to_hash(value)
202
+ if value.is_a?(Array)
203
+ value.compact.map { |v| _to_hash(v) }
204
+ elsif value.is_a?(Hash)
205
+ {}.tap do |hash|
206
+ value.each { |k, v| hash[k] = _to_hash(v) }
207
+ end
208
+ elsif value.respond_to? :to_hash
209
+ value.to_hash
210
+ else
211
+ value
212
+ end
213
+ end
214
+ end
215
+ end
@@ -1,12 +1,12 @@
1
1
  =begin
2
2
  #Messente API
3
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, WhatsApp and Telegram 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.
4
+ #[Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world.
5
5
 
6
- The version of the OpenAPI document: 1.1.0
6
+ The version of the OpenAPI document: 1.3.0
7
7
  Contact: messente@messente.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.0.3
9
+ OpenAPI Generator version: 4.3.1
10
10
 
11
11
  =end
12
12
 
@@ -0,0 +1,329 @@
1
+ =begin
2
+ #Messente API
3
+
4
+ #[Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. 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.3.0
7
+ Contact: messente@messente.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module MessenteApi
16
+ # Info about a phone number
17
+ class SyncNumberLookupResult
18
+ # Phone number in e.164 format
19
+ attr_accessor :number
20
+
21
+ # Indicates if a number is roaming
22
+ attr_accessor :roaming
23
+
24
+ # Indicates if a number is ported
25
+ attr_accessor :ported
26
+
27
+ attr_accessor :roaming_network
28
+
29
+ attr_accessor :current_network
30
+
31
+ attr_accessor :original_network
32
+
33
+ attr_accessor :ported_network
34
+
35
+ # Status of the phone number
36
+ attr_accessor :status
37
+
38
+ # Indicates if any error occurred while handling the request
39
+ attr_accessor :error
40
+
41
+ class EnumAttributeValidator
42
+ attr_reader :datatype
43
+ attr_reader :allowable_values
44
+
45
+ def initialize(datatype, allowable_values)
46
+ @allowable_values = allowable_values.map do |value|
47
+ case datatype.to_s
48
+ when /Integer/i
49
+ value.to_i
50
+ when /Float/i
51
+ value.to_f
52
+ else
53
+ value
54
+ end
55
+ end
56
+ end
57
+
58
+ def valid?(value)
59
+ !value || allowable_values.include?(value)
60
+ end
61
+ end
62
+
63
+ # Attribute mapping from ruby-style variable name to JSON key.
64
+ def self.attribute_map
65
+ {
66
+ :'number' => :'number',
67
+ :'roaming' => :'roaming',
68
+ :'ported' => :'ported',
69
+ :'roaming_network' => :'roamingNetwork',
70
+ :'current_network' => :'currentNetwork',
71
+ :'original_network' => :'originalNetwork',
72
+ :'ported_network' => :'portedNetwork',
73
+ :'status' => :'status',
74
+ :'error' => :'error'
75
+ }
76
+ end
77
+
78
+ # Attribute type mapping.
79
+ def self.openapi_types
80
+ {
81
+ :'number' => :'String',
82
+ :'roaming' => :'Boolean',
83
+ :'ported' => :'Boolean',
84
+ :'roaming_network' => :'MobileNetwork',
85
+ :'current_network' => :'MobileNetwork',
86
+ :'original_network' => :'MobileNetwork',
87
+ :'ported_network' => :'MobileNetwork',
88
+ :'status' => :'String',
89
+ :'error' => :'AnyType'
90
+ }
91
+ end
92
+
93
+ # List of attributes with nullable: true
94
+ def self.openapi_nullable
95
+ Set.new([
96
+ :'roaming',
97
+ :'ported',
98
+ :'roaming_network',
99
+ :'current_network',
100
+ :'original_network',
101
+ :'ported_network',
102
+ ])
103
+ end
104
+
105
+ # Initializes the object
106
+ # @param [Hash] attributes Model attributes in the form of hash
107
+ def initialize(attributes = {})
108
+ if (!attributes.is_a?(Hash))
109
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MessenteApi::SyncNumberLookupResult` initialize method"
110
+ end
111
+
112
+ # check to see if the attribute exists and convert string to symbol for hash key
113
+ attributes = attributes.each_with_object({}) { |(k, v), h|
114
+ if (!self.class.attribute_map.key?(k.to_sym))
115
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MessenteApi::SyncNumberLookupResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
116
+ end
117
+ h[k.to_sym] = v
118
+ }
119
+
120
+ if attributes.key?(:'number')
121
+ self.number = attributes[:'number']
122
+ end
123
+
124
+ if attributes.key?(:'roaming')
125
+ self.roaming = attributes[:'roaming']
126
+ end
127
+
128
+ if attributes.key?(:'ported')
129
+ self.ported = attributes[:'ported']
130
+ end
131
+
132
+ if attributes.key?(:'roaming_network')
133
+ self.roaming_network = attributes[:'roaming_network']
134
+ end
135
+
136
+ if attributes.key?(:'current_network')
137
+ self.current_network = attributes[:'current_network']
138
+ end
139
+
140
+ if attributes.key?(:'original_network')
141
+ self.original_network = attributes[:'original_network']
142
+ end
143
+
144
+ if attributes.key?(:'ported_network')
145
+ self.ported_network = attributes[:'ported_network']
146
+ end
147
+
148
+ if attributes.key?(:'status')
149
+ self.status = attributes[:'status']
150
+ end
151
+
152
+ if attributes.key?(:'error')
153
+ self.error = attributes[:'error']
154
+ end
155
+ end
156
+
157
+ # Show invalid properties with the reasons. Usually used together with valid?
158
+ # @return Array for valid properties with the reasons
159
+ def list_invalid_properties
160
+ invalid_properties = Array.new
161
+ if @number.nil?
162
+ invalid_properties.push('invalid value for "number", number cannot be nil.')
163
+ end
164
+
165
+ invalid_properties
166
+ end
167
+
168
+ # Check to see if the all the properties in the model are valid
169
+ # @return true if the model is valid
170
+ def valid?
171
+ return false if @number.nil?
172
+ status_validator = EnumAttributeValidator.new('String', ["ON", "OFF", "INVALID", "UNKNOWN"])
173
+ return false unless status_validator.valid?(@status)
174
+ true
175
+ end
176
+
177
+ # Custom attribute writer method checking allowed values (enum).
178
+ # @param [Object] status Object to be assigned
179
+ def status=(status)
180
+ validator = EnumAttributeValidator.new('String', ["ON", "OFF", "INVALID", "UNKNOWN"])
181
+ unless validator.valid?(status)
182
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
183
+ end
184
+ @status = status
185
+ end
186
+
187
+ # Checks equality by comparing each attribute.
188
+ # @param [Object] Object to be compared
189
+ def ==(o)
190
+ return true if self.equal?(o)
191
+ self.class == o.class &&
192
+ number == o.number &&
193
+ roaming == o.roaming &&
194
+ ported == o.ported &&
195
+ roaming_network == o.roaming_network &&
196
+ current_network == o.current_network &&
197
+ original_network == o.original_network &&
198
+ ported_network == o.ported_network &&
199
+ status == o.status &&
200
+ error == o.error
201
+ end
202
+
203
+ # @see the `==` method
204
+ # @param [Object] Object to be compared
205
+ def eql?(o)
206
+ self == o
207
+ end
208
+
209
+ # Calculates hash code according to all attributes.
210
+ # @return [Integer] Hash code
211
+ def hash
212
+ [number, roaming, ported, roaming_network, current_network, original_network, ported_network, status, error].hash
213
+ end
214
+
215
+ # Builds the object from hash
216
+ # @param [Hash] attributes Model attributes in the form of hash
217
+ # @return [Object] Returns the model itself
218
+ def self.build_from_hash(attributes)
219
+ new.build_from_hash(attributes)
220
+ end
221
+
222
+ # Builds the object from hash
223
+ # @param [Hash] attributes Model attributes in the form of hash
224
+ # @return [Object] Returns the model itself
225
+ def build_from_hash(attributes)
226
+ return nil unless attributes.is_a?(Hash)
227
+ self.class.openapi_types.each_pair do |key, type|
228
+ if type =~ /\AArray<(.*)>/i
229
+ # check to ensure the input is an array given that the attribute
230
+ # is documented as an array but the input is not
231
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
232
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
233
+ end
234
+ elsif !attributes[self.class.attribute_map[key]].nil?
235
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
236
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
237
+ end
238
+
239
+ self
240
+ end
241
+
242
+ # Deserializes the data based on type
243
+ # @param string type Data type
244
+ # @param string value Value to be deserialized
245
+ # @return [Object] Deserialized data
246
+ def _deserialize(type, value)
247
+ case type.to_sym
248
+ when :DateTime
249
+ DateTime.parse(value)
250
+ when :Date
251
+ Date.parse(value)
252
+ when :String
253
+ value.to_s
254
+ when :Integer
255
+ value.to_i
256
+ when :Float
257
+ value.to_f
258
+ when :Boolean
259
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
260
+ true
261
+ else
262
+ false
263
+ end
264
+ when :Object
265
+ # generic object (usually a Hash), return directly
266
+ value
267
+ when /\AArray<(?<inner_type>.+)>\z/
268
+ inner_type = Regexp.last_match[:inner_type]
269
+ value.map { |v| _deserialize(inner_type, v) }
270
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
271
+ k_type = Regexp.last_match[:k_type]
272
+ v_type = Regexp.last_match[:v_type]
273
+ {}.tap do |hash|
274
+ value.each do |k, v|
275
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
276
+ end
277
+ end
278
+ else # model
279
+ MessenteApi.const_get(type).build_from_hash(value)
280
+ end
281
+ end
282
+
283
+ # Returns the string representation of the object
284
+ # @return [String] String presentation of the object
285
+ def to_s
286
+ to_hash.to_s
287
+ end
288
+
289
+ # to_body is an alias to to_hash (backward compatibility)
290
+ # @return [Hash] Returns the object in the form of hash
291
+ def to_body
292
+ to_hash
293
+ end
294
+
295
+ # Returns the object in the form of hash
296
+ # @return [Hash] Returns the object in the form of hash
297
+ def to_hash
298
+ hash = {}
299
+ self.class.attribute_map.each_pair do |attr, param|
300
+ value = self.send(attr)
301
+ if value.nil?
302
+ is_nullable = self.class.openapi_nullable.include?(attr)
303
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
304
+ end
305
+
306
+ hash[param] = _to_hash(value)
307
+ end
308
+ hash
309
+ end
310
+
311
+ # Outputs non-array value in the form of hash
312
+ # For object, use to_hash. Otherwise, just return the value
313
+ # @param [Object] value Any valid value
314
+ # @return [Hash] Returns the value in the form of hash
315
+ def _to_hash(value)
316
+ if value.is_a?(Array)
317
+ value.compact.map { |v| _to_hash(v) }
318
+ elsif value.is_a?(Hash)
319
+ {}.tap do |hash|
320
+ value.each { |k, v| hash[k] = _to_hash(v) }
321
+ end
322
+ elsif value.respond_to? :to_hash
323
+ value.to_hash
324
+ else
325
+ value
326
+ end
327
+ end
328
+ end
329
+ end