messente_api 2.4.1 → 2.6.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 (162) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +26 -19
  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 +48 -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/docs/Viber.md +6 -2
  30. data/docs/ViberCarousel.md +18 -0
  31. data/docs/ViberCarouselButton.md +20 -0
  32. data/docs/ViberCarouselItem.md +24 -0
  33. data/docs/ViberTemplate.md +22 -0
  34. data/lib/messente_api/api/account_balance_api.rb +1 -1
  35. data/lib/messente_api/api/blacklist_api.rb +1 -1
  36. data/lib/messente_api/api/bulk_messaging_api.rb +1 -1
  37. data/lib/messente_api/api/contacts_api.rb +1 -1
  38. data/lib/messente_api/api/delivery_report_api.rb +1 -1
  39. data/lib/messente_api/api/groups_api.rb +1 -1
  40. data/lib/messente_api/api/number_lookup_api.rb +1 -1
  41. data/lib/messente_api/api/number_verification_api.rb +1 -1
  42. data/lib/messente_api/api/omnimessage_api.rb +1 -1
  43. data/lib/messente_api/api/pricing_api.rb +1 -1
  44. data/lib/messente_api/api/statistics_api.rb +1 -1
  45. data/lib/messente_api/api/whats_app_templates_api.rb +1 -1
  46. data/lib/messente_api/api_client.rb +1 -1
  47. data/lib/messente_api/api_error.rb +1 -1
  48. data/lib/messente_api/configuration.rb +1 -1
  49. data/lib/messente_api/models/bulk_omni_message_create_success_response.rb +1 -1
  50. data/lib/messente_api/models/bulk_omni_message_create_success_response_messages_inner.rb +1 -1
  51. data/lib/messente_api/models/bulk_omnimessage.rb +1 -1
  52. data/lib/messente_api/models/channel.rb +3 -3
  53. data/lib/messente_api/models/contact_envelope.rb +1 -1
  54. data/lib/messente_api/models/contact_fields.rb +1 -1
  55. data/lib/messente_api/models/contact_list_envelope.rb +1 -1
  56. data/lib/messente_api/models/contact_response_fields.rb +1 -1
  57. data/lib/messente_api/models/contact_update_fields.rb +1 -1
  58. data/lib/messente_api/models/delivery_report_response.rb +1 -1
  59. data/lib/messente_api/models/delivery_result.rb +1 -1
  60. data/lib/messente_api/models/error_code_omnichannel.rb +1 -1
  61. data/lib/messente_api/models/error_code_omnichannel_machine.rb +1 -1
  62. data/lib/messente_api/models/error_code_phonebook.rb +1 -1
  63. data/lib/messente_api/models/error_code_statistics.rb +1 -1
  64. data/lib/messente_api/models/error_item_number_lookup.rb +1 -1
  65. data/lib/messente_api/models/error_item_number_lookup_error.rb +1 -1
  66. data/lib/messente_api/models/error_item_omnichannel.rb +1 -1
  67. data/lib/messente_api/models/error_item_phonebook.rb +1 -1
  68. data/lib/messente_api/models/error_item_statistics.rb +1 -1
  69. data/lib/messente_api/models/error_number_lookup.rb +1 -1
  70. data/lib/messente_api/models/error_omnichannel.rb +1 -1
  71. data/lib/messente_api/models/error_phonebook.rb +1 -1
  72. data/lib/messente_api/models/error_statistics.rb +1 -1
  73. data/lib/messente_api/models/error_title_omnichannel.rb +1 -1
  74. data/lib/messente_api/models/error_title_phonebook.rb +1 -1
  75. data/lib/messente_api/models/fetch_blacklist_success.rb +1 -1
  76. data/lib/messente_api/models/group_envelope.rb +1 -1
  77. data/lib/messente_api/models/group_list_envelope.rb +1 -1
  78. data/lib/messente_api/models/group_name.rb +1 -1
  79. data/lib/messente_api/models/group_response_fields.rb +1 -1
  80. data/lib/messente_api/models/message_result.rb +1 -1
  81. data/lib/messente_api/models/mobile_network.rb +1 -1
  82. data/lib/messente_api/models/number_to_blacklist.rb +1 -1
  83. data/lib/messente_api/models/numbers_to_investigate.rb +1 -1
  84. data/lib/messente_api/models/omni_message_create_success_response.rb +1 -1
  85. data/lib/messente_api/models/omnimessage.rb +1 -1
  86. data/lib/messente_api/models/omnimessage_messages_inner.rb +9 -10
  87. data/lib/messente_api/models/price.rb +1 -1
  88. data/lib/messente_api/models/price_info.rb +1 -1
  89. data/lib/messente_api/models/price_networks_inner.rb +1 -1
  90. data/lib/messente_api/models/priority.rb +1 -1
  91. data/lib/messente_api/models/{telegram.rb → rcs.rb} +98 -43
  92. data/lib/messente_api/models/rcs_card_content.rb +298 -0
  93. data/lib/messente_api/models/rcs_card_orientation.rb +40 -0
  94. data/lib/messente_api/models/rcs_card_width.rb +40 -0
  95. data/lib/messente_api/models/rcs_carousel_card.rb +291 -0
  96. data/lib/messente_api/models/rcs_content_info.rb +251 -0
  97. data/lib/messente_api/models/rcs_create_calendar_event_action.rb +312 -0
  98. data/lib/messente_api/models/rcs_dial_action.rb +223 -0
  99. data/lib/messente_api/models/rcs_image_alignment.rb +40 -0
  100. data/lib/messente_api/models/rcs_lat_lng.rb +240 -0
  101. data/lib/messente_api/models/rcs_media.rb +260 -0
  102. data/lib/messente_api/models/rcs_media_height.rb +41 -0
  103. data/lib/messente_api/models/rcs_open_url_action.rb +299 -0
  104. data/lib/messente_api/models/rcs_open_url_application.rb +40 -0
  105. data/lib/messente_api/models/rcs_rich_card.rb +224 -0
  106. data/lib/messente_api/models/rcs_standalone_card.rb +276 -0
  107. data/lib/messente_api/models/rcs_suggested_action.rb +350 -0
  108. data/lib/messente_api/models/rcs_suggested_reply.rb +278 -0
  109. data/lib/messente_api/models/rcs_suggestion.rb +224 -0
  110. data/lib/messente_api/models/rcs_view_location_action.rb +237 -0
  111. data/lib/messente_api/models/rcs_webview_view_mode.rb +41 -0
  112. data/lib/messente_api/models/sms.rb +3 -3
  113. data/lib/messente_api/models/statistics_report.rb +1 -1
  114. data/lib/messente_api/models/statistics_report_settings.rb +2 -2
  115. data/lib/messente_api/models/statistics_report_success.rb +1 -1
  116. data/lib/messente_api/models/status.rb +1 -1
  117. data/lib/messente_api/models/sync_number_lookup_result.rb +3 -3
  118. data/lib/messente_api/models/sync_number_lookup_success.rb +1 -1
  119. data/lib/messente_api/models/text_store.rb +1 -1
  120. data/lib/messente_api/models/viber.rb +25 -7
  121. data/lib/messente_api/models/viber_carousel.rb +253 -0
  122. data/lib/messente_api/models/viber_carousel_button.rb +259 -0
  123. data/lib/messente_api/models/viber_carousel_item.rb +293 -0
  124. data/lib/messente_api/models/viber_template.rb +252 -0
  125. data/lib/messente_api/models/viber_video.rb +1 -1
  126. data/lib/messente_api/models/whats_app.rb +1 -1
  127. data/lib/messente_api/models/whats_app_audio.rb +1 -1
  128. data/lib/messente_api/models/whats_app_component.rb +1 -1
  129. data/lib/messente_api/models/whats_app_currency.rb +1 -1
  130. data/lib/messente_api/models/whats_app_datetime.rb +1 -1
  131. data/lib/messente_api/models/whats_app_document.rb +1 -1
  132. data/lib/messente_api/models/whats_app_image.rb +1 -1
  133. data/lib/messente_api/models/whats_app_language.rb +1 -1
  134. data/lib/messente_api/models/whats_app_media.rb +1 -1
  135. data/lib/messente_api/models/whats_app_parameter.rb +1 -1
  136. data/lib/messente_api/models/whats_app_sticker.rb +1 -1
  137. data/lib/messente_api/models/whats_app_template.rb +1 -1
  138. data/lib/messente_api/models/whats_app_text.rb +1 -1
  139. data/lib/messente_api/models/whats_app_video.rb +1 -1
  140. data/lib/messente_api/models/whatsapp_button_type.rb +1 -1
  141. data/lib/messente_api/models/whatsapp_component_type.rb +1 -1
  142. data/lib/messente_api/models/whatsapp_create_template_request.rb +1 -1
  143. data/lib/messente_api/models/whatsapp_create_template_response.rb +1 -1
  144. data/lib/messente_api/models/whatsapp_header_format.rb +1 -1
  145. data/lib/messente_api/models/whatsapp_list_templates_response.rb +1 -1
  146. data/lib/messente_api/models/whatsapp_otp_button_type.rb +1 -1
  147. data/lib/messente_api/models/whatsapp_pagination.rb +1 -1
  148. data/lib/messente_api/models/whatsapp_paging_cursors.rb +1 -1
  149. data/lib/messente_api/models/whatsapp_supported_app.rb +1 -1
  150. data/lib/messente_api/models/whatsapp_template_button.rb +1 -1
  151. data/lib/messente_api/models/whatsapp_template_category.rb +1 -1
  152. data/lib/messente_api/models/whatsapp_template_component.rb +1 -1
  153. data/lib/messente_api/models/whatsapp_template_example.rb +1 -1
  154. data/lib/messente_api/models/whatsapp_template_response.rb +1 -1
  155. data/lib/messente_api/models/whatsapp_template_status.rb +1 -1
  156. data/lib/messente_api/models/whatsapp_update_template_request.rb +1 -1
  157. data/lib/messente_api/version.rb +2 -2
  158. data/lib/messente_api.rb +26 -2
  159. data/messente_api.gemspec +1 -1
  160. data/spec/spec_helper.rb +1 -1
  161. metadata +52 -4
  162. data/docs/Telegram.md +0 -30
