messente_api 1.4.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +33 -30
  3. data/docs/BlacklistApi.md +105 -37
  4. data/docs/BulkMessagingApi.md +76 -0
  5. data/docs/BulkOmniMessageCreateSuccessResponse.md +18 -0
  6. data/docs/BulkOmniMessageCreateSuccessResponseMessagesInner.md +49 -0
  7. data/docs/BulkOmnimessage.md +18 -0
  8. data/docs/Channel.md +4 -5
  9. data/docs/ContactEnvelope.md +8 -7
  10. data/docs/ContactFields.md +26 -25
  11. data/docs/ContactListEnvelope.md +8 -7
  12. data/docs/ContactResponseFields.md +28 -27
  13. data/docs/ContactUpdateFields.md +24 -23
  14. data/docs/ContactsApi.md +221 -86
  15. data/docs/DeliveryReportApi.md +29 -13
  16. data/docs/DeliveryReportResponse.md +12 -11
  17. data/docs/DeliveryResult.md +22 -17
  18. data/docs/ErrorCodeOmnichannel.md +4 -5
  19. data/docs/ErrorCodeOmnichannelMachine.md +4 -5
  20. data/docs/ErrorCodePhonebook.md +4 -5
  21. data/docs/ErrorCodeStatistics.md +4 -5
  22. data/docs/ErrorItemNumberLookup.md +8 -7
  23. data/docs/ErrorItemNumberLookupError.md +10 -9
  24. data/docs/ErrorItemOmnichannel.md +14 -13
  25. data/docs/ErrorItemPhonebook.md +12 -11
  26. data/docs/ErrorItemStatistics.md +12 -11
  27. data/docs/ErrorNumberLookup.md +8 -7
  28. data/docs/ErrorOmnichannel.md +8 -7
  29. data/docs/ErrorPhonebook.md +8 -7
  30. data/docs/ErrorStatistics.md +8 -7
  31. data/docs/ErrorTitleOmnichannel.md +4 -5
  32. data/docs/ErrorTitlePhonebook.md +4 -5
  33. data/docs/FetchBlacklistSuccess.md +8 -7
  34. data/docs/GroupEnvelope.md +8 -7
  35. data/docs/GroupListEnvelope.md +8 -7
  36. data/docs/GroupName.md +8 -7
  37. data/docs/GroupResponseFields.md +14 -13
  38. data/docs/GroupsApi.md +136 -51
  39. data/docs/MessageResult.md +12 -11
  40. data/docs/MobileNetwork.md +16 -15
  41. data/docs/NumberLookupApi.md +30 -14
  42. data/docs/NumberToBlacklist.md +8 -7
  43. data/docs/NumbersToInvestigate.md +8 -7
  44. data/docs/OmniMessageCreateSuccessResponse.md +12 -11
  45. data/docs/Omnimessage.md +18 -17
  46. data/docs/OmnimessageApi.md +56 -23
  47. data/docs/OmnimessageMessagesInner.md +53 -0
  48. data/docs/PriceInfo.md +22 -0
  49. data/docs/Priority.md +4 -5
  50. data/docs/SMS.md +20 -17
  51. data/docs/StatisticsApi.md +30 -14
  52. data/docs/StatisticsReport.md +12 -11
  53. data/docs/StatisticsReportSettings.md +12 -11
  54. data/docs/StatisticsReportSuccess.md +8 -7
  55. data/docs/Status.md +4 -5
  56. data/docs/SyncNumberLookupResult.md +24 -23
  57. data/docs/SyncNumberLookupSuccess.md +10 -9
  58. data/docs/Telegram.md +20 -19
  59. data/docs/TextStore.md +4 -5
  60. data/docs/Viber.md +24 -19
  61. data/docs/ViberVideo.md +24 -0
  62. data/docs/WhatsApp.md +16 -19
  63. data/docs/WhatsAppComponent.md +24 -0
  64. data/docs/WhatsAppCurrency.md +22 -0
  65. data/docs/WhatsAppDatetime.md +18 -0
  66. data/docs/WhatsAppLanguage.md +20 -0
  67. data/docs/WhatsAppMedia.md +24 -0
  68. data/docs/WhatsAppParameter.md +30 -0
  69. data/docs/WhatsAppTemplate.md +22 -0
  70. data/git_push.sh +3 -4
  71. data/lib/messente_api/api/blacklist_api.rb +22 -15
  72. data/lib/messente_api/api/bulk_messaging_api.rb +88 -0
  73. data/lib/messente_api/api/contacts_api.rb +42 -28
  74. data/lib/messente_api/api/delivery_report_api.rb +6 -5
  75. data/lib/messente_api/api/groups_api.rb +30 -19
  76. data/lib/messente_api/api/number_lookup_api.rb +10 -6
  77. data/lib/messente_api/api/omnimessage_api.rb +14 -9
  78. data/lib/messente_api/api/statistics_api.rb +10 -6
  79. data/lib/messente_api/api_client.rb +72 -66
  80. data/lib/messente_api/api_error.rb +3 -2
  81. data/lib/messente_api/configuration.rb +64 -14
  82. data/lib/messente_api/models/{whats_app_audio.rb → bulk_omni_message_create_success_response.rb} +50 -38
  83. data/lib/messente_api/models/bulk_omni_message_create_success_response_messages_inner.rb +105 -0
  84. data/lib/messente_api/models/{whats_app_text.rb → bulk_omnimessage.rb} +49 -49
  85. data/lib/messente_api/models/channel.rb +9 -5
  86. data/lib/messente_api/models/contact_envelope.rb +31 -23
  87. data/lib/messente_api/models/contact_fields.rb +33 -23
  88. data/lib/messente_api/models/contact_list_envelope.rb +41 -23
  89. data/lib/messente_api/models/contact_response_fields.rb +31 -23
  90. data/lib/messente_api/models/contact_update_fields.rb +31 -23
  91. data/lib/messente_api/models/delivery_report_response.rb +37 -23
  92. data/lib/messente_api/models/delivery_result.rb +77 -27
  93. data/lib/messente_api/models/error_code_omnichannel.rb +9 -5
  94. data/lib/messente_api/models/error_code_omnichannel_machine.rb +9 -5
  95. data/lib/messente_api/models/error_code_phonebook.rb +9 -5
  96. data/lib/messente_api/models/error_code_statistics.rb +9 -5
  97. data/lib/messente_api/models/error_item_number_lookup.rb +33 -23
  98. data/lib/messente_api/models/error_item_number_lookup_error.rb +35 -23
  99. data/lib/messente_api/models/error_item_omnichannel.rb +61 -23
  100. data/lib/messente_api/models/error_item_phonebook.rb +59 -23
  101. data/lib/messente_api/models/error_item_statistics.rb +59 -23
  102. data/lib/messente_api/models/error_number_lookup.rb +33 -23
  103. data/lib/messente_api/models/error_omnichannel.rb +33 -23
  104. data/lib/messente_api/models/error_phonebook.rb +33 -23
  105. data/lib/messente_api/models/error_statistics.rb +33 -23
  106. data/lib/messente_api/models/error_title_omnichannel.rb +9 -5
  107. data/lib/messente_api/models/error_title_phonebook.rb +9 -5
  108. data/lib/messente_api/models/fetch_blacklist_success.rb +41 -23
  109. data/lib/messente_api/models/group_envelope.rb +31 -23
  110. data/lib/messente_api/models/group_list_envelope.rb +41 -23
  111. data/lib/messente_api/models/group_name.rb +33 -23
  112. data/lib/messente_api/models/group_response_fields.rb +37 -23
  113. data/lib/messente_api/models/message_result.rb +59 -23
  114. data/lib/messente_api/models/mobile_network.rb +31 -23
  115. data/lib/messente_api/models/number_to_blacklist.rb +33 -23
  116. data/lib/messente_api/models/numbers_to_investigate.rb +62 -24
  117. data/lib/messente_api/models/omni_message_create_success_response.rb +37 -23
  118. data/lib/messente_api/models/omnimessage.rb +59 -25
  119. data/lib/messente_api/models/omnimessage_messages_inner.rb +107 -0
  120. data/lib/messente_api/models/price_info.rb +257 -0
  121. data/lib/messente_api/models/priority.rb +9 -5
  122. data/lib/messente_api/models/sms.rb +45 -25
  123. data/lib/messente_api/models/statistics_report.rb +37 -23
  124. data/lib/messente_api/models/statistics_report_settings.rb +35 -23
  125. data/lib/messente_api/models/statistics_report_success.rb +33 -23
  126. data/lib/messente_api/models/status.rb +9 -5
  127. data/lib/messente_api/models/sync_number_lookup_result.rb +35 -24
  128. data/lib/messente_api/models/sync_number_lookup_success.rb +35 -23
  129. data/lib/messente_api/models/telegram.rb +31 -23
  130. data/lib/messente_api/models/text_store.rb +9 -5
  131. data/lib/messente_api/models/viber.rb +55 -28
  132. data/lib/messente_api/models/viber_video.rb +274 -0
  133. data/lib/messente_api/models/whats_app.rb +45 -54
  134. data/lib/messente_api/models/whats_app_component.rb +255 -0
  135. data/lib/messente_api/models/whats_app_currency.rb +257 -0
  136. data/lib/messente_api/models/{whats_app_document.rb → whats_app_datetime.rb} +48 -48
  137. data/lib/messente_api/models/{whats_app_image.rb → whats_app_language.rb} +55 -45
  138. data/lib/messente_api/models/whats_app_media.rb +246 -0
  139. data/lib/messente_api/models/whats_app_parameter.rb +278 -0
  140. data/lib/messente_api/models/whats_app_template.rb +251 -0
  141. data/lib/messente_api/version.rb +3 -3
  142. data/lib/messente_api.rb +16 -6
  143. data/messente_api.gemspec +5 -5
  144. data/spec/spec_helper.rb +2 -2
  145. metadata +35 -39
  146. data/docs/WhatsAppAudio.md +0 -17
  147. data/docs/WhatsAppDocument.md +0 -19
  148. data/docs/WhatsAppImage.md +0 -19
  149. data/docs/WhatsAppText.md +0 -19
  150. data/spec/api_client_spec.rb +0 -226
  151. data/spec/configuration_spec.rb +0 -42
