messente_api 2.2.0 → 2.4.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 (138) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +24 -1
  3. data/docs/AccountBalanceApi.md +161 -0
  4. data/docs/NumberVerificationApi.md +195 -0
  5. data/docs/Price.md +24 -0
  6. data/docs/PriceNetworksInner.md +22 -0
  7. data/docs/PricingApi.md +167 -0
  8. data/docs/WhatsApp.md +13 -1
  9. data/docs/WhatsAppAudio.md +22 -0
  10. data/docs/WhatsAppDocument.md +26 -0
  11. data/docs/WhatsAppImage.md +24 -0
  12. data/docs/WhatsAppParameter.md +5 -1
  13. data/docs/WhatsAppSticker.md +24 -0
  14. data/docs/WhatsAppTemplate.md +1 -1
  15. data/docs/WhatsAppTemplatesApi.md +384 -0
  16. data/docs/WhatsAppText.md +20 -0
  17. data/docs/WhatsAppVideo.md +24 -0
  18. data/docs/WhatsappButtonType.md +15 -0
  19. data/docs/WhatsappComponentType.md +15 -0
  20. data/docs/WhatsappCreateTemplateRequest.md +24 -0
  21. data/docs/WhatsappCreateTemplateResponse.md +22 -0
  22. data/docs/WhatsappHeaderFormat.md +15 -0
  23. data/docs/WhatsappListTemplatesResponse.md +20 -0
  24. data/docs/WhatsappOtpButtonType.md +15 -0
  25. data/docs/WhatsappPagination.md +22 -0
  26. data/docs/WhatsappPagingCursors.md +20 -0
  27. data/docs/WhatsappSupportedApp.md +20 -0
  28. data/docs/WhatsappTemplateButton.md +30 -0
  29. data/docs/WhatsappTemplateCategory.md +15 -0
  30. data/docs/WhatsappTemplateComponent.md +26 -0
  31. data/docs/WhatsappTemplateExample.md +20 -0
  32. data/docs/WhatsappTemplateResponse.md +28 -0
  33. data/docs/WhatsappTemplateStatus.md +15 -0
  34. data/docs/WhatsappUpdateTemplateRequest.md +20 -0
  35. data/lib/messente_api/api/account_balance_api.rb +160 -0
  36. data/lib/messente_api/api/blacklist_api.rb +5 -5
  37. data/lib/messente_api/api/bulk_messaging_api.rb +2 -2
  38. data/lib/messente_api/api/contacts_api.rb +9 -9
  39. data/lib/messente_api/api/delivery_report_api.rb +2 -2
  40. data/lib/messente_api/api/groups_api.rb +6 -6
  41. data/lib/messente_api/api/number_lookup_api.rb +2 -2
  42. data/lib/messente_api/api/number_verification_api.rb +217 -0
  43. data/lib/messente_api/api/omnimessage_api.rb +3 -3
  44. data/lib/messente_api/api/pricing_api.rb +170 -0
  45. data/lib/messente_api/api/statistics_api.rb +2 -2
  46. data/lib/messente_api/api/whats_app_templates_api.rb +399 -0
  47. data/lib/messente_api/api_client.rb +1 -1
  48. data/lib/messente_api/api_error.rb +1 -1
  49. data/lib/messente_api/configuration.rb +61 -1
  50. data/lib/messente_api/models/bulk_omni_message_create_success_response.rb +1 -1
  51. data/lib/messente_api/models/bulk_omni_message_create_success_response_messages_inner.rb +1 -1
  52. data/lib/messente_api/models/bulk_omnimessage.rb +1 -1
  53. data/lib/messente_api/models/channel.rb +1 -1
  54. data/lib/messente_api/models/contact_envelope.rb +1 -1
  55. data/lib/messente_api/models/contact_fields.rb +1 -1
  56. data/lib/messente_api/models/contact_list_envelope.rb +1 -1
  57. data/lib/messente_api/models/contact_response_fields.rb +1 -1
  58. data/lib/messente_api/models/contact_update_fields.rb +1 -1
  59. data/lib/messente_api/models/delivery_report_response.rb +1 -1
  60. data/lib/messente_api/models/delivery_result.rb +1 -1
  61. data/lib/messente_api/models/error_code_omnichannel.rb +1 -1
  62. data/lib/messente_api/models/error_code_omnichannel_machine.rb +1 -1
  63. data/lib/messente_api/models/error_code_phonebook.rb +1 -1
  64. data/lib/messente_api/models/error_code_statistics.rb +1 -1
  65. data/lib/messente_api/models/error_item_number_lookup.rb +1 -1
  66. data/lib/messente_api/models/error_item_number_lookup_error.rb +1 -1
  67. data/lib/messente_api/models/error_item_omnichannel.rb +1 -1
  68. data/lib/messente_api/models/error_item_phonebook.rb +1 -1
  69. data/lib/messente_api/models/error_item_statistics.rb +1 -1
  70. data/lib/messente_api/models/error_number_lookup.rb +1 -1
  71. data/lib/messente_api/models/error_omnichannel.rb +1 -1
  72. data/lib/messente_api/models/error_phonebook.rb +1 -1
  73. data/lib/messente_api/models/error_statistics.rb +1 -1
  74. data/lib/messente_api/models/error_title_omnichannel.rb +1 -1
  75. data/lib/messente_api/models/error_title_phonebook.rb +1 -1
  76. data/lib/messente_api/models/fetch_blacklist_success.rb +1 -1
  77. data/lib/messente_api/models/group_envelope.rb +1 -1
  78. data/lib/messente_api/models/group_list_envelope.rb +1 -1
  79. data/lib/messente_api/models/group_name.rb +1 -1
  80. data/lib/messente_api/models/group_response_fields.rb +1 -1
  81. data/lib/messente_api/models/message_result.rb +1 -1
  82. data/lib/messente_api/models/mobile_network.rb +1 -1
  83. data/lib/messente_api/models/number_to_blacklist.rb +1 -1
  84. data/lib/messente_api/models/numbers_to_investigate.rb +1 -1
  85. data/lib/messente_api/models/omni_message_create_success_response.rb +1 -1
  86. data/lib/messente_api/models/omnimessage.rb +1 -1
  87. data/lib/messente_api/models/omnimessage_messages_inner.rb +1 -1
  88. data/lib/messente_api/models/price.rb +276 -0
  89. data/lib/messente_api/models/price_info.rb +1 -1
  90. data/lib/messente_api/models/price_networks_inner.rb +257 -0
  91. data/lib/messente_api/models/priority.rb +1 -1
  92. data/lib/messente_api/models/sms.rb +1 -1
  93. data/lib/messente_api/models/statistics_report.rb +1 -1
  94. data/lib/messente_api/models/statistics_report_settings.rb +1 -1
  95. data/lib/messente_api/models/statistics_report_success.rb +1 -1
  96. data/lib/messente_api/models/status.rb +1 -1
  97. data/lib/messente_api/models/sync_number_lookup_result.rb +1 -1
  98. data/lib/messente_api/models/sync_number_lookup_success.rb +1 -1
  99. data/lib/messente_api/models/telegram.rb +1 -1
  100. data/lib/messente_api/models/text_store.rb +1 -1
  101. data/lib/messente_api/models/viber.rb +1 -1
  102. data/lib/messente_api/models/viber_video.rb +1 -1
  103. data/lib/messente_api/models/whats_app.rb +59 -5
  104. data/lib/messente_api/models/whats_app_audio.rb +239 -0
  105. data/lib/messente_api/models/whats_app_component.rb +2 -1
  106. data/lib/messente_api/models/whats_app_currency.rb +1 -1
  107. data/lib/messente_api/models/whats_app_datetime.rb +1 -1
  108. data/lib/messente_api/models/whats_app_document.rb +261 -0
  109. data/lib/messente_api/models/whats_app_image.rb +250 -0
  110. data/lib/messente_api/models/whats_app_language.rb +1 -1
  111. data/lib/messente_api/models/whats_app_media.rb +1 -1
  112. data/lib/messente_api/models/whats_app_parameter.rb +25 -5
  113. data/lib/messente_api/models/whats_app_sticker.rb +250 -0
  114. data/lib/messente_api/models/whats_app_template.rb +8 -1
  115. data/lib/messente_api/models/whats_app_text.rb +235 -0
  116. data/lib/messente_api/models/whats_app_video.rb +250 -0
  117. data/lib/messente_api/models/whatsapp_button_type.rb +45 -0
  118. data/lib/messente_api/models/whatsapp_component_type.rb +42 -0
  119. data/lib/messente_api/models/whatsapp_create_template_request.rb +297 -0
  120. data/lib/messente_api/models/whatsapp_create_template_response.rb +277 -0
  121. data/lib/messente_api/models/whatsapp_header_format.rb +39 -0
  122. data/lib/messente_api/models/whatsapp_list_templates_response.rb +241 -0
  123. data/lib/messente_api/models/whatsapp_otp_button_type.rb +41 -0
  124. data/lib/messente_api/models/whatsapp_pagination.rb +242 -0
  125. data/lib/messente_api/models/whatsapp_paging_cursors.rb +226 -0
  126. data/lib/messente_api/models/whatsapp_supported_app.rb +240 -0
  127. data/lib/messente_api/models/whatsapp_template_button.rb +355 -0
  128. data/lib/messente_api/models/whatsapp_template_category.rb +41 -0
  129. data/lib/messente_api/models/whatsapp_template_component.rb +277 -0
  130. data/lib/messente_api/models/whatsapp_template_example.rb +230 -0
  131. data/lib/messente_api/models/whatsapp_template_response.rb +330 -0
  132. data/lib/messente_api/models/whatsapp_template_status.rb +47 -0
  133. data/lib/messente_api/models/whatsapp_update_template_request.rb +227 -0
  134. data/lib/messente_api/version.rb +2 -2
  135. data/lib/messente_api.rb +30 -1
  136. data/messente_api.gemspec +1 -1
  137. data/spec/spec_helper.rb +1 -1
  138. metadata +60 -2
