messente_api 1.4.0 → 2.2.0

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 (151) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +33 -30
  3. data/docs/BlacklistApi.md +105 -37
  4. data/docs/BulkMessagingApi.md +76 -0
  5. data/docs/BulkOmniMessageCreateSuccessResponse.md +18 -0
  6. data/docs/BulkOmniMessageCreateSuccessResponseMessagesInner.md +49 -0
  7. data/docs/BulkOmnimessage.md +18 -0
  8. data/docs/Channel.md +4 -5
  9. data/docs/ContactEnvelope.md +8 -7
  10. data/docs/ContactFields.md +26 -25
  11. data/docs/ContactListEnvelope.md +8 -7
  12. data/docs/ContactResponseFields.md +28 -27
  13. data/docs/ContactUpdateFields.md +24 -23
  14. data/docs/ContactsApi.md +221 -86
  15. data/docs/DeliveryReportApi.md +29 -13
  16. data/docs/DeliveryReportResponse.md +12 -11
  17. data/docs/DeliveryResult.md +22 -17
  18. data/docs/ErrorCodeOmnichannel.md +4 -5
  19. data/docs/ErrorCodeOmnichannelMachine.md +4 -5
  20. data/docs/ErrorCodePhonebook.md +4 -5
  21. data/docs/ErrorCodeStatistics.md +4 -5
  22. data/docs/ErrorItemNumberLookup.md +8 -7
  23. data/docs/ErrorItemNumberLookupError.md +10 -9
  24. data/docs/ErrorItemOmnichannel.md +14 -13
  25. data/docs/ErrorItemPhonebook.md +12 -11
  26. data/docs/ErrorItemStatistics.md +12 -11
  27. data/docs/ErrorNumberLookup.md +8 -7
  28. data/docs/ErrorOmnichannel.md +8 -7
  29. data/docs/ErrorPhonebook.md +8 -7
  30. data/docs/ErrorStatistics.md +8 -7
  31. data/docs/ErrorTitleOmnichannel.md +4 -5
  32. data/docs/ErrorTitlePhonebook.md +4 -5
  33. data/docs/FetchBlacklistSuccess.md +8 -7
  34. data/docs/GroupEnvelope.md +8 -7
  35. data/docs/GroupListEnvelope.md +8 -7
  36. data/docs/GroupName.md +8 -7
  37. data/docs/GroupResponseFields.md +14 -13
  38. data/docs/GroupsApi.md +136 -51
  39. data/docs/MessageResult.md +12 -11
  40. data/docs/MobileNetwork.md +16 -15
  41. data/docs/NumberLookupApi.md +30 -14
  42. data/docs/NumberToBlacklist.md +8 -7
  43. data/docs/NumbersToInvestigate.md +8 -7
  44. data/docs/OmniMessageCreateSuccessResponse.md +12 -11
  45. data/docs/Omnimessage.md +18 -17
  46. data/docs/OmnimessageApi.md +56 -23
  47. data/docs/OmnimessageMessagesInner.md +53 -0
  48. data/docs/PriceInfo.md +22 -0
  49. data/docs/Priority.md +4 -5
  50. data/docs/SMS.md +20 -17
  51. data/docs/StatisticsApi.md +30 -14
  52. data/docs/StatisticsReport.md +12 -11
  53. data/docs/StatisticsReportSettings.md +12 -11
  54. data/docs/StatisticsReportSuccess.md +8 -7
  55. data/docs/Status.md +4 -5
  56. data/docs/SyncNumberLookupResult.md +24 -23
  57. data/docs/SyncNumberLookupSuccess.md +10 -9
  58. data/docs/Telegram.md +20 -19
  59. data/docs/TextStore.md +4 -5
  60. data/docs/Viber.md +24 -19
  61. data/docs/ViberVideo.md +24 -0
  62. data/docs/WhatsApp.md +16 -19
  63. data/docs/WhatsAppComponent.md +24 -0
  64. data/docs/WhatsAppCurrency.md +22 -0
  65. data/docs/WhatsAppDatetime.md +18 -0
  66. data/docs/WhatsAppLanguage.md +20 -0
  67. data/docs/WhatsAppMedia.md +24 -0
  68. data/docs/WhatsAppParameter.md +30 -0
  69. data/docs/WhatsAppTemplate.md +22 -0
  70. data/git_push.sh +3 -4
  71. data/lib/messente_api/api/blacklist_api.rb +22 -15
  72. data/lib/messente_api/api/bulk_messaging_api.rb +88 -0
  73. data/lib/messente_api/api/contacts_api.rb +42 -28
  74. data/lib/messente_api/api/delivery_report_api.rb +6 -5
  75. data/lib/messente_api/api/groups_api.rb +30 -19
  76. data/lib/messente_api/api/number_lookup_api.rb +10 -6
  77. data/lib/messente_api/api/omnimessage_api.rb +14 -9
  78. data/lib/messente_api/api/statistics_api.rb +10 -6
  79. data/lib/messente_api/api_client.rb +72 -66
  80. data/lib/messente_api/api_error.rb +3 -2
  81. data/lib/messente_api/configuration.rb +64 -14
  82. data/lib/messente_api/models/{whats_app_audio.rb → bulk_omni_message_create_success_response.rb} +50 -38
  83. data/lib/messente_api/models/bulk_omni_message_create_success_response_messages_inner.rb +105 -0
  84. data/lib/messente_api/models/{whats_app_text.rb → bulk_omnimessage.rb} +49 -49
  85. data/lib/messente_api/models/channel.rb +9 -5
  86. data/lib/messente_api/models/contact_envelope.rb +31 -23
  87. data/lib/messente_api/models/contact_fields.rb +33 -23
  88. data/lib/messente_api/models/contact_list_envelope.rb +41 -23
  89. data/lib/messente_api/models/contact_response_fields.rb +31 -23
  90. data/lib/messente_api/models/contact_update_fields.rb +31 -23
  91. data/lib/messente_api/models/delivery_report_response.rb +37 -23
  92. data/lib/messente_api/models/delivery_result.rb +77 -27
  93. data/lib/messente_api/models/error_code_omnichannel.rb +9 -5
  94. data/lib/messente_api/models/error_code_omnichannel_machine.rb +9 -5
  95. data/lib/messente_api/models/error_code_phonebook.rb +9 -5
  96. data/lib/messente_api/models/error_code_statistics.rb +9 -5
  97. data/lib/messente_api/models/error_item_number_lookup.rb +33 -23
  98. data/lib/messente_api/models/error_item_number_lookup_error.rb +35 -23
  99. data/lib/messente_api/models/error_item_omnichannel.rb +61 -23
  100. data/lib/messente_api/models/error_item_phonebook.rb +59 -23
  101. data/lib/messente_api/models/error_item_statistics.rb +59 -23
  102. data/lib/messente_api/models/error_number_lookup.rb +33 -23
  103. data/lib/messente_api/models/error_omnichannel.rb +33 -23
  104. data/lib/messente_api/models/error_phonebook.rb +33 -23
  105. data/lib/messente_api/models/error_statistics.rb +33 -23
  106. data/lib/messente_api/models/error_title_omnichannel.rb +9 -5
  107. data/lib/messente_api/models/error_title_phonebook.rb +9 -5
  108. data/lib/messente_api/models/fetch_blacklist_success.rb +41 -23
  109. data/lib/messente_api/models/group_envelope.rb +31 -23
  110. data/lib/messente_api/models/group_list_envelope.rb +41 -23
  111. data/lib/messente_api/models/group_name.rb +33 -23
  112. data/lib/messente_api/models/group_response_fields.rb +37 -23
  113. data/lib/messente_api/models/message_result.rb +59 -23
  114. data/lib/messente_api/models/mobile_network.rb +31 -23
  115. data/lib/messente_api/models/number_to_blacklist.rb +33 -23
  116. data/lib/messente_api/models/numbers_to_investigate.rb +62 -24
  117. data/lib/messente_api/models/omni_message_create_success_response.rb +37 -23
  118. data/lib/messente_api/models/omnimessage.rb +59 -25
  119. data/lib/messente_api/models/omnimessage_messages_inner.rb +107 -0
  120. data/lib/messente_api/models/price_info.rb +257 -0
  121. data/lib/messente_api/models/priority.rb +9 -5
  122. data/lib/messente_api/models/sms.rb +45 -25
  123. data/lib/messente_api/models/statistics_report.rb +37 -23
  124. data/lib/messente_api/models/statistics_report_settings.rb +35 -23
  125. data/lib/messente_api/models/statistics_report_success.rb +33 -23
  126. data/lib/messente_api/models/status.rb +9 -5
  127. data/lib/messente_api/models/sync_number_lookup_result.rb +35 -24
  128. data/lib/messente_api/models/sync_number_lookup_success.rb +35 -23
  129. data/lib/messente_api/models/telegram.rb +31 -23
  130. data/lib/messente_api/models/text_store.rb +9 -5
  131. data/lib/messente_api/models/viber.rb +55 -28
  132. data/lib/messente_api/models/viber_video.rb +274 -0
  133. data/lib/messente_api/models/whats_app.rb +45 -54
  134. data/lib/messente_api/models/whats_app_component.rb +255 -0
  135. data/lib/messente_api/models/whats_app_currency.rb +257 -0
  136. data/lib/messente_api/models/{whats_app_document.rb → whats_app_datetime.rb} +48 -48
  137. data/lib/messente_api/models/{whats_app_image.rb → whats_app_language.rb} +55 -45
  138. data/lib/messente_api/models/whats_app_media.rb +246 -0
  139. data/lib/messente_api/models/whats_app_parameter.rb +278 -0
  140. data/lib/messente_api/models/whats_app_template.rb +251 -0
  141. data/lib/messente_api/version.rb +3 -3
  142. data/lib/messente_api.rb +16 -6
  143. data/messente_api.gemspec +5 -5
  144. data/spec/spec_helper.rb +2 -2
  145. metadata +35 -39
  146. data/docs/WhatsAppAudio.md +0 -17
  147. data/docs/WhatsAppDocument.md +0 -19
  148. data/docs/WhatsAppImage.md +0 -19
  149. data/docs/WhatsAppText.md +0 -19
  150. data/spec/api_client_spec.rb +0 -226
  151. data/spec/configuration_spec.rb +0 -42