@@ -3,37 +3,38 @@
3
3
 
4
4
  #[Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world.
5
5
 
6
- The version of the OpenAPI document: 1.4.0
6
+ The version of the OpenAPI document: 2.0.0
7
7
  Contact: messente@messente.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ Generator version: 7.6.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module MessenteApi
16
- # A document
17
- class WhatsAppDocument
18
- # Description for the document
19
- attr_accessor :caption
20
-
21
- # Base64-encoded image
22
- attr_accessor :content
17
+ # Whatsapp datetime object.
18
+ class WhatsAppDatetime
19
+ # Default text.
20
+ attr_accessor :fallback_value
23
21
 
24
22
  # Attribute mapping from ruby-style variable name to JSON key.
25
23
  def self.attribute_map
26
24
  {
27
- :'caption' => :'caption',
28
- :'content' => :'content'
25
+ :'fallback_value' => :'fallback_value'
29
26
  }
30
27
  end
31
28
 
29
+ # Returns all the JSON keys this model knows about
30
+ def self.acceptable_attributes
31
+ attribute_map.values
32
+ end
33
+
32
34
  # Attribute type mapping.
33
35
  def self.openapi_types
34
36
  {
35
- :'caption' => :'String',
36
- :'content' => :'String'
37
+ :'fallback_value' => :'String'
37
38
  }
