messente_api 1.4.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) 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 +22 -19
  61. data/docs/WhatsApp.md +16 -19
  62. data/docs/WhatsAppComponent.md +24 -0
  63. data/docs/WhatsAppCurrency.md +22 -0
  64. data/docs/WhatsAppDatetime.md +18 -0
  65. data/docs/WhatsAppLanguage.md +20 -0
  66. data/docs/WhatsAppMedia.md +24 -0
  67. data/docs/WhatsAppParameter.md +30 -0
  68. data/docs/WhatsAppTemplate.md +22 -0
  69. data/git_push.sh +3 -4
  70. data/lib/messente_api/api/blacklist_api.rb +22 -15
  71. data/lib/messente_api/api/bulk_messaging_api.rb +88 -0
  72. data/lib/messente_api/api/contacts_api.rb +42 -28
  73. data/lib/messente_api/api/delivery_report_api.rb +6 -5
  74. data/lib/messente_api/api/groups_api.rb +30 -19
  75. data/lib/messente_api/api/number_lookup_api.rb +10 -6
  76. data/lib/messente_api/api/omnimessage_api.rb +14 -9
  77. data/lib/messente_api/api/statistics_api.rb +10 -6
  78. data/lib/messente_api/api_client.rb +72 -66
  79. data/lib/messente_api/api_error.rb +3 -2
  80. data/lib/messente_api/configuration.rb +64 -14
  81. data/lib/messente_api/models/{whats_app_audio.rb → bulk_omni_message_create_success_response.rb} +50 -38
  82. data/lib/messente_api/models/bulk_omni_message_create_success_response_messages_inner.rb +105 -0
  83. data/lib/messente_api/models/{whats_app_text.rb → bulk_omnimessage.rb} +49 -49
  84. data/lib/messente_api/models/channel.rb +9 -5
  85. data/lib/messente_api/models/contact_envelope.rb +31 -23
  86. data/lib/messente_api/models/contact_fields.rb +33 -23
  87. data/lib/messente_api/models/contact_list_envelope.rb +41 -23
  88. data/lib/messente_api/models/contact_response_fields.rb +31 -23
  89. data/lib/messente_api/models/contact_update_fields.rb +31 -23
  90. data/lib/messente_api/models/delivery_report_response.rb +37 -23
  91. data/lib/messente_api/models/delivery_result.rb +77 -27
  92. data/lib/messente_api/models/error_code_omnichannel.rb +9 -5
  93. data/lib/messente_api/models/error_code_omnichannel_machine.rb +9 -5
  94. data/lib/messente_api/models/error_code_phonebook.rb +9 -5
  95. data/lib/messente_api/models/error_code_statistics.rb +9 -5
  96. data/lib/messente_api/models/error_item_number_lookup.rb +33 -23
  97. data/lib/messente_api/models/error_item_number_lookup_error.rb +35 -23
  98. data/lib/messente_api/models/error_item_omnichannel.rb +61 -23
  99. data/lib/messente_api/models/error_item_phonebook.rb +59 -23
  100. data/lib/messente_api/models/error_item_statistics.rb +59 -23
  101. data/lib/messente_api/models/error_number_lookup.rb +33 -23
  102. data/lib/messente_api/models/error_omnichannel.rb +33 -23
  103. data/lib/messente_api/models/error_phonebook.rb +33 -23
  104. data/lib/messente_api/models/error_statistics.rb +33 -23
  105. data/lib/messente_api/models/error_title_omnichannel.rb +9 -5
  106. data/lib/messente_api/models/error_title_phonebook.rb +9 -5
  107. data/lib/messente_api/models/fetch_blacklist_success.rb +41 -23
  108. data/lib/messente_api/models/group_envelope.rb +31 -23
  109. data/lib/messente_api/models/group_list_envelope.rb +41 -23
  110. data/lib/messente_api/models/group_name.rb +33 -23
  111. data/lib/messente_api/models/group_response_fields.rb +37 -23
  112. data/lib/messente_api/models/message_result.rb +59 -23
  113. data/lib/messente_api/models/mobile_network.rb +31 -23
  114. data/lib/messente_api/models/number_to_blacklist.rb +33 -23
  115. data/lib/messente_api/models/numbers_to_investigate.rb +62 -24
  116. data/lib/messente_api/models/omni_message_create_success_response.rb +37 -23
  117. data/lib/messente_api/models/omnimessage.rb +59 -25
  118. data/lib/messente_api/models/omnimessage_messages_inner.rb +107 -0
  119. data/lib/messente_api/models/price_info.rb +257 -0
  120. data/lib/messente_api/models/priority.rb +9 -5
  121. data/lib/messente_api/models/sms.rb +45 -25
  122. data/lib/messente_api/models/statistics_report.rb +37 -23
  123. data/lib/messente_api/models/statistics_report_settings.rb +35 -23
  124. data/lib/messente_api/models/statistics_report_success.rb +33 -23
  125. data/lib/messente_api/models/status.rb +9 -5
  126. data/lib/messente_api/models/sync_number_lookup_result.rb +35 -24
  127. data/lib/messente_api/models/sync_number_lookup_success.rb +35 -23
  128. data/lib/messente_api/models/telegram.rb +31 -23
  129. data/lib/messente_api/models/text_store.rb +9 -5
  130. data/lib/messente_api/models/viber.rb +43 -25
  131. data/lib/messente_api/models/whats_app.rb +45 -54
  132. data/lib/messente_api/models/whats_app_component.rb +255 -0
  133. data/lib/messente_api/models/whats_app_currency.rb +257 -0
  134. data/lib/messente_api/models/{whats_app_document.rb → whats_app_datetime.rb} +48 -48
  135. data/lib/messente_api/models/{whats_app_image.rb → whats_app_language.rb} +55 -45
  136. data/lib/messente_api/models/whats_app_media.rb +246 -0
  137. data/lib/messente_api/models/whats_app_parameter.rb +278 -0
  138. data/lib/messente_api/models/whats_app_template.rb +251 -0
  139. data/lib/messente_api/version.rb +3 -3
  140. data/lib/messente_api.rb +15 -6
  141. data/messente_api.gemspec +5 -5
  142. data/spec/spec_helper.rb +2 -2
  143. metadata +33 -39
  144. data/docs/WhatsAppAudio.md +0 -17
  145. data/docs/WhatsAppDocument.md +0 -19
  146. data/docs/WhatsAppImage.md +0 -19
  147. data/docs/WhatsAppText.md +0 -19
  148. data/spec/api_client_spec.rb +0 -226
  149. data/spec/configuration_spec.rb +0 -42