@@ -3,7 +3,7 @@
3
3
 
4
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
5
 
6
- The version of the OpenAPI document: 2.0.0
6
+ The version of the OpenAPI document: 2.1.0
7
7
  Contact: messente@messente.com
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.11.0
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module MessenteApi
17
- # Viber message content
17
+ # Viber message content. You must provide one of these combinations: * image_url * text * text, button_text and button_url * text, image_url, button_text and button_url * video * video, text * video, text, button_text * video, text, button_text and button_url * carousel and text
18
18
  class Viber
19
19
  # Phone number or alphanumeric sender name
20
20
  attr_accessor :sender
@@ -28,7 +28,7 @@ module MessenteApi
28
28
  # Plaintext content for Viber
29
29
  attr_accessor :text
30
30
 
31
- # URL for the embedded image Valid combinations: 1) image_url, 2) text, image_url, button_url, button_text
31
+ # URL for the embedded image.
32
32
  attr_accessor :image_url
33
33
 
34
34
  # URL of the button, must be specified along with ''text'', ''button_text'' and ''image_url'' (optional)
@@ -42,6 +42,10 @@ module MessenteApi
42
42
 
43
43
  attr_accessor :video
44
44
 
45
+ attr_accessor :template
46
+
47
+ attr_accessor :carousel
48
+
45
49
  class EnumAttributeValidator