38
39
  end
39
40
 
@@ -47,32 +48,31 @@ module MessenteApi
47
48
  # @param [Hash] attributes Model attributes in the form of hash
48
49
  def initialize(attributes = {})
49
50
  if (!attributes.is_a?(Hash))
50
- fail ArgumentError, "The input argument (attributes) must be a hash in `MessenteApi::WhatsAppDocument` initialize method"
51
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MessenteApi::WhatsAppDatetime` initialize method"
51
52
  end
52
53
 
53
54
  # check to see if the attribute exists and convert string to symbol for hash key
54
55
  attributes = attributes.each_with_object({}) { |(k, v), h|
55
56
  if (!self.class.attribute_map.key?(k.to_sym))
56
- fail ArgumentError, "`#{k}` is not a valid attribute in `MessenteApi::WhatsAppDocument`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MessenteApi::WhatsAppDatetime`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
58
  end
58
59
  h[k.to_sym] = v
59
60
  }
60
61
 
61
- if attributes.key?(:'caption')
62
- self.caption = attributes[:'caption']
63
- end
64
-
65
- if attributes.key?(:'content')
66
- self.content = attributes[:'content']
62
+ if attributes.key?(:'fallback_value')
63
+ self.fallback_value = attributes[:'fallback_value']
64
+ else
65
+ self.fallback_value = nil
67
66
  end