@@ -3,14 +3,15 @@
3
3
 
4
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.4.0
6
+ The version of the OpenAPI document: 2.0.0
7
7
  Contact: messente@messente.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ Generator version: 7.6.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module MessenteApi
16
17
  # A container for a group
@@ -24,6 +25,11 @@ module MessenteApi
24
25
  }
25
26
  end
26
27
 
28
+ # Returns all the JSON keys this model knows about
29
+ def self.acceptable_attributes
30
+ attribute_map.values
31
+ end
32
+
27
33
  # Attribute type mapping.
28
34
  def self.openapi_types
29
35
  {
@@ -60,6 +66,7 @@ module MessenteApi
60
66
  # Show invalid properties with the reasons. Usually used together with valid?
61
67
  # @return Array for valid properties with the reasons
62
68
  def list_invalid_properties
69
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
63
70
  invalid_properties = Array.new
64
71
  invalid_properties
65
72
  end
@@ -67,6 +74,7 @@ module MessenteApi
67
74
  # Check to see if the all the properties in the model are valid
68
75
  # @return true if the model is valid
69
76
  def valid?
77
+ warn '[DEPRECATED] the `valid?` method is obsolete'
70
78
  true
71
79
  end
72
80
 
@@ -94,37 +102,33 @@ module MessenteApi
94
102
  # @param [Hash] attributes Model attributes in the form of hash
95
103
  # @return [Object] Returns the model itself
96
104
  def self.build_from_hash(attributes)
97
- new.build_from_hash(attributes)
98
- end
99
-
100
- # Builds the object from hash
101
- # @param [Hash] attributes Model attributes in the form of hash
102
- # @return [Object] Returns the model itself
103
- def build_from_hash(attributes)
104
105
  return nil unless attributes.is_a?(Hash)
105
- self.class.openapi_types.each_pair do |key, type|
106
- if type =~ /\AArray<(.*)>/i
106
+ attributes = attributes.transform_keys(&:to_sym)
107
+ transformed_hash = {}
108
+ openapi_types.each_pair do |key, type|
109
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
110
+ transformed_hash["#{key}"] = nil
111
+ elsif type =~ /\AArray<(.*)>/i
107
112
  # check to ensure the input is an array given that the attribute
108
113
  # is documented as an array but the input is not
109
- if attributes[self.class.attribute_map[key]].is_a?(Array)
110
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
114
+ if attributes[attribute_map[key]].is_a?(Array)
115
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
111
116
  end
112
- elsif !attributes[self.class.attribute_map[key]].nil?
113
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
114
- end # or else data not found in attributes(hash), not an issue as the data can be optional
117
+ elsif !attributes[attribute_map[key]].nil?
118
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
119
+ end
115
120
  end
116
-
117
- self
121
+ new(transformed_hash)
118
122
  end
119
123
 
120
124
  # Deserializes the data based on type
121
125
  # @param string type Data type
122
126
  # @param string value Value to be deserialized
123
127
  # @return [Object] Deserialized data
124
- def _deserialize(type, value)
128
+ def self._deserialize(type, value)
125
129
  case type.to_sym
126
- when :DateTime
127
- DateTime.parse(value)
130
+ when :Time
131
+ Time.parse(value)
128
132
  when :Date
129
133
  Date.parse(value)
130
134
  when :String
@@ -154,7 +158,9 @@ module MessenteApi
154
158
  end
155
159
  end
156
160
  else # model
157
- MessenteApi.const_get(type).build_from_hash(value)
161
+ # models (e.g. Pet) or oneOf
162
+ klass = MessenteApi.const_get(type)
163
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
158
164
  end
159
165
  end
160
166
 
@@ -180,7 +186,7 @@ module MessenteApi
180
186
  is_nullable = self.class.openapi_nullable.include?(attr)
181
187
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
182
188
  end
183
-
189
+
184
190
  hash[param] = _to_hash(value)
185
191
  end
186
192
  hash
@@ -203,5 +209,7 @@ module MessenteApi
203
209
  value
204
210
  end
205
211
  end
212
+
206
213
  end
214
+
207
215
  end
@@ -3,14 +3,15 @@
3
3
 
4
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.4.0
6
+ The version of the OpenAPI document: 2.0.0
7
7
  Contact: messente@messente.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ Generator version: 7.6.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module MessenteApi
16
17
  # A container for groups
@@ -25,6 +26,11 @@ module MessenteApi
25
26
  }