46
50
  attr_reader :datatype
47
51
  attr_reader :allowable_values
@@ -75,7 +79,9 @@ module MessenteApi
75
79
  :'button_url' => :'button_url',
76
80
  :'button_text' => :'button_text',
77
81
  :'channel' => :'channel',
78
- :'video' => :'video'
82
+ :'video' => :'video',
83
+ :'template' => :'template',
84
+ :'carousel' => :'carousel'
79
85
  }
80
86
  end
81
87
 
@@ -95,7 +101,9 @@ module MessenteApi
95
101
  :'button_url' => :'String',
96
102
  :'button_text' => :'String',
97
103
  :'channel' => :'String',
98
- :'video' => :'ViberVideo'
104
+ :'video' => :'ViberVideo',
105
+ :'template' => :'ViberTemplate',
106
+ :'carousel' => :'ViberCarousel'
99
107
  }
100
108
  end
101
109
 
@@ -157,6 +165,14 @@ module MessenteApi
157
165
  if attributes.key?(:'video')
158
166
  self.video = attributes[:'video']
159
167
  end
168
+
169
+ if attributes.key?(:'template')
170
+ self.template = attributes[:'template']
171
+ end
172
+
173
+ if attributes.key?(:'carousel')
174
+ self.carousel = attributes[:'carousel']
175
+ end
160
176
  end