68
67
  end
69
68
 
70
69
  # Show invalid properties with the reasons. Usually used together with valid?
71
70
  # @return Array for valid properties with the reasons
72
71
  def list_invalid_properties
72
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
73
73
  invalid_properties = Array.new
74
- if @content.nil?
75
- invalid_properties.push('invalid value for "content", content cannot be nil.')
74
+ if @fallback_value.nil?
75
+ invalid_properties.push('invalid value for "fallback_value", fallback_value cannot be nil.')
76
76
  end
77
77
 
78
78
  invalid_properties
@@ -81,7 +81,8 @@ module MessenteApi
81
81
  # Check to see if the all the properties in the model are valid
82
82
  # @return true if the model is valid
83
83
  def valid?
84
- return false if @content.nil?
84
+ warn '[DEPRECATED] the `valid?` method is obsolete'
85
+ return false if @fallback_value.nil?
85
86
  true
86
87
  end
87
88
 
@@ -90,8 +91,7 @@ module MessenteApi
90
91
  def ==(o)
91
92
  return true if self.equal?(o)
92
93
  self.class == o.class &&
93
- caption == o.caption &&
94
- content == o.content
94
+ fallback_value == o.fallback_value
95
95
  end
96
96
 
97
97
  # @see the `==` method
@@ -103,44 +103,40 @@ module MessenteApi
103
103
  # Calculates hash code according to all attributes.
104
104
  # @return [Integer] Hash code
105
105
  def hash
106
- [caption, content].hash
106
+ [fallback_value].hash
107
107
  end
108
108
 
109
109
  # Builds the object from hash
110
110
  # @param [Hash] attributes Model attributes in the form of hash
111
111
  # @return [Object] Returns the model itself
112
112
  def self.build_from_hash(attributes)
113
- new.build_from_hash(attributes)
114
- end
115
-
116
- # Builds the object from hash
117
- # @param [Hash] attributes Model attributes in the form of hash
118
- # @return [Object] Returns the model itself
119
- def build_from_hash(attributes)
120
113
  return nil unless attributes.is_a?(Hash)
121
- self.class.openapi_types.each_pair do |key, type|
122
- if type =~ /\AArray<(.*)>/i
114
+ attributes = attributes.transform_keys(&:to_sym)
115
+ transformed_hash = {}
116
+ openapi_types.each_pair do |key, type|
117
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
118
+ transformed_hash["#{key}"] = nil
119
+ elsif type =~ /\AArray<(.*)>/i
123
120
  # check to ensure the input is an array given that the attribute
124
121
  # is documented as an array but the input is not
125
- if attributes[self.class.attribute_map[key]].is_a?(Array)
126
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
122
+ if attributes[attribute_map[key]].is_a?(Array)
123
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
127
124
  end
128
- elsif !attributes[self.class.attribute_map[key]].nil?
129
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
130
- end # or else data not found in attributes(hash), not an issue as the data can be optional
125
+ elsif !attributes[attribute_map[key]].nil?
126
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
127
+ end
131
128
  end