@@ -0,0 +1,105 @@
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
+ module BulkOmniMessageCreateSuccessResponseMessagesInner
18
+ class << self
19
+ # List of class defined in oneOf (OpenAPI v3)
20
+ def openapi_one_of
21
+ [
22
+ :'ErrorOmnichannel',
23
+ :'OmniMessageCreateSuccessResponse'
24
+ ]
25
+ end
26
+
27
+ # Builds the object
28
+ # @param [Mixed] Data to be matched against the list of oneOf items
29
+ # @return [Object] Returns the model or the data itself
30
+ def build(data)
31
+ # Go through the list of oneOf items and attempt to identify the appropriate one.
32
+ # Note:
33
+ # - We do not attempt to check whether exactly one item matches.
34
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
35
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
36
+ # - TODO: scalar values are de facto behaving as if they were nullable.
37
+ # - TODO: logging when debugging is set.
38
+ openapi_one_of.each do |klass|
39
+ begin
40
+ next if klass == :AnyType # "nullable: true"
41
+ typed_data = find_and_cast_into_type(klass, data)
42
+ return typed_data if typed_data
43
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
44
+ end
45
+ end
46
+
47
+ openapi_one_of.include?(:AnyType) ? data : nil
48
+ end
49
+
50
+ private
51
+
52
+ SchemaMismatchError = Class.new(StandardError)
53
+
54
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
55
+ def find_and_cast_into_type(klass, data)
56
+ return if data.nil?
57
+
58
+ case klass.to_s
59
+ when 'Boolean'
60
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
61
+ when 'Float'
62
+ return data if data.instance_of?(Float)
63
+ when 'Integer'
64
+ return data if data.instance_of?(Integer)
65
+ when 'Time'
66
+ return Time.parse(data)
67
+ when 'Date'
68
+ return Date.parse(data)
69
+ when 'String'
70
+ return data if data.instance_of?(String)
71
+ when 'Object' # "type: object"
72
+ return data if data.instance_of?(Hash)
73
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
74
+ if data.instance_of?(Array)
75
+ sub_type = Regexp.last_match[:sub_type]
76
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
77
+ end
78
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
79
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
80
+ sub_type = Regexp.last_match[:sub_type]
81
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
82
+ end
83
+ else # model
84
+ const = MessenteApi.const_get(klass)
85
+ if const
86
+ if const.respond_to?(:openapi_one_of) # nested oneOf model
87
+ model = const.build(data)
88
+ return model if model
89
+ else
90
+ # raise if data contains keys that are not known to the model
91
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
92
+ model = const.build_from_hash(data)
93
+ return model if model
94
+ end
95
+ end
96
+ end
97
+
98
+ raise # if no match by now, raise
99
+ rescue
100
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
101
+ end
102
+ end
103
+ end
104
+
105
+ end
@@ -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 text
17
- class WhatsAppText
18
- # Whether to display link preview if the message contains a hyperlink
19
- attr_accessor :preview_url
20
-
21
- # Plaintext content for WhatsApp, can contain URLs, emojis and formatting
22
- attr_accessor :body
17
+ # A bulk omnimessage.
18
+ class BulkOmnimessage
19
+ # A list of omnimessages.
20
+ attr_accessor :messages
23
21
 