161
177
 
162
178
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -199,7 +215,9 @@ module MessenteApi
199
215
  button_url == o.button_url &&
200
216
  button_text == o.button_text &&
201
217
  channel == o.channel &&
202
- video == o.video
218
+ video == o.video &&
219
+ template == o.template &&
220
+ carousel == o.carousel
203
221
  end
204
222
 
205
223
  # @see the `==` method
@@ -211,7 +229,7 @@ module MessenteApi
211
229
  # Calculates hash code according to all attributes.
212
230
  # @return [Integer] Hash code
213
231
  def hash
214
- [sender, validity, ttl, text, image_url, button_url, button_text, channel, video].hash
232
+ [sender, validity, ttl, text, image_url, button_url, button_text, channel, video, template, carousel].hash
215
233
  end
216
234
 
217
235
  # Builds the object from hash
@@ -0,0 +1,253 @@
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.1.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
+ # Viber carousel object.
18
+ class ViberCarousel
19
+ # Carousel items. Must contain between 2 and 5 items.
20
+ attr_accessor :items
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'items' => :'items'
26
+ }
27
+ end
28
+
29
+ # Returns all the JSON keys this model knows about
30
+ def self.acceptable_attributes
31
+ attribute_map.values
32
+ end
33
+
34
+ # Attribute type mapping.
35
+ def self.openapi_types
36
+ {
37
+ :'items' => :'Array<ViberCarouselItem>'
38
+ }
39
+ end
40
+
41
+ # List of attributes with nullable: true
42
+ def self.openapi_nullable
43
+ Set.new([
44
+ ])
45
+ end
46
+
47
+ # Initializes the object
48
+ # @param [Hash] attributes Model attributes in the form of hash
49
+ def initialize(attributes = {})
50
+ if (!attributes.is_a?(Hash))
51
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MessenteApi::ViberCarousel` initialize method"
52
+ end
53
+
54
+ # check to see if the attribute exists and convert string to symbol for hash key
55
+ attributes = attributes.each_with_object({}) { |(k, v), h|
56
+ if (!self.class.attribute_map.key?(k.to_sym))
57
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MessenteApi::ViberCarousel`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
58
+ end
59
+ h[k.to_sym] = v
60
+ }
61
+
62
+ if attributes.key?(:'items')
63
+ if (value = attributes[:'items']).is_a?(Array)
64
+ self.items = value
65
+ end
66
+ else
67
+ self.items = nil
68
+ end
69
+ end
70
+
71
+ # Show invalid properties with the reasons. Usually used together with valid?
72
+ # @return Array for valid properties with the reasons
73
+ def list_invalid_properties
74
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
75
+ invalid_properties = Array.new
76
+ if @items.nil?
77
+ invalid_properties.push('invalid value for "items", items cannot be nil.')
78
+ end
79
+
80
+ if @items.length > 5
81
+ invalid_properties.push('invalid value for "items", number of items must be less than or equal to 5.')
82
+ end
83
+
84
+ if @items.length < 2
85
+ invalid_properties.push('invalid value for "items", number of items must be greater than or equal to 2.')
86
+ end
87
+
88
+ invalid_properties
89
+ end
90
+
91
+ # Check to see if the all the properties in the model are valid
92
+ # @return true if the model is valid
93
+ def valid?
94
+ warn '[DEPRECATED] the `valid?` method is obsolete'
95
+ return false if @items.nil?
96
+ return false if @items.length > 5
97
+ return false if @items.length < 2
98
+ true
99
+ end
100
+
101
+ # Custom attribute writer method with validation
102
+ # @param [Object] items Value to be assigned
103
+ def items=(items)
104
+ if items.nil?
105
+ fail ArgumentError, 'items cannot be nil'
106
+ end
107
+
108
+ if items.length > 5
109
+ fail ArgumentError, 'invalid value for "items", number of items must be less than or equal to 5.'
110
+ end
111
+
112
+ if items.length < 2
113
+ fail ArgumentError, 'invalid value for "items", number of items must be greater than or equal to 2.'
114
+ end
115
+
116
+ @items = items
117
+ end
118
+
119
+ # Checks equality by comparing each attribute.
120
+ # @param [Object] Object to be compared
121
+ def ==(o)
122
+ return true if self.equal?(o)
123
+ self.class == o.class &&
124
+ items == o.items
125
+ end
126
+
127
+ # @see the `==` method
128
+ # @param [Object] Object to be compared
129
+ def eql?(o)
130
+ self == o
131
+ end
132
+
133
+ # Calculates hash code according to all attributes.
134
+ # @return [Integer] Hash code
135
+ def hash
136
+ [items].hash
137
+ end
138
+
139
+ # Builds the object from hash
140
+ # @param [Hash] attributes Model attributes in the form of hash
141
+ # @return [Object] Returns the model itself
142
+ def self.build_from_hash(attributes)
143
+ return nil unless attributes.is_a?(Hash)
144
+ attributes = attributes.transform_keys(&:to_sym)
145
+ transformed_hash = {}
146
+ openapi_types.each_pair do |key, type|
147
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
148
+ transformed_hash["#{key}"] = nil
149
+ elsif type =~ /\AArray<(.*)>/i
150
+ # check to ensure the input is an array given that the attribute
151
+ # is documented as an array but the input is not
152
+ if attributes[attribute_map[key]].is_a?(Array)
153
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
154
+ end
155
+ elsif !attributes[attribute_map[key]].nil?
156
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
157
+ end
158
+ end
159
+ new(transformed_hash)
160
+ end
161
+
162
+ # Deserializes the data based on type
163
+ # @param string type Data type
164
+ # @param string value Value to be deserialized
165
+ # @return [Object] Deserialized data
166
+ def self._deserialize(type, value)
167
+ case type.to_sym
168
+ when :Time
169
+ Time.parse(value)
170
+ when :Date
171
+ Date.parse(value)
172
+ when :String
173
+ value.to_s
174
+ when :Integer
175
+ value.to_i
176
+ when :Float
177
+ value.to_f
178
+ when :Boolean
179
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
180
+ true
181
+ else
182
+ false
183
+ end
184
+ when :Object
185
+ # generic object (usually a Hash), return directly
186
+ value
187
+ when /\AArray<(?<inner_type>.+)>\z/
188
+ inner_type = Regexp.last_match[:inner_type]
189
+ value.map { |v| _deserialize(inner_type, v) }
190
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
191
+ k_type = Regexp.last_match[:k_type]
192
+ v_type = Regexp.last_match[:v_type]
193
+ {}.tap do |hash|
194
+ value.each do |k, v|
195
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
196
+ end
197
+ end
198
+ else # model
199
+ # models (e.g. Pet) or oneOf
200
+ klass = MessenteApi.const_get(type)
201
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
202
+ end
203
+ end
204
+
205
+ # Returns the string representation of the object
206
+ # @return [String] String presentation of the object
207
+ def to_s
208
+ to_hash.to_s
209
+ end
210
+
211
+ # to_body is an alias to to_hash (backward compatibility)
212
+ # @return [Hash] Returns the object in the form of hash
213
+ def to_body
214
+ to_hash
215
+ end
216
+
217
+ # Returns the object in the form of hash
218
+ # @return [Hash] Returns the object in the form of hash
219
+ def to_hash
220
+ hash = {}
221
+ self.class.attribute_map.each_pair do |attr, param|
222
+ value = self.send(attr)
223
+ if value.nil?
224
+ is_nullable = self.class.openapi_nullable.include?(attr)
225
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
226
+ end
227
+
228
+ hash[param] = _to_hash(value)
229
+ end
230
+ hash
231
+ end
232
+
233
+ # Outputs non-array value in the form of hash
234
+ # For object, use to_hash. Otherwise, just return the value
235
+ # @param [Object] value Any valid value
236
+ # @return [Hash] Returns the value in the form of hash
237
+ def _to_hash(value)
238
+ if value.is_a?(Array)
239
+ value.compact.map { |v| _to_hash(v) }
240
+ elsif value.is_a?(Hash)
241
+ {}.tap do |hash|
242
+ value.each { |k, v| hash[k] = _to_hash(v) }
243
+ end
244
+ elsif value.respond_to? :to_hash
245
+ value.to_hash
246
+ else
247
+ value
248
+ end
249
+ end
250
+
251
+ end
252
+
253
+ end
@@ -0,0 +1,259 @@
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.1.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
+ # Viber carousel button object.
18
+ class ViberCarouselButton
19
+ # Button label text.
20
+ attr_accessor :label
21
+
22
+ # URL opened when the button is clicked.
23
+ attr_accessor :action_url
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'label' => :'label',
29
+ :'action_url' => :'action_url'
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
+ :'label' => :'String',
42
+ :'action_url' => :'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::ViberCarouselButton` 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::ViberCarouselButton`. 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?(:'label')
68
+ self.label = attributes[:'label']
69
+ else
70
+ self.label = nil
71
+ end
72
+
73
+ if attributes.key?(:'action_url')
74
+ self.action_url = attributes[:'action_url']
75
+ else
76
+ self.action_url = 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 @label.nil?
86
+ invalid_properties.push('invalid value for "label", label cannot be nil.')
87
+ end
88
+
89
+ if @label.to_s.length < 1
90
+ invalid_properties.push('invalid value for "label", the character length must be great than or equal to 1.')
91
+ end
92
+
93
+ if @action_url.nil?
94
+ invalid_properties.push('invalid value for "action_url", action_url cannot be nil.')
95
+ end
96
+
97
+ invalid_properties
98
+ end
99
+
100
+ # Check to see if the all the properties in the model are valid
101
+ # @return true if the model is valid
102
+ def valid?
103
+ warn '[DEPRECATED] the `valid?` method is obsolete'
104
+ return false if @label.nil?
105
+ return false if @label.to_s.length < 1
106
+ return false if @action_url.nil?
107
+ true
108
+ end
109
+
110
+ # Custom attribute writer method with validation
111
+ # @param [Object] label Value to be assigned
112
+ def label=(label)
113
+ if label.nil?
114
+ fail ArgumentError, 'label cannot be nil'
115
+ end
116
+
117
+ if label.to_s.length < 1
118
+ fail ArgumentError, 'invalid value for "label", the character length must be great than or equal to 1.'
119
+ end
120
+
121
+ @label = label
122
+ end
123
+
124
+ # Checks equality by comparing each attribute.
125
+ # @param [Object] Object to be compared
126
+ def ==(o)
127
+ return true if self.equal?(o)
128
+ self.class == o.class &&
129
+ label == o.label &&
130
+ action_url == o.action_url
131
+ end
132
+
133
+ # @see the `==` method
134
+ # @param [Object] Object to be compared
135
+ def eql?(o)
136
+ self == o
137
+ end
138
+
139
+ # Calculates hash code according to all attributes.
140
+ # @return [Integer] Hash code
141
+ def hash
142
+ [label, action_url].hash
143
+ end
144
+
145
+ # Builds the object from hash
146
+ # @param [Hash] attributes Model attributes in the form of hash
147
+ # @return [Object] Returns the model itself
148
+ def self.build_from_hash(attributes)
149
+ return nil unless attributes.is_a?(Hash)
150
+ attributes = attributes.transform_keys(&:to_sym)
151
+ transformed_hash = {}
152
+ openapi_types.each_pair do |key, type|
153
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
154
+ transformed_hash["#{key}"] = nil
155
+ elsif type =~ /\AArray<(.*)>/i
156
+ # check to ensure the input is an array given that the attribute
157
+ # is documented as an array but the input is not
158
+ if attributes[attribute_map[key]].is_a?(Array)
159
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
160
+ end
161
+ elsif !attributes[attribute_map[key]].nil?
162
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
163
+ end
164
+ end
165
+ new(transformed_hash)
166
+ end
167
+
168
+ # Deserializes the data based on type
169
+ # @param string type Data type
170
+ # @param string value Value to be deserialized
171
+ # @return [Object] Deserialized data
172
+ def self._deserialize(type, value)
173
+ case type.to_sym
174
+ when :Time
175
+ Time.parse(value)
176
+ when :Date
177
+ Date.parse(value)
178
+ when :String
179
+ value.to_s
180
+ when :Integer
181
+ value.to_i
182
+ when :Float
183
+ value.to_f
184
+ when :Boolean
185
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
186
+ true
187
+ else
188
+ false
189
+ end
190
+ when :Object
191
+ # generic object (usually a Hash), return directly
192
+ value
193
+ when /\AArray<(?<inner_type>.+)>\z/
194
+ inner_type = Regexp.last_match[:inner_type]
195
+ value.map { |v| _deserialize(inner_type, v) }
196
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
197
+ k_type = Regexp.last_match[:k_type]
198
+ v_type = Regexp.last_match[:v_type]
199
+ {}.tap do |hash|
200
+ value.each do |k, v|
201
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
202
+ end
203
+ end
204
+ else # model
205
+ # models (e.g. Pet) or oneOf
206
+ klass = MessenteApi.const_get(type)
207
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
208
+ end
209
+ end
210
+
211
+ # Returns the string representation of the object
212
+ # @return [String] String presentation of the object
213
+ def to_s
214
+ to_hash.to_s
215
+ end
216
+
217
+ # to_body is an alias to to_hash (backward compatibility)
218
+ # @return [Hash] Returns the object in the form of hash
219
+ def to_body
220
+ to_hash
221
+ end
222
+
223
+ # Returns the object in the form of hash
224
+ # @return [Hash] Returns the object in the form of hash
225
+ def to_hash
226
+ hash = {}
227
+ self.class.attribute_map.each_pair do |attr, param|
228
+ value = self.send(attr)
229
+ if value.nil?
230
+ is_nullable = self.class.openapi_nullable.include?(attr)
231
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
232
+ end
233
+
234
+ hash[param] = _to_hash(value)
235
+ end
236
+ hash
237
+ end
238
+
239
+ # Outputs non-array value in the form of hash
240
+ # For object, use to_hash. Otherwise, just return the value
241
+ # @param [Object] value Any valid value
242
+ # @return [Hash] Returns the value in the form of hash
243
+ def _to_hash(value)
244
+ if value.is_a?(Array)
245
+ value.compact.map { |v| _to_hash(v) }
246
+ elsif value.is_a?(Hash)
247
+ {}.tap do |hash|
248
+ value.each { |k, v| hash[k] = _to_hash(v) }
249
+ end
250
+ elsif value.respond_to? :to_hash
251
+ value.to_hash
252
+ else
253
+ value
254
+ end
255
+ end
256
+
257
+ end
258
+
259
+ end