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