24
22
  # Attribute mapping from ruby-style variable name to JSON key.
25
23
  def self.attribute_map
26
24
  {
27
- :'preview_url' => :'preview_url',
28
- :'body' => :'body'
25
+ :'messages' => :'messages'
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
- :'preview_url' => :'Boolean',
36
- :'body' => :'String'
37
+ :'messages' => :'Array<Omnimessage>'
37
38
  }
38
39
  end
39
40
 
@@ -47,34 +48,33 @@ 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::WhatsAppText` initialize method"
51
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MessenteApi::BulkOmnimessage` 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::WhatsAppText`. 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::BulkOmnimessage`. 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?(:'preview_url')
62
- self.preview_url = attributes[:'preview_url']
62
+ if attributes.key?(:'messages')
63
+ if (value = attributes[:'messages']).is_a?(Array)
64
+ self.messages = value
65
+ end
63
66
  else
64
- self.preview_url = true
65
- end
66
-
67
- if attributes.key?(:'body')
68
- self.body = attributes[:'body']
67
+ self.messages = nil
69
68
  end
70
69
  end
71
70
 
72
71
  # Show invalid properties with the reasons. Usually used together with valid?
73
72
  # @return Array for valid properties with the reasons
74
73
  def list_invalid_properties
74
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
75
75
  invalid_properties = Array.new
76
- if @body.nil?
77
- invalid_properties.push('invalid value for "body", body cannot be nil.')
76
+ if @messages.nil?
77
+ invalid_properties.push('invalid value for "messages", messages cannot be nil.')
78
78
  end
79
79
 
80
80
  invalid_properties
@@ -83,7 +83,8 @@ module MessenteApi
83
83
  # Check to see if the all the properties in the model are valid
84
84
  # @return true if the model is valid
85
85
  def valid?
86
- return false if @body.nil?
86
+ warn '[DEPRECATED] the `valid?` method is obsolete'
87
+ return false if @messages.nil?
87
88
  true
88
89
  end
89
90
 
@@ -92,8 +93,7 @@ module MessenteApi
92
93
  def ==(o)
93
94
  return true if self.equal?(o)
94
95
  self.class == o.class &&
95
- preview_url == o.preview_url &&
96
- body == o.body
96
+ messages == o.messages
97
97
  end
98
98
 
99
99
  # @see the `==` method
@@ -105,44 +105,40 @@ module MessenteApi
105
105
  # Calculates hash code according to all attributes.
106
106
  # @return [Integer] Hash code