132
-
133
- self
129
+ new(transformed_hash)
134
130
  end
135
131
 
136
132
  # Deserializes the data based on type
137
133
  # @param string type Data type
138
134
  # @param string value Value to be deserialized
139
135
  # @return [Object] Deserialized data
140
- def _deserialize(type, value)
136
+ def self._deserialize(type, value)
141
137
  case type.to_sym
142
- when :DateTime
143
- DateTime.parse(value)
138
+ when :Time
139
+ Time.parse(value)
144
140
  when :Date
145
141
  Date.parse(value)
146
142
  when :String
@@ -170,7 +166,9 @@ module MessenteApi
170
166
  end
171
167
  end
172
168
  else # model
173
- MessenteApi.const_get(type).build_from_hash(value)
169
+ # models (e.g. Pet) or oneOf
170
+ klass = MessenteApi.const_get(type)
171
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
174
172
  end
175
173
  end
176
174
 
@@ -196,7 +194,7 @@ module MessenteApi
196
194
  is_nullable = self.class.openapi_nullable.include?(attr)
197
195
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
198
196
  end
199
-
197
+
200
198
  hash[param] = _to_hash(value)
201
199
  end
202
200
  hash
@@ -219,5 +217,7 @@ module MessenteApi
219
217
  value
220
218
  end
221
219
  end
220
+
222
221
  end
222
+
223
223
  end
@@ -3,37 +3,43 @@
3
3
 
4
4
  #[Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world.
5
5
 
6
- The version of the OpenAPI document: 1.4.0
6
+ The version of the OpenAPI document: 2.0.0
7
7
  Contact: messente@messente.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ Generator version: 7.6.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module MessenteApi
16
- # An image
17
- class WhatsAppImage
18
- # Description for the image
19
- attr_accessor :caption
17
+ # Whatsapp template language
18
+ class WhatsAppLanguage
19
+ # Language code
20
+ attr_accessor :code
20
21
 
21
- # Base64-encoded image
22
- attr_accessor :content
22
+ # Language policy
23
+ attr_accessor :policy
23
24
 
24
25
  # Attribute mapping from ruby-style variable name to JSON key.
25
26
  def self.attribute_map
26
27
  {
27
- :'caption' => :'caption',
28
- :'content' => :'content'
28
+ :'code' => :'code',
29
+ :'policy' => :'policy'
29
30
  }
30
31
  end
31
32
 
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ attribute_map.values
36
+ end
37
+
32
38
  # Attribute type mapping.
33
39
  def self.openapi_types
34
40
  {
35
- :'caption' => :'String',
36
- :'content' => :'String'
41
+ :'code' => :'String',
42
+ :'policy' => :'String'
37
43
  }
38
44
  end
39
45
 
@@ -47,32 +53,35 @@ module MessenteApi
47
53
  # @param [Hash] attributes Model attributes in the form of hash
48
54
  def initialize(attributes = {})
49
55
  if (!attributes.is_a?(Hash))
50
- fail ArgumentError, "The input argument (attributes) must be a hash in `MessenteApi::WhatsAppImage` initialize method"
56
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MessenteApi::WhatsAppLanguage` initialize method"
51
57
  end
52
58
 
53
59
  # check to see if the attribute exists and convert string to symbol for hash key
54
60
  attributes = attributes.each_with_object({}) { |(k, v), h|
55
61
  if (!self.class.attribute_map.key?(k.to_sym))
56
- fail ArgumentError, "`#{k}` is not a valid attribute in `MessenteApi::WhatsAppImage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MessenteApi::WhatsAppLanguage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
63
  end
58
64
  h[k.to_sym] = v
59
65
  }
60
66
 
61
- if attributes.key?(:'caption')
62
- self.caption = attributes[:'caption']
67
+ if attributes.key?(:'code')
68
+ self.code = attributes[:'code']
69
+ else
70
+ self.code = nil
63
71
  end
64
72
 
