messente_api 2.2.0 → 2.4.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 (138) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +24 -1
  3. data/docs/AccountBalanceApi.md +161 -0
  4. data/docs/NumberVerificationApi.md +195 -0
  5. data/docs/Price.md +24 -0
  6. data/docs/PriceNetworksInner.md +22 -0
  7. data/docs/PricingApi.md +167 -0
  8. data/docs/WhatsApp.md +13 -1
  9. data/docs/WhatsAppAudio.md +22 -0
  10. data/docs/WhatsAppDocument.md +26 -0
  11. data/docs/WhatsAppImage.md +24 -0
  12. data/docs/WhatsAppParameter.md +5 -1
  13. data/docs/WhatsAppSticker.md +24 -0
  14. data/docs/WhatsAppTemplate.md +1 -1
  15. data/docs/WhatsAppTemplatesApi.md +384 -0
  16. data/docs/WhatsAppText.md +20 -0
  17. data/docs/WhatsAppVideo.md +24 -0
  18. data/docs/WhatsappButtonType.md +15 -0
  19. data/docs/WhatsappComponentType.md +15 -0
  20. data/docs/WhatsappCreateTemplateRequest.md +24 -0
  21. data/docs/WhatsappCreateTemplateResponse.md +22 -0
  22. data/docs/WhatsappHeaderFormat.md +15 -0
  23. data/docs/WhatsappListTemplatesResponse.md +20 -0
  24. data/docs/WhatsappOtpButtonType.md +15 -0
  25. data/docs/WhatsappPagination.md +22 -0
  26. data/docs/WhatsappPagingCursors.md +20 -0
  27. data/docs/WhatsappSupportedApp.md +20 -0
  28. data/docs/WhatsappTemplateButton.md +30 -0
  29. data/docs/WhatsappTemplateCategory.md +15 -0
  30. data/docs/WhatsappTemplateComponent.md +26 -0
  31. data/docs/WhatsappTemplateExample.md +20 -0
  32. data/docs/WhatsappTemplateResponse.md +28 -0
  33. data/docs/WhatsappTemplateStatus.md +15 -0
  34. data/docs/WhatsappUpdateTemplateRequest.md +20 -0
  35. data/lib/messente_api/api/account_balance_api.rb +160 -0
  36. data/lib/messente_api/api/blacklist_api.rb +5 -5
  37. data/lib/messente_api/api/bulk_messaging_api.rb +2 -2
  38. data/lib/messente_api/api/contacts_api.rb +9 -9
  39. data/lib/messente_api/api/delivery_report_api.rb +2 -2
  40. data/lib/messente_api/api/groups_api.rb +6 -6
  41. data/lib/messente_api/api/number_lookup_api.rb +2 -2
  42. data/lib/messente_api/api/number_verification_api.rb +217 -0
  43. data/lib/messente_api/api/omnimessage_api.rb +3 -3
  44. data/lib/messente_api/api/pricing_api.rb +170 -0
  45. data/lib/messente_api/api/statistics_api.rb +2 -2
  46. data/lib/messente_api/api/whats_app_templates_api.rb +399 -0
  47. data/lib/messente_api/api_client.rb +1 -1
  48. data/lib/messente_api/api_error.rb +1 -1
  49. data/lib/messente_api/configuration.rb +61 -1
  50. data/lib/messente_api/models/bulk_omni_message_create_success_response.rb +1 -1
  51. data/lib/messente_api/models/bulk_omni_message_create_success_response_messages_inner.rb +1 -1
  52. data/lib/messente_api/models/bulk_omnimessage.rb +1 -1
  53. data/lib/messente_api/models/channel.rb +1 -1
  54. data/lib/messente_api/models/contact_envelope.rb +1 -1
  55. data/lib/messente_api/models/contact_fields.rb +1 -1
  56. data/lib/messente_api/models/contact_list_envelope.rb +1 -1
  57. data/lib/messente_api/models/contact_response_fields.rb +1 -1
  58. data/lib/messente_api/models/contact_update_fields.rb +1 -1
  59. data/lib/messente_api/models/delivery_report_response.rb +1 -1
  60. data/lib/messente_api/models/delivery_result.rb +1 -1
  61. data/lib/messente_api/models/error_code_omnichannel.rb +1 -1
  62. data/lib/messente_api/models/error_code_omnichannel_machine.rb +1 -1
  63. data/lib/messente_api/models/error_code_phonebook.rb +1 -1
  64. data/lib/messente_api/models/error_code_statistics.rb +1 -1
  65. data/lib/messente_api/models/error_item_number_lookup.rb +1 -1
  66. data/lib/messente_api/models/error_item_number_lookup_error.rb +1 -1
  67. data/lib/messente_api/models/error_item_omnichannel.rb +1 -1
  68. data/lib/messente_api/models/error_item_phonebook.rb +1 -1
  69. data/lib/messente_api/models/error_item_statistics.rb +1 -1
  70. data/lib/messente_api/models/error_number_lookup.rb +1 -1
  71. data/lib/messente_api/models/error_omnichannel.rb +1 -1
  72. data/lib/messente_api/models/error_phonebook.rb +1 -1
  73. data/lib/messente_api/models/error_statistics.rb +1 -1
  74. data/lib/messente_api/models/error_title_omnichannel.rb +1 -1
  75. data/lib/messente_api/models/error_title_phonebook.rb +1 -1
  76. data/lib/messente_api/models/fetch_blacklist_success.rb +1 -1
  77. data/lib/messente_api/models/group_envelope.rb +1 -1
  78. data/lib/messente_api/models/group_list_envelope.rb +1 -1
  79. data/lib/messente_api/models/group_name.rb +1 -1
  80. data/lib/messente_api/models/group_response_fields.rb +1 -1
  81. data/lib/messente_api/models/message_result.rb +1 -1
  82. data/lib/messente_api/models/mobile_network.rb +1 -1
  83. data/lib/messente_api/models/number_to_blacklist.rb +1 -1
  84. data/lib/messente_api/models/numbers_to_investigate.rb +1 -1
  85. data/lib/messente_api/models/omni_message_create_success_response.rb +1 -1
  86. data/lib/messente_api/models/omnimessage.rb +1 -1
  87. data/lib/messente_api/models/omnimessage_messages_inner.rb +1 -1
  88. data/lib/messente_api/models/price.rb +276 -0
  89. data/lib/messente_api/models/price_info.rb +1 -1
  90. data/lib/messente_api/models/price_networks_inner.rb +257 -0
  91. data/lib/messente_api/models/priority.rb +1 -1
  92. data/lib/messente_api/models/sms.rb +1 -1
  93. data/lib/messente_api/models/statistics_report.rb +1 -1
  94. data/lib/messente_api/models/statistics_report_settings.rb +1 -1
  95. data/lib/messente_api/models/statistics_report_success.rb +1 -1
  96. data/lib/messente_api/models/status.rb +1 -1
  97. data/lib/messente_api/models/sync_number_lookup_result.rb +1 -1
  98. data/lib/messente_api/models/sync_number_lookup_success.rb +1 -1
  99. data/lib/messente_api/models/telegram.rb +1 -1
  100. data/lib/messente_api/models/text_store.rb +1 -1
  101. data/lib/messente_api/models/viber.rb +1 -1
  102. data/lib/messente_api/models/viber_video.rb +1 -1
  103. data/lib/messente_api/models/whats_app.rb +59 -5
  104. data/lib/messente_api/models/whats_app_audio.rb +239 -0
  105. data/lib/messente_api/models/whats_app_component.rb +2 -1
  106. data/lib/messente_api/models/whats_app_currency.rb +1 -1
  107. data/lib/messente_api/models/whats_app_datetime.rb +1 -1
  108. data/lib/messente_api/models/whats_app_document.rb +261 -0
  109. data/lib/messente_api/models/whats_app_image.rb +250 -0
  110. data/lib/messente_api/models/whats_app_language.rb +1 -1
  111. data/lib/messente_api/models/whats_app_media.rb +1 -1
  112. data/lib/messente_api/models/whats_app_parameter.rb +25 -5
  113. data/lib/messente_api/models/whats_app_sticker.rb +250 -0
  114. data/lib/messente_api/models/whats_app_template.rb +8 -1
  115. data/lib/messente_api/models/whats_app_text.rb +235 -0
  116. data/lib/messente_api/models/whats_app_video.rb +250 -0
  117. data/lib/messente_api/models/whatsapp_button_type.rb +45 -0
  118. data/lib/messente_api/models/whatsapp_component_type.rb +42 -0
  119. data/lib/messente_api/models/whatsapp_create_template_request.rb +297 -0
  120. data/lib/messente_api/models/whatsapp_create_template_response.rb +277 -0
  121. data/lib/messente_api/models/whatsapp_header_format.rb +39 -0
  122. data/lib/messente_api/models/whatsapp_list_templates_response.rb +241 -0
  123. data/lib/messente_api/models/whatsapp_otp_button_type.rb +41 -0
  124. data/lib/messente_api/models/whatsapp_pagination.rb +242 -0
  125. data/lib/messente_api/models/whatsapp_paging_cursors.rb +226 -0
  126. data/lib/messente_api/models/whatsapp_supported_app.rb +240 -0
  127. data/lib/messente_api/models/whatsapp_template_button.rb +355 -0
  128. data/lib/messente_api/models/whatsapp_template_category.rb +41 -0
  129. data/lib/messente_api/models/whatsapp_template_component.rb +277 -0
  130. data/lib/messente_api/models/whatsapp_template_example.rb +230 -0
  131. data/lib/messente_api/models/whatsapp_template_response.rb +330 -0
  132. data/lib/messente_api/models/whatsapp_template_status.rb +47 -0
  133. data/lib/messente_api/models/whatsapp_update_template_request.rb +227 -0
  134. data/lib/messente_api/version.rb +2 -2
  135. data/lib/messente_api.rb +30 -1
  136. data/messente_api.gemspec +1 -1
  137. data/spec/spec_helper.rb +1 -1
  138. metadata +60 -2