@@ -0,0 +1,355 @@
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: 2.0.0
7
+ Contact: messente@messente.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.11.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module MessenteApi
17
+ # Whatsapp button object.
18
+ class WhatsappTemplateButton
19
+ attr_accessor :type
20
+
21
+ attr_accessor :otp_type
22
+
23
+ # Text to be autofilled in the OTP field
24
+ attr_accessor :autofill_text
25
+
26
+ # List of supported apps for the button
27
+ attr_accessor :supported_apps
28
+
29
+ # Text content of the button
30
+ attr_accessor :text
31
+
32
+ # Phone number for the button
33
+ attr_accessor :phone_number
34
+
35
+ # URL for the button
36
+ attr_accessor :url
37
+
38
+ class EnumAttributeValidator
39
+ attr_reader :datatype
40
+ attr_reader :allowable_values
41
+
42
+ def initialize(datatype, allowable_values)
43
+ @allowable_values = allowable_values.map do |value|
44
+ case datatype.to_s
45
+ when /Integer/i
46
+ value.to_i
47
+ when /Float/i
48
+ value.to_f
49
+ else
50
+ value
51
+ end
52
+ end
53
+ end
54
+
55
+ def valid?(value)
56
+ !value || allowable_values.include?(value)
57
+ end
58
+ end
59
+
60
+ # Attribute mapping from ruby-style variable name to JSON key.
61
+ def self.attribute_map
62
+ {
63
+ :'type' => :'type',
64
+ :'otp_type' => :'otp_type',
65
+ :'autofill_text' => :'autofill_text',
66
+ :'supported_apps' => :'supported_apps',
67
+ :'text' => :'text',
68
+ :'phone_number' => :'phone_number',
69
+ :'url' => :'url'
70
+ }
71
+ end
72
+
73
+ # Returns all the JSON keys this model knows about
74
+ def self.acceptable_attributes
75
+ attribute_map.values
76
+ end
77
+
78
+ # Attribute type mapping.
79
+ def self.openapi_types
80
+ {
81
+ :'type' => :'WhatsappButtonType',
82
+ :'otp_type' => :'WhatsappOtpButtonType',
83
+ :'autofill_text' => :'String',
84
+ :'supported_apps' => :'Array<WhatsappSupportedApp>',
85
+ :'text' => :'String',
86
+ :'phone_number' => :'String',
87
+ :'url' => :'String'
88
+ }
89
+ end
90
+
91
+ # List of attributes with nullable: true
92
+ def self.openapi_nullable
93
+ Set.new([
94
+ ])
95
+ end
96
+
97
+ # Initializes the object
98
+ # @param [Hash] attributes Model attributes in the form of hash
99
+ def initialize(attributes = {})
100
+ if (!attributes.is_a?(Hash))
101
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MessenteApi::WhatsappTemplateButton` initialize method"
102
+ end
103
+
104
+ # check to see if the attribute exists and convert string to symbol for hash key
105
+ attributes = attributes.each_with_object({}) { |(k, v), h|
106
+ if (!self.class.attribute_map.key?(k.to_sym))
107
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MessenteApi::WhatsappTemplateButton`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
108
+ end
109
+ h[k.to_sym] = v
110
+ }
111
+
112
+ if attributes.key?(:'type')
113
+ self.type = attributes[:'type']
114
+ end
115
+
116
+ if attributes.key?(:'otp_type')
117
+ self.otp_type = attributes[:'otp_type']
118
+ end
119
+
120
+ if attributes.key?(:'autofill_text')
121
+ self.autofill_text = attributes[:'autofill_text']
122
+ end
123
+
124
+ if attributes.key?(:'supported_apps')
125
+ if (value = attributes[:'supported_apps']).is_a?(Array)
126
+ self.supported_apps = value
127
+ end
128
+ end
129
+
130
+ if attributes.key?(:'text')
131
+ self.text = attributes[:'text']
132
+ end
133
+
134
+ if attributes.key?(:'phone_number')
135
+ self.phone_number = attributes[:'phone_number']
136
+ end
137
+
138
+ if attributes.key?(:'url')
139
+ self.url = attributes[:'url']
140
+ end
141
+ end
142
+
143
+ # Show invalid properties with the reasons. Usually used together with valid?
144
+ # @return Array for valid properties with the reasons
145
+ def list_invalid_properties
146
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
147
+ invalid_properties = Array.new
148
+ if !@text.nil? && @text.to_s.length > 25
149
+ invalid_properties.push('invalid value for "text", the character length must be smaller than or equal to 25.')
150
+ end
151
+
152
+ if !@phone_number.nil? && @phone_number.to_s.length > 20
153
+ invalid_properties.push('invalid value for "phone_number", the character length must be smaller than or equal to 20.')
154
+ end
155
+
156
+ if !@url.nil? && @url.to_s.length > 2000
157
+ invalid_properties.push('invalid value for "url", the character length must be smaller than or equal to 2000.')
158
+ end
159
+
160
+ invalid_properties
161
+ end
162
+
163
+ # Check to see if the all the properties in the model are valid
164
+ # @return true if the model is valid
165
+ def valid?
166
+ warn '[DEPRECATED] the `valid?` method is obsolete'
167
+ return false if !@text.nil? && @text.to_s.length > 25
168
+ return false if !@phone_number.nil? && @phone_number.to_s.length > 20
169
+ return false if !@url.nil? && @url.to_s.length > 2000
170
+ true
171
+ end
172
+
173
+ # Custom attribute writer method with validation
174
+ # @param [Object] text Value to be assigned
175
+ def text=(text)
176
+ if text.nil?
177
+ fail ArgumentError, 'text cannot be nil'
178
+ end
179
+
180
+ if text.to_s.length > 25
181
+ fail ArgumentError, 'invalid value for "text", the character length must be smaller than or equal to 25.'
182
+ end
183
+
184
+ @text = text
185
+ end
186
+
187
+ # Custom attribute writer method with validation
188
+ # @param [Object] phone_number Value to be assigned
189
+ def phone_number=(phone_number)
190
+ if phone_number.nil?
191
+ fail ArgumentError, 'phone_number cannot be nil'
192
+ end
193
+
194
+ if phone_number.to_s.length > 20
195
+ fail ArgumentError, 'invalid value for "phone_number", the character length must be smaller than or equal to 20.'
196
+ end
197
+
198
+ @phone_number = phone_number
199
+ end
200
+
201
+ # Custom attribute writer method with validation
202
+ # @param [Object] url Value to be assigned
203
+ def url=(url)
204
+ if url.nil?
205
+ fail ArgumentError, 'url cannot be nil'
206
+ end
207
+
208
+ if url.to_s.length > 2000
209
+ fail ArgumentError, 'invalid value for "url", the character length must be smaller than or equal to 2000.'
210
+ end
211
+
212
+ @url = url
213
+ end
214
+
215
+ # Checks equality by comparing each attribute.
216
+ # @param [Object] Object to be compared
217
+ def ==(o)
218
+ return true if self.equal?(o)
219
+ self.class == o.class &&
220
+ type == o.type &&
221
+ otp_type == o.otp_type &&
222
+ autofill_text == o.autofill_text &&
223
+ supported_apps == o.supported_apps &&
224
+ text == o.text &&
225
+ phone_number == o.phone_number &&
226
+ url == o.url
227
+ end
228
+
229
+ # @see the `==` method
230
+ # @param [Object] Object to be compared
231
+ def eql?(o)
232
+ self == o
233
+ end
234
+
235
+ # Calculates hash code according to all attributes.
236
+ # @return [Integer] Hash code
237
+ def hash
238
+ [type, otp_type, autofill_text, supported_apps, text, phone_number, url].hash
239
+ end
240
+
241
+ # Builds the object from hash
242
+ # @param [Hash] attributes Model attributes in the form of hash
243
+ # @return [Object] Returns the model itself
244
+ def self.build_from_hash(attributes)
245
+ return nil unless attributes.is_a?(Hash)
246
+ attributes = attributes.transform_keys(&:to_sym)
247
+ transformed_hash = {}
248
+ openapi_types.each_pair do |key, type|
249
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
250
+ transformed_hash["#{key}"] = nil
251
+ elsif type =~ /\AArray<(.*)>/i
252
+ # check to ensure the input is an array given that the attribute
253
+ # is documented as an array but the input is not
254
+ if attributes[attribute_map[key]].is_a?(Array)
255
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
256
+ end
257
+ elsif !attributes[attribute_map[key]].nil?
258
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
259
+ end
260
+ end
261
+ new(transformed_hash)
262
+ end
263
+
264
+ # Deserializes the data based on type
265
+ # @param string type Data type
266
+ # @param string value Value to be deserialized
267
+ # @return [Object] Deserialized data
268
+ def self._deserialize(type, value)
269
+ case type.to_sym
270
+ when :Time
271
+ Time.parse(value)
272
+ when :Date
273
+ Date.parse(value)
274
+ when :String
275
+ value.to_s
276
+ when :Integer
277
+ value.to_i
278
+ when :Float
279
+ value.to_f
280
+ when :Boolean
281
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
282
+ true
283
+ else
284
+ false
285
+ end
286
+ when :Object
287
+ # generic object (usually a Hash), return directly
288
+ value
289
+ when /\AArray<(?<inner_type>.+)>\z/
290
+ inner_type = Regexp.last_match[:inner_type]
291
+ value.map { |v| _deserialize(inner_type, v) }
292
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
293
+ k_type = Regexp.last_match[:k_type]
294
+ v_type = Regexp.last_match[:v_type]
295
+ {}.tap do |hash|
296
+ value.each do |k, v|
297
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
298
+ end
299
+ end
300
+ else # model
301
+ # models (e.g. Pet) or oneOf
302
+ klass = MessenteApi.const_get(type)
303
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
304
+ end
305
+ end
306
+
307
+ # Returns the string representation of the object
308
+ # @return [String] String presentation of the object
309
+ def to_s
310
+ to_hash.to_s
311
+ end
312
+
313
+ # to_body is an alias to to_hash (backward compatibility)
314
+ # @return [Hash] Returns the object in the form of hash
315
+ def to_body
316
+ to_hash
317
+ end
318
+
319
+ # Returns the object in the form of hash
320
+ # @return [Hash] Returns the object in the form of hash
321
+ def to_hash
322
+ hash = {}
323
+ self.class.attribute_map.each_pair do |attr, param|
324
+ value = self.send(attr)
325
+ if value.nil?
326
+ is_nullable = self.class.openapi_nullable.include?(attr)
327
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
328
+ end
329
+
330
+ hash[param] = _to_hash(value)
331
+ end
332
+ hash
333
+ end
334
+
335
+ # Outputs non-array value in the form of hash
336
+ # For object, use to_hash. Otherwise, just return the value
337
+ # @param [Object] value Any valid value
338
+ # @return [Hash] Returns the value in the form of hash
339
+ def _to_hash(value)
340
+ if value.is_a?(Array)
341
+ value.compact.map { |v| _to_hash(v) }
342
+ elsif value.is_a?(Hash)
343
+ {}.tap do |hash|
344
+ value.each { |k, v| hash[k] = _to_hash(v) }
345
+ end
346
+ elsif value.respond_to? :to_hash
347
+ value.to_hash
348
+ else
349
+ value
350
+ end
351
+ end
352
+
353
+ end
354
+
355
+ end
@@ -0,0 +1,41 @@
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: 2.0.0
7
+ Contact: messente@messente.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.11.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module MessenteApi
17
+ class WhatsappTemplateCategory
18
+ AUTHENTICATION = "authentication".freeze
19
+ MARKETING = "marketing".freeze
20
+ UTILITY = "utility".freeze
21
+
22
+ def self.all_vars
23
+ @all_vars ||= [AUTHENTICATION, MARKETING, UTILITY].freeze
24
+ end
25
+
26
+ # Builds the enum from string
27
+ # @param [String] The enum value in the form of the string
28
+ # @return [String] The enum value
29
+ def self.build_from_hash(value)
30
+ new.build_from_hash(value)
31
+ end
32
+
33
+ # Builds the enum from string
34
+ # @param [String] The enum value in the form of the string
35
+ # @return [String] The enum value
36
+ def build_from_hash(value)
37
+ return value if WhatsappTemplateCategory.all_vars.include?(value)
38
+ raise "Invalid ENUM value #{value} for class #WhatsappTemplateCategory"
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,277 @@
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: 2.0.0
7
+ Contact: messente@messente.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.11.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module MessenteApi
17
+ # Template component object
18
+ class WhatsappTemplateComponent
19
+ attr_accessor :type
20
+
21
+ attr_accessor :format
22
+
23
+ # Text content of the component
24
+ attr_accessor :text
25
+
26
+ attr_accessor :example
27
+
28
+ # List of buttons for the component
29
+ attr_accessor :buttons
30
+
31
+ class EnumAttributeValidator
32
+ attr_reader :datatype
33
+ attr_reader :allowable_values
34
+
35
+ def initialize(datatype, allowable_values)
36
+ @allowable_values = allowable_values.map do |value|
37
+ case datatype.to_s
38
+ when /Integer/i
39
+ value.to_i
40
+ when /Float/i
41
+ value.to_f
42
+ else
43
+ value
44
+ end
45
+ end
46
+ end
47
+
48
+ def valid?(value)
49
+ !value || allowable_values.include?(value)
50
+ end
51
+ end
52
+
53
+ # Attribute mapping from ruby-style variable name to JSON key.
54
+ def self.attribute_map
55
+ {
56
+ :'type' => :'type',
57
+ :'format' => :'format',
58
+ :'text' => :'text',
59
+ :'example' => :'example',
60
+ :'buttons' => :'buttons'
61
+ }
62
+ end
63
+
64
+ # Returns all the JSON keys this model knows about
65
+ def self.acceptable_attributes
66
+ attribute_map.values
67
+ end
68
+
69
+ # Attribute type mapping.
70
+ def self.openapi_types
71
+ {
72
+ :'type' => :'WhatsappComponentType',
73
+ :'format' => :'WhatsappHeaderFormat',
74
+ :'text' => :'String',
75
+ :'example' => :'WhatsappTemplateExample',
76
+ :'buttons' => :'Array<WhatsappTemplateButton>'
77
+ }
78
+ end
79
+
80
+ # List of attributes with nullable: true
81
+ def self.openapi_nullable
82
+ Set.new([
83
+ ])
84
+ end
85
+
86
+ # Initializes the object
87
+ # @param [Hash] attributes Model attributes in the form of hash
88
+ def initialize(attributes = {})
89
+ if (!attributes.is_a?(Hash))
90
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MessenteApi::WhatsappTemplateComponent` initialize method"
91
+ end
92
+
93
+ # check to see if the attribute exists and convert string to symbol for hash key
94
+ attributes = attributes.each_with_object({}) { |(k, v), h|
95
+ if (!self.class.attribute_map.key?(k.to_sym))
96
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MessenteApi::WhatsappTemplateComponent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
97
+ end
98
+ h[k.to_sym] = v
99
+ }
100
+
101
+ if attributes.key?(:'type')
102
+ self.type = attributes[:'type']
103
+ end
104
+
105
+ if attributes.key?(:'format')
106
+ self.format = attributes[:'format']
107
+ end
108
+
109
+ if attributes.key?(:'text')
110
+ self.text = attributes[:'text']
111
+ end
112
+
113
+ if attributes.key?(:'example')
114
+ self.example = attributes[:'example']
115
+ end
116
+
117
+ if attributes.key?(:'buttons')
118
+ if (value = attributes[:'buttons']).is_a?(Array)
119
+ self.buttons = value
120
+ end
121
+ end
122
+ end
123
+
124
+ # Show invalid properties with the reasons. Usually used together with valid?
125
+ # @return Array for valid properties with the reasons
126
+ def list_invalid_properties
127
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
128
+ invalid_properties = Array.new
129
+ invalid_properties
130
+ end
131
+
132
+ # Check to see if the all the properties in the model are valid
133
+ # @return true if the model is valid
134
+ def valid?
135
+ warn '[DEPRECATED] the `valid?` method is obsolete'
136
+ true
137
+ end
138
+
139
+ # Checks equality by comparing each attribute.
140
+ # @param [Object] Object to be compared
141
+ def ==(o)
142
+ return true if self.equal?(o)
143
+ self.class == o.class &&
144
+ type == o.type &&
145
+ format == o.format &&
146
+ text == o.text &&
147
+ example == o.example &&
148
+ buttons == o.buttons
149
+ end
150
+
151
+ # @see the `==` method
152
+ # @param [Object] Object to be compared
153
+ def eql?(o)
154
+ self == o
155
+ end
156
+
157
+ # Calculates hash code according to all attributes.
158
+ # @return [Integer] Hash code
159
+ def hash
160
+ [type, format, text, example, buttons].hash
161
+ end
162
+
163
+ # Builds the object from hash
164
+ # @param [Hash] attributes Model attributes in the form of hash
165
+ # @return [Object] Returns the model itself
166
+ def self.build_from_hash(attributes)
167
+ return nil unless attributes.is_a?(Hash)
168
+ attributes = attributes.transform_keys(&:to_sym)
169
+ transformed_hash = {}
170
+ openapi_types.each_pair do |key, type|
171
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
172
+ transformed_hash["#{key}"] = nil
173
+ elsif type =~ /\AArray<(.*)>/i
174
+ # check to ensure the input is an array given that the attribute
175
+ # is documented as an array but the input is not
176
+ if attributes[attribute_map[key]].is_a?(Array)
177
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
178
+ end
179
+ elsif !attributes[attribute_map[key]].nil?
180
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
181
+ end
182
+ end
183
+ new(transformed_hash)
184
+ end
185
+
186
+ # Deserializes the data based on type
187
+ # @param string type Data type
188
+ # @param string value Value to be deserialized
189
+ # @return [Object] Deserialized data
190
+ def self._deserialize(type, value)
191
+ case type.to_sym
192
+ when :Time
193
+ Time.parse(value)
194
+ when :Date
195
+ Date.parse(value)
196
+ when :String
197
+ value.to_s
198
+ when :Integer
199
+ value.to_i
200
+ when :Float
201
+ value.to_f
202
+ when :Boolean
203
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
204
+ true
205
+ else
206
+ false
207
+ end
208
+ when :Object
209
+ # generic object (usually a Hash), return directly
210
+ value
211
+ when /\AArray<(?<inner_type>.+)>\z/
212
+ inner_type = Regexp.last_match[:inner_type]
213
+ value.map { |v| _deserialize(inner_type, v) }
214
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
215
+ k_type = Regexp.last_match[:k_type]
216
+ v_type = Regexp.last_match[:v_type]
217
+ {}.tap do |hash|
218
+ value.each do |k, v|
219
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
220
+ end
221
+ end
222
+ else # model
223
+ # models (e.g. Pet) or oneOf
224
+ klass = MessenteApi.const_get(type)
225
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
226
+ end
227
+ end
228
+
229
+ # Returns the string representation of the object
230
+ # @return [String] String presentation of the object
231
+ def to_s
232
+ to_hash.to_s
233
+ end
234
+
235
+ # to_body is an alias to to_hash (backward compatibility)
236
+ # @return [Hash] Returns the object in the form of hash
237
+ def to_body
238
+ to_hash
239
+ end
240
+
241
+ # Returns the object in the form of hash
242
+ # @return [Hash] Returns the object in the form of hash
243
+ def to_hash
244
+ hash = {}
245
+ self.class.attribute_map.each_pair do |attr, param|
246
+ value = self.send(attr)
247
+ if value.nil?
248
+ is_nullable = self.class.openapi_nullable.include?(attr)
249
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
250
+ end
251
+
252
+ hash[param] = _to_hash(value)
253
+ end
254
+ hash
255
+ end
256
+
257
+ # Outputs non-array value in the form of hash
258
+ # For object, use to_hash. Otherwise, just return the value
259
+ # @param [Object] value Any valid value
260
+ # @return [Hash] Returns the value in the form of hash
261
+ def _to_hash(value)
262
+ if value.is_a?(Array)
263
+ value.compact.map { |v| _to_hash(v) }
264
+ elsif value.is_a?(Hash)
265
+ {}.tap do |hash|
266
+ value.each { |k, v| hash[k] = _to_hash(v) }
267
+ end
268
+ elsif value.respond_to? :to_hash
269
+ value.to_hash
270
+ else
271
+ value
272
+ end
273
+ end
274
+
275
+ end
276
+
277
+ end