26
27
  end
27
28
 
29
+ # Returns all the JSON keys this model knows about
30
+ def self.acceptable_attributes
31
+ attribute_map.values
32
+ end
33
+
28
34
  # Attribute type mapping.
29
35
  def self.openapi_types
30
36
  {
@@ -63,6 +69,7 @@ module MessenteApi
63
69
  # Show invalid properties with the reasons. Usually used together with valid?
64
70
  # @return Array for valid properties with the reasons
65
71
  def list_invalid_properties
72
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
66
73
  invalid_properties = Array.new
67
74
  invalid_properties
68
75
  end
@@ -70,9 +77,20 @@ module MessenteApi
70
77
  # Check to see if the all the properties in the model are valid
71
78
  # @return true if the model is valid
72
79
  def valid?
80
+ warn '[DEPRECATED] the `valid?` method is obsolete'
73
81
  true
74
82
  end
75
83
 
84
+ # Custom attribute writer method with validation
85
+ # @param [Object] groups Value to be assigned
86
+ def groups=(groups)
87
+ if groups.nil?
88
+ fail ArgumentError, 'groups cannot be nil'
89
+ end
90
+
91
+ @groups = groups
92
+ end
93
+
76
94
  # Checks equality by comparing each attribute.
77
95
  # @param [Object] Object to be compared
78
96
  def ==(o)
@@ -97,37 +115,33 @@ module MessenteApi
97
115
  # @param [Hash] attributes Model attributes in the form of hash
98
116
  # @return [Object] Returns the model itself
99
117
  def self.build_from_hash(attributes)
100
- new.build_from_hash(attributes)
101
- end
102
-
103
- # Builds the object from hash
104
- # @param [Hash] attributes Model attributes in the form of hash
105
- # @return [Object] Returns the model itself
106
- def build_from_hash(attributes)
107
118
  return nil unless attributes.is_a?(Hash)
108
- self.class.openapi_types.each_pair do |key, type|
109
- if type =~ /\AArray<(.*)>/i
119
+ attributes = attributes.transform_keys(&:to_sym)
120
+ transformed_hash = {}
121
+ openapi_types.each_pair do |key, type|
122
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
123
+ transformed_hash["#{key}"] = nil
124
+ elsif type =~ /\AArray<(.*)>/i
110
125
  # check to ensure the input is an array given that the attribute
111
126
  # is documented as an array but the input is not
112
- if attributes[self.class.attribute_map[key]].is_a?(Array)
113
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
127
+ if attributes[attribute_map[key]].is_a?(Array)
128
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
114
129
  end
115
- elsif !attributes[self.class.attribute_map[key]].nil?
116
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
117
- end # or else data not found in attributes(hash), not an issue as the data can be optional
130
+ elsif !attributes[attribute_map[key]].nil?
131
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
132
+ end
118
133
  end
119
-
120
- self
134
+ new(transformed_hash)
121
135
  end
122
136
 
123
137
  # Deserializes the data based on type
124
138
  # @param string type Data type
125
139
  # @param string value Value to be deserialized
126
140
  # @return [Object] Deserialized data
127
- def _deserialize(type, value)
141
+ def self._deserialize(type, value)
128
142
  case type.to_sym
129
- when :DateTime
130
- DateTime.parse(value)
143
+ when :Time
144
+ Time.parse(value)
131
145
  when :Date
132
146
  Date.parse(value)
133
147
  when :String
@@ -157,7 +171,9 @@ module MessenteApi
157
171
  end
158
172
  end
159
173
  else # model
160
- MessenteApi.const_get(type).build_from_hash(value)
174
+ # models (e.g. Pet) or oneOf
175
+ klass = MessenteApi.const_get(type)
176
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
161
177
  end
162
178
  end
163
179
 
@@ -183,7 +199,7 @@ module MessenteApi
183
199
  is_nullable = self.class.openapi_nullable.include?(attr)
184
200
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
185
201
  end
186
-
202
+
187
203
  hash[param] = _to_hash(value)
188
204
  end
189
205
  hash
@@ -206,5 +222,7 @@ module MessenteApi
206
222
  value
207
223
  end
208
224
  end
225
+
209
226
  end
227
+
210
228
  end
@@ -3,14 +3,15 @@
3
3
 
4
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.4.0
6
+ The version of the OpenAPI document: 2.0.0
7
7
  Contact: messente@messente.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ Generator version: 7.6.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module MessenteApi
16
17
  # A group name container
@@ -25,6 +26,11 @@ module MessenteApi
25
26
  }
