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,298 @@
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 Card Content
18
+ class RcsCardContent
19
+ # Title of the card content
20
+ attr_accessor :title
21
+
22
+ # Description of the card content
23
+ attr_accessor :description
24
+
25
+ attr_accessor :media
26
+
27
+ # List of suggestions that the recipient can use to respond.
28
+ attr_accessor :suggestions
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'title' => :'title',
34
+ :'description' => :'description',
35
+ :'media' => :'media',
36
+ :'suggestions' => :'suggestions'
37
+ }
38
+ end
39
+
40
+ # Returns all the JSON keys this model knows about
41
+ def self.acceptable_attributes
42
+ attribute_map.values
43
+ end
44
+
45
+ # Attribute type mapping.
46
+ def self.openapi_types
47
+ {
48
+ :'title' => :'String',
49
+ :'description' => :'String',
50
+ :'media' => :'RcsMedia',
51
+ :'suggestions' => :'Array<RcsSuggestion>'
52
+ }
53
+ end
54
+
55
+ # List of attributes with nullable: true
56
+ def self.openapi_nullable
57
+ Set.new([
58
+ :'title',
59
+ :'description',
60
+ ])
61
+ end
62
+
63
+ # Initializes the object
64
+ # @param [Hash] attributes Model attributes in the form of hash
65
+ def initialize(attributes = {})
66
+ if (!attributes.is_a?(Hash))
67
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MessenteApi::RcsCardContent` initialize method"
68
+ end
69
+
70
+ # check to see if the attribute exists and convert string to symbol for hash key
71
+ attributes = attributes.each_with_object({}) { |(k, v), h|
72
+ if (!self.class.attribute_map.key?(k.to_sym))
73
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MessenteApi::RcsCardContent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
74
+ end
75
+ h[k.to_sym] = v
76
+ }
77
+
78
+ if attributes.key?(:'title')
79
+ self.title = attributes[:'title']
80
+ end
81
+
82
+ if attributes.key?(:'description')
83
+ self.description = attributes[:'description']
84
+ end
85
+
86
+ if attributes.key?(:'media')
87
+ self.media = attributes[:'media']
88
+ end
89
+
90
+ if attributes.key?(:'suggestions')
91
+ if (value = attributes[:'suggestions']).is_a?(Array)
92
+ self.suggestions = value
93
+ end
94
+ end
95
+ end
96
+
97
+ # Show invalid properties with the reasons. Usually used together with valid?
98
+ # @return Array for valid properties with the reasons
99
+ def list_invalid_properties
100
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
101
+ invalid_properties = Array.new
102
+ if !@title.nil? && @title.to_s.length > 200
103
+ invalid_properties.push('invalid value for "title", the character length must be smaller than or equal to 200.')
104
+ end
105
+
106
+ if !@description.nil? && @description.to_s.length > 2000
107
+ invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 2000.')
108
+ end
109
+
110
+ if !@suggestions.nil? && @suggestions.length > 4
111
+ invalid_properties.push('invalid value for "suggestions", number of items must be less than or equal to 4.')
112
+ end
113
+
114
+ invalid_properties
115
+ end
116
+
117
+ # Check to see if the all the properties in the model are valid
118
+ # @return true if the model is valid
119
+ def valid?
120
+ warn '[DEPRECATED] the `valid?` method is obsolete'
121
+ return false if !@title.nil? && @title.to_s.length > 200
122
+ return false if !@description.nil? && @description.to_s.length > 2000
123
+ return false if !@suggestions.nil? && @suggestions.length > 4
124
+ true
125
+ end
126
+
127
+ # Custom attribute writer method with validation
128
+ # @param [Object] title Value to be assigned
129
+ def title=(title)
130
+ if !title.nil? && title.to_s.length > 200
131
+ fail ArgumentError, 'invalid value for "title", the character length must be smaller than or equal to 200.'
132
+ end
133
+
134
+ @title = title
135
+ end
136
+
137
+ # Custom attribute writer method with validation
138
+ # @param [Object] description Value to be assigned
139
+ def description=(description)
140
+ if !description.nil? && description.to_s.length > 2000
141
+ fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 2000.'
142
+ end
143
+
144
+ @description = description
145
+ end
146
+
147
+ # Custom attribute writer method with validation
148
+ # @param [Object] suggestions Value to be assigned
149
+ def suggestions=(suggestions)
150
+ if suggestions.nil?
151
+ fail ArgumentError, 'suggestions cannot be nil'
152
+ end
153
+
154
+ if suggestions.length > 4
155
+ fail ArgumentError, 'invalid value for "suggestions", number of items must be less than or equal to 4.'
156
+ end
157
+
158
+ @suggestions = suggestions
159
+ end
160
+
161
+ # Checks equality by comparing each attribute.
162
+ # @param [Object] Object to be compared
163
+ def ==(o)
164
+ return true if self.equal?(o)
165
+ self.class == o.class &&
166
+ title == o.title &&
167
+ description == o.description &&
168
+ media == o.media &&
169
+ suggestions == o.suggestions
170
+ end
171
+
172
+ # @see the `==` method
173
+ # @param [Object] Object to be compared
174
+ def eql?(o)
175
+ self == o
176
+ end
177
+
178
+ # Calculates hash code according to all attributes.
179
+ # @return [Integer] Hash code
180
+ def hash
181
+ [title, description, media, suggestions].hash
182
+ end
183
+
184
+ # Builds the object from hash
185
+ # @param [Hash] attributes Model attributes in the form of hash
186
+ # @return [Object] Returns the model itself
187
+ def self.build_from_hash(attributes)
188
+ return nil unless attributes.is_a?(Hash)
189
+ attributes = attributes.transform_keys(&:to_sym)
190
+ transformed_hash = {}
191
+ openapi_types.each_pair do |key, type|
192
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
193
+ transformed_hash["#{key}"] = nil
194
+ elsif type =~ /\AArray<(.*)>/i
195
+ # check to ensure the input is an array given that the attribute
196
+ # is documented as an array but the input is not
197
+ if attributes[attribute_map[key]].is_a?(Array)
198
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
199
+ end
200
+ elsif !attributes[attribute_map[key]].nil?
201
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
202
+ end
203
+ end
204
+ new(transformed_hash)
205
+ end
206
+
207
+ # Deserializes the data based on type
208
+ # @param string type Data type
209
+ # @param string value Value to be deserialized
210
+ # @return [Object] Deserialized data
211
+ def self._deserialize(type, value)
212
+ case type.to_sym
213
+ when :Time
214
+ Time.parse(value)
215
+ when :Date
216
+ Date.parse(value)
217
+ when :String
218
+ value.to_s
219
+ when :Integer
220
+ value.to_i
221
+ when :Float
222
+ value.to_f
223
+ when :Boolean
224
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
225
+ true
226
+ else
227
+ false
228
+ end
229
+ when :Object
230
+ # generic object (usually a Hash), return directly
231
+ value
232
+ when /\AArray<(?<inner_type>.+)>\z/
233
+ inner_type = Regexp.last_match[:inner_type]
234
+ value.map { |v| _deserialize(inner_type, v) }
235
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
236
+ k_type = Regexp.last_match[:k_type]
237
+ v_type = Regexp.last_match[:v_type]
238
+ {}.tap do |hash|
239
+ value.each do |k, v|
240
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
241
+ end
242
+ end
243
+ else # model
244
+ # models (e.g. Pet) or oneOf
245
+ klass = MessenteApi.const_get(type)
246
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
247
+ end
248
+ end
249
+
250
+ # Returns the string representation of the object
251
+ # @return [String] String presentation of the object
252
+ def to_s
253
+ to_hash.to_s
254
+ end
255
+
256
+ # to_body is an alias to to_hash (backward compatibility)
257
+ # @return [Hash] Returns the object in the form of hash
258
+ def to_body
259
+ to_hash
260
+ end
261
+
262
+ # Returns the object in the form of hash
263
+ # @return [Hash] Returns the object in the form of hash
264
+ def to_hash
265
+ hash = {}
266
+ self.class.attribute_map.each_pair do |attr, param|
267
+ value = self.send(attr)
268
+ if value.nil?
269
+ is_nullable = self.class.openapi_nullable.include?(attr)
270
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
271
+ end
272
+
273
+ hash[param] = _to_hash(value)
274
+ end
275
+ hash
276
+ end
277
+
278
+ # Outputs non-array value in the form of hash
279
+ # For object, use to_hash. Otherwise, just return the value
280
+ # @param [Object] value Any valid value
281
+ # @return [Hash] Returns the value in the form of hash
282
+ def _to_hash(value)
283
+ if value.is_a?(Array)
284
+ value.compact.map { |v| _to_hash(v) }
285
+ elsif value.is_a?(Hash)
286
+ {}.tap do |hash|
287
+ value.each { |k, v| hash[k] = _to_hash(v) }
288
+ end
289
+ elsif value.respond_to? :to_hash
290
+ value.to_hash
291
+ else
292
+ value
293
+ end
294
+ end
295
+
296
+ end
297
+
298
+ end
@@ -0,0 +1,40 @@
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
+ class RcsCardOrientation
18
+ VERTICAL = "VERTICAL".freeze
19
+ HORIZONTAL = "HORIZONTAL".freeze
20
+
21
+ def self.all_vars
22
+ @all_vars ||= [VERTICAL, HORIZONTAL].freeze
23
+ end
24
+
25
+ # Builds the enum from string
26
+ # @param [String] The enum value in the form of the string
27
+ # @return [String] The enum value
28
+ def self.build_from_hash(value)
29
+ new.build_from_hash(value)
30
+ end
31
+
32
+ # Builds the enum from string
33
+ # @param [String] The enum value in the form of the string
34
+ # @return [String] The enum value
35
+ def build_from_hash(value)
36
+ return value if RcsCardOrientation.all_vars.include?(value)
37
+ raise "Invalid ENUM value #{value} for class #RcsCardOrientation"
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,40 @@
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
+ class RcsCardWidth
18
+ SMALL = "SMALL".freeze
19
+ MEDIUM = "MEDIUM".freeze
20
+
21
+ def self.all_vars
22
+ @all_vars ||= [SMALL, MEDIUM].freeze
23
+ end
24
+
25
+ # Builds the enum from string
26
+ # @param [String] The enum value in the form of the string
27
+ # @return [String] The enum value
28
+ def self.build_from_hash(value)
29
+ new.build_from_hash(value)
30
+ end
31
+
32
+ # Builds the enum from string
33
+ # @param [String] The enum value in the form of the string
34
+ # @return [String] The enum value
35
+ def build_from_hash(value)
36
+ return value if RcsCardWidth.all_vars.include?(value)
37
+ raise "Invalid ENUM value #{value} for class #RcsCardWidth"
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,291 @@
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 Carousel Card.
18
+ class RcsCarouselCard
19
+ attr_accessor :card_width
20
+
21
+ # The contents of the carousel card.
22
+ attr_accessor :card_contents
23
+
24
+ class EnumAttributeValidator
25
+ attr_reader :datatype
26
+ attr_reader :allowable_values
27
+
28
+ def initialize(datatype, allowable_values)
29
+ @allowable_values = allowable_values.map do |value|
30
+ case datatype.to_s
31
+ when /Integer/i
32
+ value.to_i
33
+ when /Float/i
34
+ value.to_f
35
+ else
36
+ value
37
+ end
38
+ end
39
+ end
40
+
41
+ def valid?(value)
42
+ !value || allowable_values.include?(value)
43
+ end
44
+ end
45
+
46
+ # Attribute mapping from ruby-style variable name to JSON key.
47
+ def self.attribute_map
48
+ {
49
+ :'card_width' => :'card_width',
50
+ :'card_contents' => :'card_contents'
51
+ }
52
+ end
53
+
54
+ # Returns all the JSON keys this model knows about
55
+ def self.acceptable_attributes
56
+ attribute_map.values
57
+ end
58
+
59
+ # Attribute type mapping.
60
+ def self.openapi_types
61
+ {
62
+ :'card_width' => :'RcsCardWidth',
63
+ :'card_contents' => :'Array<RcsCardContent>'
64
+ }
65
+ end
66
+
67
+ # List of attributes with nullable: true
68
+ def self.openapi_nullable
69
+ Set.new([
70
+ ])
71
+ end
72
+
73
+ # Initializes the object
74
+ # @param [Hash] attributes Model attributes in the form of hash
75
+ def initialize(attributes = {})
76
+ if (!attributes.is_a?(Hash))
77
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MessenteApi::RcsCarouselCard` initialize method"
78
+ end
79
+
80
+ # check to see if the attribute exists and convert string to symbol for hash key
81
+ attributes = attributes.each_with_object({}) { |(k, v), h|
82
+ if (!self.class.attribute_map.key?(k.to_sym))
83
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MessenteApi::RcsCarouselCard`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
84
+ end
85
+ h[k.to_sym] = v
86
+ }
87
+
88
+ if attributes.key?(:'card_width')
89
+ self.card_width = attributes[:'card_width']
90
+ else
91
+ self.card_width = nil
92
+ end
93
+
94
+ if attributes.key?(:'card_contents')
95
+ if (value = attributes[:'card_contents']).is_a?(Array)
96
+ self.card_contents = value
97
+ end
98
+ else
99
+ self.card_contents = nil
100
+ end
101
+ end
102
+
103
+ # Show invalid properties with the reasons. Usually used together with valid?
104
+ # @return Array for valid properties with the reasons
105
+ def list_invalid_properties
106
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
107
+ invalid_properties = Array.new
108
+ if @card_width.nil?
109
+ invalid_properties.push('invalid value for "card_width", card_width cannot be nil.')
110
+ end
111
+
112
+ if @card_contents.nil?
113
+ invalid_properties.push('invalid value for "card_contents", card_contents cannot be nil.')
114
+ end
115
+
116
+ if @card_contents.length > 10
117
+ invalid_properties.push('invalid value for "card_contents", number of items must be less than or equal to 10.')
118
+ end
119
+
120
+ if @card_contents.length < 2
121
+ invalid_properties.push('invalid value for "card_contents", number of items must be greater than or equal to 2.')
122
+ end
123
+
124
+ invalid_properties
125
+ end
126
+
127
+ # Check to see if the all the properties in the model are valid
128
+ # @return true if the model is valid
129
+ def valid?
130
+ warn '[DEPRECATED] the `valid?` method is obsolete'
131
+ return false if @card_width.nil?
132
+ return false if @card_contents.nil?
133
+ return false if @card_contents.length > 10
134
+ return false if @card_contents.length < 2
135
+ true
136
+ end
137
+
138
+ # Custom attribute writer method with validation
139
+ # @param [Object] card_contents Value to be assigned
140
+ def card_contents=(card_contents)
141
+ if card_contents.nil?
142
+ fail ArgumentError, 'card_contents cannot be nil'
143
+ end
144
+
145
+ if card_contents.length > 10
146
+ fail ArgumentError, 'invalid value for "card_contents", number of items must be less than or equal to 10.'
147
+ end
148
+
149
+ if card_contents.length < 2
150
+ fail ArgumentError, 'invalid value for "card_contents", number of items must be greater than or equal to 2.'
151
+ end
152
+
153
+ @card_contents = card_contents
154
+ end
155
+
156
+ # Checks equality by comparing each attribute.
157
+ # @param [Object] Object to be compared
158
+ def ==(o)
159
+ return true if self.equal?(o)
160
+ self.class == o.class &&
161
+ card_width == o.card_width &&
162
+ card_contents == o.card_contents
163
+ end
164
+
165
+ # @see the `==` method
166
+ # @param [Object] Object to be compared
167
+ def eql?(o)
168
+ self == o
169
+ end
170
+
171
+ # Calculates hash code according to all attributes.
172
+ # @return [Integer] Hash code
173
+ def hash
174
+ [card_width, card_contents].hash
175
+ end
176
+
177
+ # Builds the object from hash
178
+ # @param [Hash] attributes Model attributes in the form of hash
179
+ # @return [Object] Returns the model itself
180
+ def self.build_from_hash(attributes)
181
+ return nil unless attributes.is_a?(Hash)
182
+ attributes = attributes.transform_keys(&:to_sym)
183
+ transformed_hash = {}
184
+ openapi_types.each_pair do |key, type|
185
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
186
+ transformed_hash["#{key}"] = nil
187
+ elsif type =~ /\AArray<(.*)>/i
188
+ # check to ensure the input is an array given that the attribute
189
+ # is documented as an array but the input is not
190
+ if attributes[attribute_map[key]].is_a?(Array)
191
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
192
+ end
193
+ elsif !attributes[attribute_map[key]].nil?
194
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
195
+ end
196
+ end
197
+ new(transformed_hash)
198
+ end
199
+
200
+ # Deserializes the data based on type
201
+ # @param string type Data type
202
+ # @param string value Value to be deserialized
203
+ # @return [Object] Deserialized data
204
+ def self._deserialize(type, value)
205
+ case type.to_sym
206
+ when :Time
207
+ Time.parse(value)
208
+ when :Date
209
+ Date.parse(value)
210
+ when :String
211
+ value.to_s
212
+ when :Integer
213
+ value.to_i
214
+ when :Float
215
+ value.to_f
216
+ when :Boolean
217
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
218
+ true
219
+ else
220
+ false
221
+ end
222
+ when :Object
223
+ # generic object (usually a Hash), return directly
224
+ value
225
+ when /\AArray<(?<inner_type>.+)>\z/
226
+ inner_type = Regexp.last_match[:inner_type]
227
+ value.map { |v| _deserialize(inner_type, v) }
228
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
229
+ k_type = Regexp.last_match[:k_type]
230
+ v_type = Regexp.last_match[:v_type]
231
+ {}.tap do |hash|
232
+ value.each do |k, v|
233
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
234
+ end
235
+ end
236
+ else # model
237
+ # models (e.g. Pet) or oneOf
238
+ klass = MessenteApi.const_get(type)
239
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
240
+ end
241
+ end
242
+
243
+ # Returns the string representation of the object
244
+ # @return [String] String presentation of the object
245
+ def to_s
246
+ to_hash.to_s
247
+ end
248
+
249
+ # to_body is an alias to to_hash (backward compatibility)
250
+ # @return [Hash] Returns the object in the form of hash
251
+ def to_body
252
+ to_hash
253
+ end
254
+
255
+ # Returns the object in the form of hash
256
+ # @return [Hash] Returns the object in the form of hash
257
+ def to_hash
258
+ hash = {}
259
+ self.class.attribute_map.each_pair do |attr, param|
260
+ value = self.send(attr)
261
+ if value.nil?
262
+ is_nullable = self.class.openapi_nullable.include?(attr)
263
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
264
+ end
265
+
266
+ hash[param] = _to_hash(value)
267
+ end
268
+ hash
269
+ end
270
+
271
+ # Outputs non-array value in the form of hash
272
+ # For object, use to_hash. Otherwise, just return the value
273
+ # @param [Object] value Any valid value
274
+ # @return [Hash] Returns the value in the form of hash
275
+ def _to_hash(value)
276
+ if value.is_a?(Array)
277
+ value.compact.map { |v| _to_hash(v) }
278
+ elsif value.is_a?(Hash)
279
+ {}.tap do |hash|
280
+ value.each { |k, v| hash[k] = _to_hash(v) }
281
+ end
282
+ elsif value.respond_to? :to_hash
283
+ value.to_hash
284
+ else
285
+ value
286
+ end
287
+ end
288
+
289
+ end
290
+
291
+ end