107
107
  def hash
108
- [preview_url, body].hash
108
+ [messages].hash
109
109
  end
110
110
 
111
111
  # Builds the object from hash
112
112
  # @param [Hash] attributes Model attributes in the form of hash
113
113
  # @return [Object] Returns the model itself
114
114
  def self.build_from_hash(attributes)
115
- new.build_from_hash(attributes)
116
- end
117
-
118
- # Builds the object from hash
119
- # @param [Hash] attributes Model attributes in the form of hash
120
- # @return [Object] Returns the model itself
121
- def build_from_hash(attributes)
122
115
  return nil unless attributes.is_a?(Hash)
123
- self.class.openapi_types.each_pair do |key, type|
124
- if type =~ /\AArray<(.*)>/i
116
+ attributes = attributes.transform_keys(&:to_sym)
117
+ transformed_hash = {}
118
+ openapi_types.each_pair do |key, type|
119
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
120
+ transformed_hash["#{key}"] = nil
121
+ elsif type =~ /\AArray<(.*)>/i
125
122
  # check to ensure the input is an array given that the attribute
126
123
  # is documented as an array but the input is not
127
- if attributes[self.class.attribute_map[key]].is_a?(Array)
128
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
124
+ if attributes[attribute_map[key]].is_a?(Array)
125
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
129
126
  end
130
- elsif !attributes[self.class.attribute_map[key]].nil?
131
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
132
- end # or else data not found in attributes(hash), not an issue as the data can be optional
127
+ elsif !attributes[attribute_map[key]].nil?
128
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
129
+ end
133
130
  end
134
-
135
- self
131
+ new(transformed_hash)
136
132
  end
137
133
 
138
134
  # Deserializes the data based on type
139
135
  # @param string type Data type
140
136
  # @param string value Value to be deserialized
141
137
  # @return [Object] Deserialized data
142
- def _deserialize(type, value)
138
+ def self._deserialize(type, value)
143
139
  case type.to_sym
144
- when :DateTime
145
- DateTime.parse(value)
140
+ when :Time
141
+ Time.parse(value)
146
142
  when :Date
147
143
  Date.parse(value)
148
144
  when :String
@@ -172,7 +168,9 @@ module MessenteApi
172
168
  end
173
169
  end
174
170
  else # model
175
- MessenteApi.const_get(type).build_from_hash(value)
171
+ # models (e.g. Pet) or oneOf
172
+ klass = MessenteApi.const_get(type)
173
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
176
174
  end
177
175
  end
178
176
 
@@ -198,7 +196,7 @@ module MessenteApi
198
196
  is_nullable = self.class.openapi_nullable.include?(attr)
199
197
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
200
198
  end
201
-
199
+
202
200
  hash[param] = _to_hash(value)
203
201
  end
204
202
  hash
@@ -221,5 +219,7 @@ module MessenteApi
221
219
  value
222
220
  end
223
221
  end
222
+
224
223
  end
224
+
225
225
  end
@@ -3,14 +3,15 @@
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
17
  class Channel
@@ -19,6 +20,10 @@ module MessenteApi
19
20
  WHATSAPP = "whatsapp".freeze
20
21
  TELEGRAM = "telegram".freeze
21
22
 
23
+ def self.all_vars
24
+ @all_vars ||= [SMS, VIBER, WHATSAPP, TELEGRAM].freeze
25
+ end
26
+
22
27
  # Builds the enum from string
23
28
  # @param [String] The enum value in the form of the string
24
29
  # @return [String] The enum value
@@ -30,9 +35,8 @@ module MessenteApi
30
35
  # @param [String] The enum value in the form of the string
31
36
  # @return [String] The enum value
32
37
  def build_from_hash(value)
33
- constantValues = Channel.constants.select { |c| Channel::const_get(c) == value }
34
- raise "Invalid ENUM value #{value} for class #Channel" if constantValues.empty?
35
- value
38
+ return value if Channel.all_vars.include?(value)
39
+ raise "Invalid ENUM value #{value} for class #Channel"
36
40
  end
37
41
  end
38
42
  end
@@ -3,14 +3,15 @@
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
17
  # A container for a contact