@@ -0,0 +1,239 @@
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.11.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module MessenteApi
17
+ # WhatsApp audio content. Either \"id\" or \"link\" must be provided, but not both.
18
+ class WhatsAppAudio
19
+ # Unique identifier for the audio file.
20
+ attr_accessor :id
21
+
22
+ # MIME type of the audio file.
23
+ attr_accessor :mime_type
24
+
25
+ # URL link to the audio file.
26
+ attr_accessor :link
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'id' => :'id',
32
+ :'mime_type' => :'mime_type',
33
+ :'link' => :'link'
34
+ }
35
+ end
36
+
37
+ # Returns all the JSON keys this model knows about
38
+ def self.acceptable_attributes
39
+ attribute_map.values
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.openapi_types
44
+ {
45
+ :'id' => :'String',
46
+ :'mime_type' => :'String',
47
+ :'link' => :'String'
48
+ }
49
+ end
50
+
51
+ # List of attributes with nullable: true
52
+ def self.openapi_nullable
53
+ Set.new([
54
+ :'id',
55
+ :'mime_type',
56
+ :'link'
57
+ ])
58
+ end
59
+
60
+ # Initializes the object
61
+ # @param [Hash] attributes Model attributes in the form of hash
62
+ def initialize(attributes = {})
63
+ if (!attributes.is_a?(Hash))
64
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MessenteApi::WhatsAppAudio` initialize method"
65
+ end
66
+
67
+ # check to see if the attribute exists and convert string to symbol for hash key
68
+ attributes = attributes.each_with_object({}) { |(k, v), h|
69
+ if (!self.class.attribute_map.key?(k.to_sym))
70
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MessenteApi::WhatsAppAudio`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
71
+ end
72
+ h[k.to_sym] = v
73
+ }
74
+
75
+ if attributes.key?(:'id')
76
+ self.id = attributes[:'id']
77
+ end
78
+
79
+ if attributes.key?(:'mime_type')
80
+ self.mime_type = attributes[:'mime_type']
81
+ end
82
+
83
+ if attributes.key?(:'link')
84
+ self.link = attributes[:'link']
85
+ end
86
+ end
87
+
88
+ # Show invalid properties with the reasons. Usually used together with valid?
89
+ # @return Array for valid properties with the reasons
90
+ def list_invalid_properties
91
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
92
+ invalid_properties = Array.new
93
+ invalid_properties
94
+ end
95
+
96
+ # Check to see if the all the properties in the model are valid
97
+ # @return true if the model is valid
98
+ def valid?
99
+ warn '[DEPRECATED] the `valid?` method is obsolete'
100
+ true
101
+ end
102
+
103
+ # Checks equality by comparing each attribute.
104
+ # @param [Object] Object to be compared
105
+ def ==(o)
106
+ return true if self.equal?(o)
107
+ self.class == o.class &&
108
+ id == o.id &&
109
+ mime_type == o.mime_type &&
110
+ link == o.link
111
+ end
112
+
113
+ # @see the `==` method
114
+ # @param [Object] Object to be compared
115
+ def eql?(o)
116
+ self == o
117
+ end
118
+
119
+ # Calculates hash code according to all attributes.
120
+ # @return [Integer] Hash code
121
+ def hash
122
+ [id, mime_type, link].hash
123
+ end
124
+
125
+ # Builds the object from hash
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ # @return [Object] Returns the model itself
128
+ def self.build_from_hash(attributes)
129
+ return nil unless attributes.is_a?(Hash)
130
+ attributes = attributes.transform_keys(&:to_sym)
131
+ transformed_hash = {}
132
+ openapi_types.each_pair do |key, type|
133
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
134
+ transformed_hash["#{key}"] = nil
135
+ elsif type =~ /\AArray<(.*)>/i
136
+ # check to ensure the input is an array given that the attribute
137
+ # is documented as an array but the input is not
138
+ if attributes[attribute_map[key]].is_a?(Array)
139
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
140
+ end
141
+ elsif !attributes[attribute_map[key]].nil?
142
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
143
+ end
144
+ end
145
+ new(transformed_hash)
146
+ end
147
+
148
+ # Deserializes the data based on type
149
+ # @param string type Data type
150
+ # @param string value Value to be deserialized
151
+ # @return [Object] Deserialized data
152
+ def self._deserialize(type, value)
153
+ case type.to_sym
154
+ when :Time
155
+ Time.parse(value)
156
+ when :Date
157
+ Date.parse(value)
158
+ when :String
159
+ value.to_s
160
+ when :Integer
161
+ value.to_i
162
+ when :Float
163
+ value.to_f
164
+ when :Boolean
165
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
166
+ true
167
+ else
168
+ false
169
+ end
170
+ when :Object
171
+ # generic object (usually a Hash), return directly
172
+ value
173
+ when /\AArray<(?<inner_type>.+)>\z/
174
+ inner_type = Regexp.last_match[:inner_type]
175
+ value.map { |v| _deserialize(inner_type, v) }
176
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
177
+ k_type = Regexp.last_match[:k_type]
178
+ v_type = Regexp.last_match[:v_type]
179
+ {}.tap do |hash|
180
+ value.each do |k, v|
181
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
182
+ end
183
+ end
184
+ else # model
185
+ # models (e.g. Pet) or oneOf
186
+ klass = MessenteApi.const_get(type)
187
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
188
+ end
189
+ end
190
+
191
+ # Returns the string representation of the object
192
+ # @return [String] String presentation of the object
193
+ def to_s
194
+ to_hash.to_s
195
+ end
196
+
197
+ # to_body is an alias to to_hash (backward compatibility)
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_body
200
+ to_hash
201
+ end
202
+
203
+ # Returns the object in the form of hash
204
+ # @return [Hash] Returns the object in the form of hash
205
+ def to_hash
206
+ hash = {}
207
+ self.class.attribute_map.each_pair do |attr, param|
208
+ value = self.send(attr)
209
+ if value.nil?
210
+ is_nullable = self.class.openapi_nullable.include?(attr)
211
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
212
+ end
213
+
214
+ hash[param] = _to_hash(value)
215
+ end
216
+ hash
217
+ end
218
+
219
+ # Outputs non-array value in the form of hash
220
+ # For object, use to_hash. Otherwise, just return the value
221
+ # @param [Object] value Any valid value
222
+ # @return [Hash] Returns the value in the form of hash
223
+ def _to_hash(value)
224
+ if value.is_a?(Array)
225
+ value.compact.map { |v| _to_hash(v) }
226
+ elsif value.is_a?(Hash)
227
+ {}.tap do |hash|
228
+ value.each { |k, v| hash[k] = _to_hash(v) }
229
+ end
230
+ elsif value.respond_to? :to_hash
231
+ value.to_hash
232
+ else
233
+ value
234
+ end
235
+ end
236
+
237
+ end
238
+
239
+ end
@@ -6,7 +6,7 @@
6
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
- Generator version: 7.6.0
9
+ Generator version: 7.11.0
10
10
 
