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
@@ -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
 
@@ -45,6 +45,13 @@ module MessenteApi
45
45
  }
46
46
  end
47
47
 
48
+ # List of attributes with nullable: true
49
+ def self.openapi_nullable
50
+ Set.new([
51
+ :'source'
52
+ ])
53
+ end
54
+
48
55
  # Initializes the object
49
56
  # @param [Hash] attributes Model attributes in the form of hash
50
57
  def initialize(attributes = {})
@@ -93,10 +100,6 @@ module MessenteApi
93
100
  invalid_properties.push('invalid value for "code", code cannot be nil.')
94
101
  end
95
102
 
96
- if @source.nil?
97
- invalid_properties.push('invalid value for "source", source cannot be nil.')
98
- end
99
-
100
103
  invalid_properties
101
104
  end
102
105
 
@@ -106,7 +109,6 @@ module MessenteApi
106
109
  return false if @title.nil?
107
110
  return false if @detail.nil?
108
111
  return false if @code.nil?
109
- return false if @source.nil?
110
112
  true
111
113
  end
112
114
 
@@ -219,7 +221,11 @@ module MessenteApi
219
221
  hash = {}
220
222
  self.class.attribute_map.each_pair do |attr, param|
221
223
  value = self.send(attr)
222
- next if value.nil?
224
+ if value.nil?
225
+ is_nullable = self.class.openapi_nullable.include?(attr)
226
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
227
+ end
228
+
223
229
  hash[param] = _to_hash(value)
224
230
  end
225
231
  hash
@@ -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
 
@@ -40,6 +40,12 @@ module MessenteApi
40
40
  }
41
41
  end
42
42
 
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
46
+ ])
47
+ end
48
+
43
49
  # Initializes the object
44
50
  # @param [Hash] attributes Model attributes in the form of hash
45
51
  def initialize(attributes = {})
@@ -204,7 +210,11 @@ module MessenteApi
204
210
  hash = {}
205
211
  self.class.attribute_map.each_pair do |attr, param|
206
212
  value = self.send(attr)
207
- next if value.nil?
213
+ if value.nil?
214
+ is_nullable = self.class.openapi_nullable.include?(attr)
215
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
216
+ end
217
+
208
218
  hash[param] = _to_hash(value)
209
219
  end
210
220
  hash