@@ -24,6 +25,11 @@ module MessenteApi
24
25
  }
25
26
  end
26
27
 
28
+ # Returns all the JSON keys this model knows about
29
+ def self.acceptable_attributes
30
+ attribute_map.values
31
+ end
32
+
27
33
  # Attribute type mapping.
28
34
  def self.openapi_types
29
35
  {
@@ -60,6 +66,7 @@ module MessenteApi
60
66
  # Show invalid properties with the reasons. Usually used together with valid?
61
67
  # @return Array for valid properties with the reasons
62
68
  def list_invalid_properties
69
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
63
70
  invalid_properties = Array.new
64
71
  invalid_properties
65
72
  end
@@ -67,6 +74,7 @@ module MessenteApi
67
74
  # Check to see if the all the properties in the model are valid
68
75
  # @return true if the model is valid
69
76
  def valid?
77
+ warn '[DEPRECATED] the `valid?` method is obsolete'
70
78
  true
71
79
  end
72
80
 
@@ -94,37 +102,33 @@ module MessenteApi
94
102
  # @param [Hash] attributes Model attributes in the form of hash
95
103
  # @return [Object] Returns the model itself
96
104
  def self.build_from_hash(attributes)
97
- new.build_from_hash(attributes)
98
- end
99
-
100
- # Builds the object from hash
101
- # @param [Hash] attributes Model attributes in the form of hash
102
- # @return [Object] Returns the model itself
103
- def build_from_hash(attributes)
104
105
  return nil unless attributes.is_a?(Hash)
105
- self.class.openapi_types.each_pair do |key, type|
106
- if type =~ /\AArray<(.*)>/i
106
+ attributes = attributes.transform_keys(&:to_sym)
107
+ transformed_hash = {}
108
+ openapi_types.each_pair do |key, type|
109
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
110
+ transformed_hash["#{key}"] = nil
111
+ elsif type =~ /\AArray<(.*)>/i
107
112
  # check to ensure the input is an array given that the attribute
108
113
  # is documented as an array but the input is not
109
- if attributes[self.class.attribute_map[key]].is_a?(Array)
110
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
114
+ if attributes[attribute_map[key]].is_a?(Array)
115
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
111
116
  end
112
- elsif !attributes[self.class.attribute_map[key]].nil?
113
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
114
- end # or else data not found in attributes(hash), not an issue as the data can be optional
117
+ elsif !attributes[attribute_map[key]].nil?
118
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
119
+ end
115
120
  end
116
-
117
- self
121
+ new(transformed_hash)
118
122
  end
119
123
 
120
124
  # Deserializes the data based on type
121
125
  # @param string type Data type
122
126
  # @param string value Value to be deserialized
123
127
  # @return [Object] Deserialized data
124
- def _deserialize(type, value)
128
+ def self._deserialize(type, value)
125
129
  case type.to_sym
126
- when :DateTime
127
- DateTime.parse(value)
130
+ when :Time
131
+ Time.parse(value)
128
132
  when :Date
129
133
  Date.parse(value)
130
134
  when :String
@@ -154,7 +158,9 @@ module MessenteApi
154
158
  end
155
159
  end
156
160
  else # model
157
- MessenteApi.const_get(type).build_from_hash(value)
161
+ # models (e.g. Pet) or oneOf
162
+ klass = MessenteApi.const_get(type)
163
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
158
164
  end
159
165
  end
160
166
 
@@ -180,7 +186,7 @@ module MessenteApi
180
186
  is_nullable = self.class.openapi_nullable.include?(attr)
181
187
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
182
188
  end
183
-
189
+
184
190
  hash[param] = _to_hash(value)
185
191
  end
186
192
  hash
@@ -203,5 +209,7 @@ module MessenteApi
203
209
  value
204
210
  end
205
211
  end
212
+
206
213
  end
214
+
207
215
  end
@@ -3,14 +3,15 @@
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
17
  # A container for fields of a request body of a contact
@@ -61,6 +62,11 @@ module MessenteApi
61
62
  }
62
63
  end
63
64
 