65
- if attributes.key?(:'content')
66
- self.content = attributes[:'content']
73
+ if attributes.key?(:'policy')
74
+ self.policy = attributes[:'policy']
67
75
  end
68
76
  end
69
77
 
70
78
  # Show invalid properties with the reasons. Usually used together with valid?
71
79
  # @return Array for valid properties with the reasons
72
80
  def list_invalid_properties
81
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
73
82
  invalid_properties = Array.new
74
- if @content.nil?
75
- invalid_properties.push('invalid value for "content", content cannot be nil.')
83
+ if @code.nil?
84
+ invalid_properties.push('invalid value for "code", code cannot be nil.')
76
85
  end
77
86
 
78
87
  invalid_properties
@@ -81,7 +90,8 @@ module MessenteApi
81
90
  # Check to see if the all the properties in the model are valid
82
91
  # @return true if the model is valid
83
92
  def valid?
84
- return false if @content.nil?
93
+ warn '[DEPRECATED] the `valid?` method is obsolete'
94
+ return false if @code.nil?
85
95
  true
86
96
  end
87
97
 
@@ -90,8 +100,8 @@ module MessenteApi
90
100
  def ==(o)
91
101
  return true if self.equal?(o)
92
102
  self.class == o.class &&
93
- caption == o.caption &&
94
- content == o.content
103
+ code == o.code &&
104
+ policy == o.policy
95
105
  end
96
106
 
97
107
  # @see the `==` method
@@ -103,44 +113,40 @@ module MessenteApi
103
113
  # Calculates hash code according to all attributes.
104
114
  # @return [Integer] Hash code
105
115
  def hash
106
- [caption, content].hash
116
+ [code, policy].hash
107
117
  end
108
118
 
109
119
  # Builds the object from hash
110
120
  # @param [Hash] attributes Model attributes in the form of hash
111
121
  # @return [Object] Returns the model itself
112
122
  def self.build_from_hash(attributes)
113
- new.build_from_hash(attributes)
114
- end
115
-
116
- # Builds the object from hash
117
- # @param [Hash] attributes Model attributes in the form of hash
118
- # @return [Object] Returns the model itself
119
- def build_from_hash(attributes)
120
123
  return nil unless attributes.is_a?(Hash)
121
- self.class.openapi_types.each_pair do |key, type|
122
- if type =~ /\AArray<(.*)>/i
124
+ attributes = attributes.transform_keys(&:to_sym)
125
+ transformed_hash = {}
126
+ openapi_types.each_pair do |key, type|
127
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
128
+ transformed_hash["#{key}"] = nil
129
+ elsif type =~ /\AArray<(.*)>/i
123
130
  # check to ensure the input is an array given that the attribute
124
131
  # is documented as an array but the input is not
125
- if attributes[self.class.attribute_map[key]].is_a?(Array)
126
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
132
+ if attributes[attribute_map[key]].is_a?(Array)
133
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
127
134
  end
128
- elsif !attributes[self.class.attribute_map[key]].nil?
129
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
130
- end # or else data not found in attributes(hash), not an issue as the data can be optional
135
+ elsif !attributes[attribute_map[key]].nil?
136
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
137
+ end
131
138
  end
132
-
133
- self
139
+ new(transformed_hash)
134
140
  end
135
141
 
136
142
  # Deserializes the data based on type
137
143
  # @param string type Data type
138
144
  # @param string value Value to be deserialized
139
145
  # @return [Object] Deserialized data
140
- def _deserialize(type, value)
146
+ def self._deserialize(type, value)
141
147
  case type.to_sym
142
- when :DateTime
143
- DateTime.parse(value)
148
+ when :Time
149
+ Time.parse(value)
144
150
  when :Date
145
151
  Date.parse(value)
146
152
  when :String
@@ -170,7 +176,9 @@ module MessenteApi
170
176
  end
171
177
  end
172
178
  else # model
173
- MessenteApi.const_get(type).build_from_hash(value)
179
+ # models (e.g. Pet) or oneOf
180
+ klass = MessenteApi.const_get(type)
181
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
174
182
  end