@@ -0,0 +1,242 @@
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
+ # Error fields container
17
+ class ErrorItemStatistics
18
+ # Error title
19
+ attr_accessor :title
20
+
21
+ # Error details
22
+ attr_accessor :details
23
+
24
+ attr_accessor :code
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'title' => :'title',
30
+ :'details' => :'details',
31
+ :'code' => :'code'
32
+ }
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'title' => :'String',
39
+ :'details' => :'String',
40
+ :'code' => :'ErrorCodeStatistics'
41
+ }
42
+ end
43
+
44
+ # List of attributes with nullable: true
45
+ def self.openapi_nullable
46
+ Set.new([
47
+ ])
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MessenteApi::ErrorItemStatistics` initialize method"
55
+ end
56
+
57
+ # check to see if the attribute exists and convert string to symbol for hash key
58
+ attributes = attributes.each_with_object({}) { |(k, v), h|
59
+ if (!self.class.attribute_map.key?(k.to_sym))
60
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MessenteApi::ErrorItemStatistics`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
61
+ end
62
+ h[k.to_sym] = v
63
+ }
64
+
65
+ if attributes.key?(:'title')
66
+ self.title = attributes[:'title']
67
+ end
68
+
69
+ if attributes.key?(:'details')
70
+ self.details = attributes[:'details']
71
+ end
72
+
73
+ if attributes.key?(:'code')
74
+ self.code = attributes[:'code']
75
+ end
76
+ end
77
+
78
+ # Show invalid properties with the reasons. Usually used together with valid?
79
+ # @return Array for valid properties with the reasons
80
+ def list_invalid_properties
81
+ invalid_properties = Array.new
82
+ if @title.nil?
83
+ invalid_properties.push('invalid value for "title", title cannot be nil.')
84
+ end
85
+
86
+ if @details.nil?
87
+ invalid_properties.push('invalid value for "details", details cannot be nil.')
88
+ end
89
+
90
+ if @code.nil?
91
+ invalid_properties.push('invalid value for "code", code cannot be nil.')
92
+ end
93
+
94
+ invalid_properties
95
+ end
96
+
97
+ # Check to see if the all the properties in the model are valid
98
+ # @return true if the model is valid
99
+ def valid?
100
+ return false if @title.nil?
101
+ return false if @details.nil?
102
+ return false if @code.nil?
103
+ true
104
+ end
105
+
106
+ # Checks equality by comparing each attribute.
107
+ # @param [Object] Object to be compared
108
+ def ==(o)
109
+ return true if self.equal?(o)
110
+ self.class == o.class &&
111
+ title == o.title &&
112
+ details == o.details &&
113
+ code == o.code
114
+ end
115
+
116
+ # @see the `==` method
117
+ # @param [Object] Object to be compared
118
+ def eql?(o)
119
+ self == o
120
+ end
121
+
122
+ # Calculates hash code according to all attributes.
123
+ # @return [Integer] Hash code
124
+ def hash
125
+ [title, details, code].hash
126
+ end
127
+
128
+ # Builds the object from hash
129
+ # @param [Hash] attributes Model attributes in the form of hash
130
+ # @return [Object] Returns the model itself
131
+ def self.build_from_hash(attributes)
132
+ new.build_from_hash(attributes)
133
+ end
134
+
135
+ # Builds the object from hash
136
+ # @param [Hash] attributes Model attributes in the form of hash
137
+ # @return [Object] Returns the model itself
138
+ def build_from_hash(attributes)
139
+ return nil unless attributes.is_a?(Hash)
140
+ self.class.openapi_types.each_pair do |key, type|
141
+ if type =~ /\AArray<(.*)>/i
142
+ # check to ensure the input is an array given that the attribute
143
+ # is documented as an array but the input is not
144
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
145
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
146
+ end
147
+ elsif !attributes[self.class.attribute_map[key]].nil?
148
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
149
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
150
+ end
151
+
152
+ self
153
+ end
154
+
155
+ # Deserializes the data based on type
156
+ # @param string type Data type
157
+ # @param string value Value to be deserialized
158
+ # @return [Object] Deserialized data
159
+ def _deserialize(type, value)
160
+ case type.to_sym
161
+ when :DateTime
162
+ DateTime.parse(value)
163
+ when :Date
164
+ Date.parse(value)
165
+ when :String
166
+ value.to_s
167
+ when :Integer
168
+ value.to_i
169
+ when :Float
170
+ value.to_f
171
+ when :Boolean
172
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
173
+ true
174
+ else
175
+ false
176
+ end
177
+ when :Object
178
+ # generic object (usually a Hash), return directly
179
+ value
180
+ when /\AArray<(?<inner_type>.+)>\z/
181
+ inner_type = Regexp.last_match[:inner_type]
182
+ value.map { |v| _deserialize(inner_type, v) }
183
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
184
+ k_type = Regexp.last_match[:k_type]
185
+ v_type = Regexp.last_match[:v_type]
186
+ {}.tap do |hash|
187
+ value.each do |k, v|
188
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
189
+ end
190
+ end
191
+ else # model
192
+ MessenteApi.const_get(type).build_from_hash(value)
193
+ end
194
+ end
195
+
196
+ # Returns the string representation of the object
197
+ # @return [String] String presentation of the object
198
+ def to_s
199
+ to_hash.to_s
200
+ end
201
+
202
+ # to_body is an alias to to_hash (backward compatibility)
203
+ # @return [Hash] Returns the object in the form of hash
204
+ def to_body
205
+ to_hash
206
+ end
207
+
208
+ # Returns the object in the form of hash
209
+ # @return [Hash] Returns the object in the form of hash
210
+ def to_hash
211
+ hash = {}
212
+ self.class.attribute_map.each_pair do |attr, param|
213
+ value = self.send(attr)
214
+ if value.nil?
215
+ is_nullable = self.class.openapi_nullable.include?(attr)
216
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
217
+ end
218
+
219
+ hash[param] = _to_hash(value)
220
+ end
221
+ hash
222
+ end
223
+
224
+ # Outputs non-array value in the form of hash
225
+ # For object, use to_hash. Otherwise, just return the value
226
+ # @param [Object] value Any valid value
227
+ # @return [Hash] Returns the value in the form of hash
228
+ def _to_hash(value)
229
+ if value.is_a?(Array)
230
+ value.compact.map { |v| _to_hash(v) }
231
+ elsif value.is_a?(Hash)
232
+ {}.tap do |hash|
233
+ value.each { |k, v| hash[k] = _to_hash(v) }
234
+ end
235
+ elsif value.respond_to? :to_hash
236
+ value.to_hash
237
+ else
238
+ value
239
+ end
240
+ end
241
+ end
242
+ end
@@ -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 errors
17
+ class ErrorNumberLookup
18
+ # An array of errors
19
+ attr_accessor :errors
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'errors' => :'errors'
25
+ }
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.openapi_types
30
+ {
31
+ :'errors' => :'Array<ErrorItemNumberLookup>'
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::ErrorNumberLookup` 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::ErrorNumberLookup`. 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?(:'errors')
57
+ if (value = attributes[:'errors']).is_a?(Array)
58
+ self.errors = 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 @errors.nil?
68
+ invalid_properties.push('invalid value for "errors", errors 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 @errors.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
+ errors == o.errors
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
+ [errors].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