65
+ # Returns all the JSON keys this model knows about
66
+ def self.acceptable_attributes
67
+ attribute_map.values
68
+ end
69
+
64
70
  # Attribute type mapping.
65
71
  def self.openapi_types
66
72
  {
@@ -109,6 +115,8 @@ module MessenteApi
109
115
 
110
116
  if attributes.key?(:'phone_number')
111
117
  self.phone_number = attributes[:'phone_number']
118
+ else
119
+ self.phone_number = nil
112
120
  end
113
121
 
114
122
  if attributes.key?(:'email')
@@ -151,6 +159,7 @@ module MessenteApi
151
159
  # Show invalid properties with the reasons. Usually used together with valid?
152
160
  # @return Array for valid properties with the reasons
153
161
  def list_invalid_properties
162
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
154
163
  invalid_properties = Array.new
155
164
  if @phone_number.nil?
156
165
  invalid_properties.push('invalid value for "phone_number", phone_number cannot be nil.')
@@ -162,6 +171,7 @@ module MessenteApi
162
171
  # Check to see if the all the properties in the model are valid
163
172
  # @return true if the model is valid
164
173
  def valid?
174
+ warn '[DEPRECATED] the `valid?` method is obsolete'
165
175
  return false if @phone_number.nil?
166
176
  true
167
177
  end
@@ -199,37 +209,33 @@ module MessenteApi
199
209
  # @param [Hash] attributes Model attributes in the form of hash
200
210
  # @return [Object] Returns the model itself
201
211
  def self.build_from_hash(attributes)
202
- new.build_from_hash(attributes)
203
- end
204
-
205
- # Builds the object from hash
206
- # @param [Hash] attributes Model attributes in the form of hash
207
- # @return [Object] Returns the model itself
208
- def build_from_hash(attributes)
209
212
  return nil unless attributes.is_a?(Hash)
210
- self.class.openapi_types.each_pair do |key, type|
211
- if type =~ /\AArray<(.*)>/i
213
+ attributes = attributes.transform_keys(&:to_sym)
214
+ transformed_hash = {}
215
+ openapi_types.each_pair do |key, type|
216
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
217
+ transformed_hash["#{key}"] = nil
218
+ elsif type =~ /\AArray<(.*)>/i
212
219
  # check to ensure the input is an array given that the attribute
213
220
  # is documented as an array but the input is not
214
- if attributes[self.class.attribute_map[key]].is_a?(Array)
215
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
221
+ if attributes[attribute_map[key]].is_a?(Array)
222
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
216
223
  end
217
- elsif !attributes[self.class.attribute_map[key]].nil?
218
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
219
- end # or else data not found in attributes(hash), not an issue as the data can be optional
224
+ elsif !attributes[attribute_map[key]].nil?
225
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
226
+ end
220
227
  end
221
-
222
- self
228
+ new(transformed_hash)
223
229
  end
224
230
 
225
231
  # Deserializes the data based on type
226
232
  # @param string type Data type
227
233
  # @param string value Value to be deserialized
228
234
  # @return [Object] Deserialized data
229
- def _deserialize(type, value)
235
+ def self._deserialize(type, value)
230
236
  case type.to_sym
231
- when :DateTime
232
- DateTime.parse(value)
237
+ when :Time
238
+ Time.parse(value)
233
239
  when :Date
234
240
  Date.parse(value)
235
241
  when :String
@@ -259,7 +265,9 @@ module MessenteApi
259
265
  end
260
266
  end
261
267
  else # model
262
- MessenteApi.const_get(type).build_from_hash(value)
268
+ # models (e.g. Pet) or oneOf
269
+ klass = MessenteApi.const_get(type)
270
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
263
271
  end
264
272
  end
265
273
 
@@ -285,7 +293,7 @@ module MessenteApi
285
293
  is_nullable = self.class.openapi_nullable.include?(attr)
286
294
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
287
295
  end
288
-
296
+
289
297
  hash[param] = _to_hash(value)
290
298
  end
291
299
  hash
@@ -308,5 +316,7 @@ module MessenteApi
308
316
  value
309
317
  end
310
318
  end
319
+
311
320
  end
321
+
312
322
  end