26
27
  end
27
28
 
29
+ # Returns all the JSON keys this model knows about
30
+ def self.acceptable_attributes
31
+ attribute_map.values
32
+ end
33
+
28
34
  # Attribute type mapping.
29
35
  def self.openapi_types
30
36
  {
@@ -55,12 +61,15 @@ module MessenteApi
55
61
 
56
62
  if attributes.key?(:'name')
57
63
  self.name = attributes[:'name']
64
+ else
65
+ self.name = nil
58
66
  end
59
67
  end
60
68
 
61
69
  # Show invalid properties with the reasons. Usually used together with valid?
62
70
  # @return Array for valid properties with the reasons
63
71
  def list_invalid_properties
72
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
64
73
  invalid_properties = Array.new
65
74
  if @name.nil?
66
75
  invalid_properties.push('invalid value for "name", name cannot be nil.')
@@ -76,6 +85,7 @@ module MessenteApi
76
85
  # Check to see if the all the properties in the model are valid
77
86
  # @return true if the model is valid
78
87
  def valid?
88
+ warn '[DEPRECATED] the `valid?` method is obsolete'
79
89
  return false if @name.nil?
80
90
  return false if @name.to_s.length < 1
81
91
  true
@@ -119,37 +129,33 @@ module MessenteApi
119
129
  # @param [Hash] attributes Model attributes in the form of hash
120
130
  # @return [Object] Returns the model itself
121
131
  def self.build_from_hash(attributes)
122
- new.build_from_hash(attributes)
123
- end
124
-
125
- # Builds the object from hash
126
- # @param [Hash] attributes Model attributes in the form of hash
127
- # @return [Object] Returns the model itself
128
- def build_from_hash(attributes)
129
132
  return nil unless attributes.is_a?(Hash)
130
- self.class.openapi_types.each_pair do |key, type|
131
- if type =~ /\AArray<(.*)>/i
133
+ attributes = attributes.transform_keys(&:to_sym)
134
+ transformed_hash = {}
135
+ openapi_types.each_pair do |key, type|
136
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
137
+ transformed_hash["#{key}"] = nil
138
+ elsif type =~ /\AArray<(.*)>/i
132
139
  # check to ensure the input is an array given that the attribute
133
140
  # is documented as an array but the input is not
134
- if attributes[self.class.attribute_map[key]].is_a?(Array)
135
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
141
+ if attributes[attribute_map[key]].is_a?(Array)
142
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
136
143
  end
137
- elsif !attributes[self.class.attribute_map[key]].nil?
138
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
139
- end # or else data not found in attributes(hash), not an issue as the data can be optional
144
+ elsif !attributes[attribute_map[key]].nil?
145
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
146
+ end
140
147
  end
141
-
142
- self
148
+ new(transformed_hash)
143
149
  end
144
150
 
145
151
  # Deserializes the data based on type
146
152
  # @param string type Data type
147
153
  # @param string value Value to be deserialized
148
154
  # @return [Object] Deserialized data
149
- def _deserialize(type, value)
155
+ def self._deserialize(type, value)
150
156
  case type.to_sym
151
- when :DateTime
152
- DateTime.parse(value)
157
+ when :Time
158
+ Time.parse(value)
153
159
  when :Date
154
160
  Date.parse(value)
155
161
  when :String
@@ -179,7 +185,9 @@ module MessenteApi
179
185
  end
180
186
  end
181
187
  else # model
182
- MessenteApi.const_get(type).build_from_hash(value)
188
+ # models (e.g. Pet) or oneOf
189
+ klass = MessenteApi.const_get(type)
190
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
183
191
  end
184
192
  end
185
193
 
@@ -205,7 +213,7 @@ module MessenteApi
205
213
  is_nullable = self.class.openapi_nullable.include?(attr)
206
214
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
207
215
  end
208
-
216
+
209
217
  hash[param] = _to_hash(value)
210
218
  end
211
219
  hash
@@ -228,5 +236,7 @@ module MessenteApi
228
236
  value
229
237
  end
230
238
  end
239
+
231
240
  end
241
+
232
242
  end
@@ -3,14 +3,15 @@
3
3
 
4
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.4.0
6
+ The version of the OpenAPI document: 2.0.0
7
7
  Contact: messente@messente.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ Generator version: 7.6.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module MessenteApi
16
17
  # A container for fields of a group
@@ -37,6 +38,11 @@ module MessenteApi
37
38
  }