11
11
  =end
12
12
 
@@ -56,6 +56,7 @@ module MessenteApi
56
56
  # List of attributes with nullable: true
57
57
  def self.openapi_nullable
58
58
  Set.new([
59
+ :'index',
59
60
  ])
60
61
  end
61
62
 
@@ -6,7 +6,7 @@
6
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
- Generator version: 7.6.0
9
+ Generator version: 7.11.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
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
- Generator version: 7.6.0
9
+ Generator version: 7.11.0
10
10
 
11
11
  =end
12
12
 
@@ -0,0 +1,261 @@
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.11.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module MessenteApi
17
+ # WhatsApp document content. Either \"id\" or \"link\" must be provided, but not both.
18
+ class WhatsAppDocument
19
+ # Unique identifier for the document file.
20
+ attr_accessor :id
21
+
22
+ # Caption for the document.
23
+ attr_accessor :caption
24
+
25
+ # MIME type of the document file.
26
+ attr_accessor :mime_type
27
+
28
+ # Name of the document file.
29
+ attr_accessor :file_name
30
+
31
+ # URL link to the document file.
32
+ attr_accessor :link
33
+
34
+ # Attribute mapping from ruby-style variable name to JSON key.
35
+ def self.attribute_map
36
+ {
37
+ :'id' => :'id',
38
+ :'caption' => :'caption',
39
+ :'mime_type' => :'mime_type',
40
+ :'file_name' => :'file_name',
41
+ :'link' => :'link'
42
+ }
43
+ end
44
+
45
+ # Returns all the JSON keys this model knows about
46
+ def self.acceptable_attributes
47
+ attribute_map.values
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.openapi_types
52
+ {
53
+ :'id' => :'String',
54
+ :'caption' => :'String',
55
+ :'mime_type' => :'String',
56
+ :'file_name' => :'String',
57
+ :'link' => :'String'
58
+ }
59
+ end
60
+
61
+ # List of attributes with nullable: true
62
+ def self.openapi_nullable
63
+ Set.new([
64
+ :'id',
65
+ :'caption',
66
+ :'mime_type',
67
+ :'file_name',
68
+ :'link'
69
+ ])
70
+ end
71
+
72
+ # Initializes the object
73
+ # @param [Hash] attributes Model attributes in the form of hash
74
+ def initialize(attributes = {})
75
+ if (!attributes.is_a?(Hash))
76
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MessenteApi::WhatsAppDocument` initialize method"
77
+ end
78
+
79
+ # check to see if the attribute exists and convert string to symbol for hash key
80
+ attributes = attributes.each_with_object({}) { |(k, v), h|
81
+ if (!self.class.attribute_map.key?(k.to_sym))
82
+ 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
83
+ end
84
+ h[k.to_sym] = v
85
+ }
86
+
87
+ if attributes.key?(:'id')
88
+ self.id = attributes[:'id']
89
+ end
90
+
91
+ if attributes.key?(:'caption')
92
+ self.caption = attributes[:'caption']
93
+ end
94
+
95
+ if attributes.key?(:'mime_type')
96
+ self.mime_type = attributes[:'mime_type']
97
+ end
98
+
99
+ if attributes.key?(:'file_name')
100
+ self.file_name = attributes[:'file_name']
101
+ end
102
+
103
+ if attributes.key?(:'link')
104
+ self.link = attributes[:'link']
105
+ end
106
+ end
107
+
108
+ # Show invalid properties with the reasons. Usually used together with valid?
109
+ # @return Array for valid properties with the reasons
110
+ def list_invalid_properties
111
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
112
+ invalid_properties = Array.new
113
+ invalid_properties
114
+ end
115
+
116
+ # Check to see if the all the properties in the model are valid
117
+ # @return true if the model is valid
118
+ def valid?
119
+ warn '[DEPRECATED] the `valid?` method is obsolete'
120
+ true
121
+ end
122
+
123
+ # Checks equality by comparing each attribute.
124
+ # @param [Object] Object to be compared
125
+ def ==(o)
126
+ return true if self.equal?(o)
127
+ self.class == o.class &&
128
+ id == o.id &&
129
+ caption == o.caption &&
130
+ mime_type == o.mime_type &&
131
+ file_name == o.file_name &&
132
+ link == o.link
133
+ end
134
+
135
+ # @see the `==` method
136
+ # @param [Object] Object to be compared
137
+ def eql?(o)
138
+ self == o
139
+ end
140
+
141
+ # Calculates hash code according to all attributes.
142
+ # @return [Integer] Hash code
143
+ def hash
144
+ [id, caption, mime_type, file_name, link].hash
145
+ end
146
+
147
+ # Builds the object from hash
148
+ # @param [Hash] attributes Model attributes in the form of hash
149
+ # @return [Object] Returns the model itself
150
+ def self.build_from_hash(attributes)
151
+ return nil unless attributes.is_a?(Hash)
152
+ attributes = attributes.transform_keys(&:to_sym)
153
+ transformed_hash = {}
154
+ openapi_types.each_pair do |key, type|
155
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
156
+ transformed_hash["#{key}"] = nil
157
+ elsif type =~ /\AArray<(.*)>/i
158
+ # check to ensure the input is an array given that the attribute
159
+ # is documented as an array but the input is not
160
+ if attributes[attribute_map[key]].is_a?(Array)
161
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
162
+ end
163
+ elsif !attributes[attribute_map[key]].nil?
164
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
165
+ end
166
+ end
167
+ new(transformed_hash)
168
+ end
169
+
170
+ # Deserializes the data based on type
171
+ # @param string type Data type
172
+ # @param string value Value to be deserialized
173
+ # @return [Object] Deserialized data
174
+ def self._deserialize(type, value)
175
+ case type.to_sym
176
+ when :Time
177
+ Time.parse(value)
178
+ when :Date
179
+ Date.parse(value)
180
+ when :String
181
+ value.to_s
182
+ when :Integer
183
+ value.to_i
184
+ when :Float
185
+ value.to_f
186
+ when :Boolean
187
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
188
+ true
189
+ else
190
+ false
191
+ end
192
+ when :Object
193
+ # generic object (usually a Hash), return directly
194
+ value
195
+ when /\AArray<(?<inner_type>.+)>\z/
196
+ inner_type = Regexp.last_match[:inner_type]
197
+ value.map { |v| _deserialize(inner_type, v) }
198
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
199
+ k_type = Regexp.last_match[:k_type]
200
+ v_type = Regexp.last_match[:v_type]
201
+ {}.tap do |hash|
202
+ value.each do |k, v|
203
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
204
+ end
205
+ end
206
+ else # model
207
+ # models (e.g. Pet) or oneOf
208
+ klass = MessenteApi.const_get(type)
209
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
210
+ end
211
+ end
212
+
213
+ # Returns the string representation of the object
214
+ # @return [String] String presentation of the object
215
+ def to_s
216
+ to_hash.to_s
217
+ end
218
+
219
+ # to_body is an alias to to_hash (backward compatibility)
220
+ # @return [Hash] Returns the object in the form of hash
221
+ def to_body
222
+ to_hash
223
+ end
224
+
225
+ # Returns the object in the form of hash
226
+ # @return [Hash] Returns the object in the form of hash
227
+ def to_hash
228
+ hash = {}
229
+ self.class.attribute_map.each_pair do |attr, param|
230
+ value = self.send(attr)
231
+ if value.nil?
232
+ is_nullable = self.class.openapi_nullable.include?(attr)
233
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
234
+ end
235
+
236
+ hash[param] = _to_hash(value)
237
+ end
238
+ hash
239
+ end
240
+
241
+ # Outputs non-array value in the form of hash
242
+ # For object, use to_hash. Otherwise, just return the value
243
+ # @param [Object] value Any valid value
244
+ # @return [Hash] Returns the value in the form of hash
245
+ def _to_hash(value)
246
+ if value.is_a?(Array)
247
+ value.compact.map { |v| _to_hash(v) }
248
+ elsif value.is_a?(Hash)
249
+ {}.tap do |hash|
250
+ value.each { |k, v| hash[k] = _to_hash(v) }
251
+ end
252
+ elsif value.respond_to? :to_hash
253
+ value.to_hash
254
+ else
255
+ value
256
+ end
257
+ end
258
+
259
+ end
260
+
261
+ end