175
183
  end
176
184
 
@@ -196,7 +204,7 @@ module MessenteApi
196
204
  is_nullable = self.class.openapi_nullable.include?(attr)
197
205
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
198
206
  end
199
-
207
+
200
208
  hash[param] = _to_hash(value)
201
209
  end
202
210
  hash
@@ -219,5 +227,7 @@ module MessenteApi
219
227
  value
220
228
  end
221
229
  end
230
+
222
231
  end
232
+
223
233
  end
@@ -0,0 +1,246 @@
1
+ =begin
2
+ #Messente API
3
+
4
+ #[Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world.
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+ Contact: messente@messente.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.6.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module MessenteApi
17
+ # Whatsapp media object.
18
+ class WhatsAppMedia
19
+ # The media object ID. Do not use this field when message type is set to text.
20
+ attr_accessor :id
21
+
22
+ # The protocol and URL of the media to be sent. Use only with HTTP/HTTPS URLs. Do not use this field when message type is set to text.
23
+ attr_accessor :link
24
+
25
+ # Media asset caption. Do not use with audio or sticker media.
26
+ attr_accessor :caption
27
+
28
+ # Describes the filename for the specific document. Use only with document media.
29
+ attr_accessor :filename
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'id' => :'id',
35
+ :'link' => :'link',
36
+ :'caption' => :'caption',
37
+ :'filename' => :'filename'
38
+ }
39
+ end
40
+
41
+ # Returns all the JSON keys this model knows about
42
+ def self.acceptable_attributes
43
+ attribute_map.values
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.openapi_types
48
+ {
49
+ :'id' => :'String',
50
+ :'link' => :'String',
51
+ :'caption' => :'String',
52
+ :'filename' => :'String'
53
+ }
54
+ end
55
+
56
+ # List of attributes with nullable: true
57
+ def self.openapi_nullable
58
+ Set.new([
59
+ ])
60
+ end
61
+
62
+ # Initializes the object
63
+ # @param [Hash] attributes Model attributes in the form of hash
64
+ def initialize(attributes = {})
65
+ if (!attributes.is_a?(Hash))
66
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MessenteApi::WhatsAppMedia` initialize method"
67
+ end
68
+
69
+ # check to see if the attribute exists and convert string to symbol for hash key
70
+ attributes = attributes.each_with_object({}) { |(k, v), h|
71
+ if (!self.class.attribute_map.key?(k.to_sym))
72
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MessenteApi::WhatsAppMedia`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
73
+ end
74
+ h[k.to_sym] = v
75
+ }
76
+
77
+ if attributes.key?(:'id')
78
+ self.id = attributes[:'id']
79
+ end
80
+
81
+ if attributes.key?(:'link')
82
+ self.link = attributes[:'link']
83
+ end
84
+
85
+ if attributes.key?(:'caption')
86
+ self.caption = attributes[:'caption']
87
+ end
88
+
89
+ if attributes.key?(:'filename')
90
+ self.filename = attributes[:'filename']
91
+ end
92
+ end
93
+
94
+ # Show invalid properties with the reasons. Usually used together with valid?
95
+ # @return Array for valid properties with the reasons
96
+ def list_invalid_properties
97
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
98
+ invalid_properties = Array.new
99
+ invalid_properties
100
+ end
101
+
102
+ # Check to see if the all the properties in the model are valid
103
+ # @return true if the model is valid
104
+ def valid?
105
+ warn '[DEPRECATED] the `valid?` method is obsolete'
106
+ true
107
+ end
108
+
109
+ # Checks equality by comparing each attribute.
110
+ # @param [Object] Object to be compared
111
+ def ==(o)
112
+ return true if self.equal?(o)
113
+ self.class == o.class &&
114
+ id == o.id &&
115
+ link == o.link &&
116
+ caption == o.caption &&
117
+ filename == o.filename
118
+ end
119
+
120
+ # @see the `==` method
121
+ # @param [Object] Object to be compared
122
+ def eql?(o)
123
+ self == o
124
+ end
125
+
126
+ # Calculates hash code according to all attributes.
127
+ # @return [Integer] Hash code
128
+ def hash
129
+ [id, link, caption, filename].hash
130
+ end
131
+
132
+ # Builds the object from hash
133
+ # @param [Hash] attributes Model attributes in the form of hash
134
+ # @return [Object] Returns the model itself
135
+ def self.build_from_hash(attributes)
136
+ return nil unless attributes.is_a?(Hash)
137
+ attributes = attributes.transform_keys(&:to_sym)
138
+ transformed_hash = {}
139
+ openapi_types.each_pair do |key, type|
140
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
141
+ transformed_hash["#{key}"] = nil
142
+ elsif type =~ /\AArray<(.*)>/i
143
+ # check to ensure the input is an array given that the attribute
144
+ # is documented as an array but the input is not
145
+ if attributes[attribute_map[key]].is_a?(Array)
146
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
147
+ end
148
+ elsif !attributes[attribute_map[key]].nil?
149
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
150
+ end
151
+ end
152
+ new(transformed_hash)
153
+ end
154
+
155
+ # Deserializes the data based on type
156
+ # @param string type Data type
157
+ # @param string value Value to be deserialized
158
+ # @return [Object] Deserialized data
159
+ def self._deserialize(type, value)
160
+ case type.to_sym
161
+ when :Time
162
+ Time.parse(value)
163
+ when :Date
164
+ Date.parse(value)
165
+ when :String
166
+ value.to_s
167
+ when :Integer
168
+ value.to_i
169
+ when :Float
170
+ value.to_f
171
+ when :Boolean
172
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
173
+ true
174
+ else
175
+ false
176
+ end
177
+ when :Object
178
+ # generic object (usually a Hash), return directly
179
+ value
180
+ when /\AArray<(?<inner_type>.+)>\z/
181
+ inner_type = Regexp.last_match[:inner_type]
182
+ value.map { |v| _deserialize(inner_type, v) }
183
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
184
+ k_type = Regexp.last_match[:k_type]
185
+ v_type = Regexp.last_match[:v_type]
186
+ {}.tap do |hash|
187
+ value.each do |k, v|
188
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
189
+ end
190
+ end
191
+ else # model
192
+ # models (e.g. Pet) or oneOf
193
+ klass = MessenteApi.const_get(type)
194
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
195
+ end
196
+ end
197
+
198
+ # Returns the string representation of the object
199
+ # @return [String] String presentation of the object
200
+ def to_s
201
+ to_hash.to_s
202
+ end
203
+
204
+ # to_body is an alias to to_hash (backward compatibility)
205
+ # @return [Hash] Returns the object in the form of hash
206
+ def to_body
207
+ to_hash
208
+ end
209
+
210
+ # Returns the object in the form of hash
211
+ # @return [Hash] Returns the object in the form of hash
212
+ def to_hash
213
+ hash = {}
214
+ self.class.attribute_map.each_pair do |attr, param|
215
+ value = self.send(attr)
216
+ if value.nil?
217
+ is_nullable = self.class.openapi_nullable.include?(attr)
218
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
219
+ end
220
+
221
+ hash[param] = _to_hash(value)
222
+ end
223
+ hash
224
+ end
225
+
226
+ # Outputs non-array value in the form of hash
227
+ # For object, use to_hash. Otherwise, just return the value
228
+ # @param [Object] value Any valid value
229
+ # @return [Hash] Returns the value in the form of hash
230
+ def _to_hash(value)
231
+ if value.is_a?(Array)
232
+ value.compact.map { |v| _to_hash(v) }
233
+ elsif value.is_a?(Hash)
234
+ {}.tap do |hash|
235
+ value.each { |k, v| hash[k] = _to_hash(v) }
236
+ end
237
+ elsif value.respond_to? :to_hash
238
+ value.to_hash
239
+ else
240
+ value
241
+ end
242
+ end
243
+
244
+ end
245
+
246
+ end