38
39
  end
39
40
 
41
+ # Returns all the JSON keys this model knows about
42
+ def self.acceptable_attributes
43
+ attribute_map.values
44
+ end
45
+
40
46
  # Attribute type mapping.
41
47
  def self.openapi_types
42
48
  {
@@ -71,10 +77,14 @@ module MessenteApi
71
77
 
72
78
  if attributes.key?(:'id')
73
79
  self.id = attributes[:'id']
80
+ else
81
+ self.id = nil
74
82
  end
75
83
 
76
84
  if attributes.key?(:'name')
77
85
  self.name = attributes[:'name']
86
+ else
87
+ self.name = nil
78
88
  end
79
89
 
80
90
  if attributes.key?(:'created_on')
@@ -83,12 +93,15 @@ module MessenteApi
83
93
 
84
94
  if attributes.key?(:'contacts_count')
85
95
  self.contacts_count = attributes[:'contacts_count']
96
+ else
97
+ self.contacts_count = nil
86
98
  end
87
99
  end
88
100
 
89
101
  # Show invalid properties with the reasons. Usually used together with valid?
90
102
  # @return Array for valid properties with the reasons
91
103
  def list_invalid_properties
104
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
92
105
  invalid_properties = Array.new
93
106
  if @id.nil?
94
107
  invalid_properties.push('invalid value for "id", id cannot be nil.')
@@ -108,6 +121,7 @@ module MessenteApi
108
121
  # Check to see if the all the properties in the model are valid
109
122
  # @return true if the model is valid
110
123
  def valid?
124
+ warn '[DEPRECATED] the `valid?` method is obsolete'
111
125
  return false if @id.nil?
112
126
  return false if @name.nil?
113
127
  return false if @contacts_count.nil?
@@ -141,37 +155,33 @@ module MessenteApi
141
155
  # @param [Hash] attributes Model attributes in the form of hash
142
156
  # @return [Object] Returns the model itself
143
157
  def self.build_from_hash(attributes)
144
- new.build_from_hash(attributes)
145
- end
146
-
147
- # Builds the object from hash
148
- # @param [Hash] attributes Model attributes in the form of hash
149
- # @return [Object] Returns the model itself
150
- def build_from_hash(attributes)
151
158
  return nil unless attributes.is_a?(Hash)
152
- self.class.openapi_types.each_pair do |key, type|
153
- if type =~ /\AArray<(.*)>/i
159
+ attributes = attributes.transform_keys(&:to_sym)
160
+ transformed_hash = {}
161
+ openapi_types.each_pair do |key, type|
162
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
163
+ transformed_hash["#{key}"] = nil
164
+ elsif type =~ /\AArray<(.*)>/i
154
165
  # check to ensure the input is an array given that the attribute
155
166
  # is documented as an array but the input is not
156
- if attributes[self.class.attribute_map[key]].is_a?(Array)
157
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
167
+ if attributes[attribute_map[key]].is_a?(Array)
168
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
158
169
  end
159
- elsif !attributes[self.class.attribute_map[key]].nil?
160
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
161
- end # or else data not found in attributes(hash), not an issue as the data can be optional
170
+ elsif !attributes[attribute_map[key]].nil?
171
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
172
+ end
162
173
  end
163
-
164
- self
174
+ new(transformed_hash)
165
175
  end
166
176
 
167
177
  # Deserializes the data based on type
168
178
  # @param string type Data type
169
179
  # @param string value Value to be deserialized
170
180
  # @return [Object] Deserialized data
171
- def _deserialize(type, value)
181
+ def self._deserialize(type, value)
172
182
  case type.to_sym
173
- when :DateTime
174
- DateTime.parse(value)
183
+ when :Time
184
+ Time.parse(value)
175
185
  when :Date
176
186
  Date.parse(value)
177
187
  when :String
@@ -201,7 +211,9 @@ module MessenteApi
201
211
  end
202
212
  end
203
213
  else # model
204
- MessenteApi.const_get(type).build_from_hash(value)
214
+ # models (e.g. Pet) or oneOf
215
+ klass = MessenteApi.const_get(type)
216
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
205
217
  end
206
218
  end
207
219
 
@@ -227,7 +239,7 @@ module MessenteApi
227
239
  is_nullable = self.class.openapi_nullable.include?(attr)
228
240
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
229
241
  end
230
-
242
+
231
243
  hash[param] = _to_hash(value)
232
244
  end
233
245
  hash
@@ -250,5 +262,7 @@ module MessenteApi
250
262
  value
251
263
  end
252
264
  end
265
+
253
266
  end
267
+
254
268
  end