bandwidth-sdk 17.0.0 → 17.1.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 (246) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +4 -4
  3. data/README.md +29 -3
  4. data/bandwidth-sdk.gemspec +1 -2
  5. data/bandwidth.yml +85 -22
  6. data/coverage/.last_run.json +1 -1
  7. data/coverage/.resultset.json +317 -487
  8. data/coverage/index.html +6317 -7908
  9. data/custom_templates/README.mustache +4 -1
  10. data/custom_templates/api_client.mustache +254 -0
  11. data/custom_templates/configuration.mustache +545 -0
  12. data/custom_templates/gem.mustache +2 -0
  13. data/docs/CallsApi.md +20 -5
  14. data/docs/ConferencesApi.md +36 -9
  15. data/docs/MFAApi.md +12 -3
  16. data/docs/MediaApi.md +16 -4
  17. data/docs/MessagesApi.md +8 -2
  18. data/docs/MultiChannelAction.md +32 -81
  19. data/docs/MultiChannelApi.md +5 -2
  20. data/docs/{MultiChannelChannelListObject.md → MultiChannelChannelListMMSObject.md} +3 -3
  21. data/docs/{MultiChannelMessageResponseDataChannelListInner.md → MultiChannelChannelListMMSResponseObject.md} +3 -3
  22. data/docs/MultiChannelChannelListObjectBase.md +22 -0
  23. data/docs/MultiChannelChannelListOwnerObject.md +18 -0
  24. data/docs/MultiChannelChannelListRBMObject.md +24 -0
  25. data/docs/{MultiChannelChannelListObjectContent.md → MultiChannelChannelListRBMObjectAllOfContent.md} +6 -10
  26. data/docs/MultiChannelChannelListRBMResponseObject.md +26 -0
  27. data/docs/MultiChannelChannelListRequestObject.md +24 -0
  28. data/docs/MultiChannelChannelListResponseObject.md +26 -0
  29. data/docs/MultiChannelChannelListSMSObject.md +24 -0
  30. data/docs/MultiChannelChannelListSMSResponseObject.md +26 -0
  31. data/docs/MultiChannelMessageRequest.md +1 -1
  32. data/docs/MultiChannelMessageResponseData.md +1 -1
  33. data/docs/PhoneNumberLookupApi.md +12 -3
  34. data/docs/RbmActionBase.md +1 -1
  35. data/docs/RbmSuggestionResponse.md +1 -1
  36. data/docs/RecordingsApi.md +40 -10
  37. data/docs/StatisticsApi.md +4 -1
  38. data/docs/TollFreeVerificationApi.md +36 -9
  39. data/docs/TranscriptionsApi.md +12 -3
  40. data/lib/bandwidth-sdk/api/calls_api.rb +6 -6
  41. data/lib/bandwidth-sdk/api/conferences_api.rb +10 -10
  42. data/lib/bandwidth-sdk/api/media_api.rb +5 -5
  43. data/lib/bandwidth-sdk/api/messages_api.rb +3 -3
  44. data/lib/bandwidth-sdk/api/mfa_api.rb +4 -4
  45. data/lib/bandwidth-sdk/api/multi_channel_api.rb +2 -2
  46. data/lib/bandwidth-sdk/api/phone_number_lookup_api.rb +4 -4
  47. data/lib/bandwidth-sdk/api/recordings_api.rb +11 -11
  48. data/lib/bandwidth-sdk/api/statistics_api.rb +2 -2
  49. data/lib/bandwidth-sdk/api/toll_free_verification_api.rb +13 -13
  50. data/lib/bandwidth-sdk/api/transcriptions_api.rb +4 -4
  51. data/lib/bandwidth-sdk/api_client.rb +9 -5
  52. data/lib/bandwidth-sdk/api_error.rb +1 -1
  53. data/lib/bandwidth-sdk/api_model_base.rb +88 -0
  54. data/lib/bandwidth-sdk/configuration.rb +50 -1
  55. data/lib/bandwidth-sdk/models/account_statistics.rb +11 -78
  56. data/lib/bandwidth-sdk/models/additional_denial_reason.rb +41 -78
  57. data/lib/bandwidth-sdk/models/address.rb +23 -90
  58. data/lib/bandwidth-sdk/models/answer_callback.rb +11 -78
  59. data/lib/bandwidth-sdk/models/async_lookup_request.rb +11 -78
  60. data/lib/bandwidth-sdk/models/blocked_webhook.rb +13 -80
  61. data/lib/bandwidth-sdk/models/bridge_complete_callback.rb +11 -78
  62. data/lib/bandwidth-sdk/models/bridge_target_complete_callback.rb +11 -78
  63. data/lib/bandwidth-sdk/models/business_entity_type_enum.rb +1 -1
  64. data/lib/bandwidth-sdk/models/business_registration_type_enum.rb +1 -1
  65. data/lib/bandwidth-sdk/models/call_direction_enum.rb +1 -1
  66. data/lib/bandwidth-sdk/models/call_recording_metadata.rb +11 -78
  67. data/lib/bandwidth-sdk/models/call_state.rb +11 -78
  68. data/lib/bandwidth-sdk/models/call_state_enum.rb +1 -1
  69. data/lib/bandwidth-sdk/models/call_transcription.rb +11 -78
  70. data/lib/bandwidth-sdk/models/call_transcription_detected_language_enum.rb +1 -1
  71. data/lib/bandwidth-sdk/models/call_transcription_metadata.rb +11 -78
  72. data/lib/bandwidth-sdk/models/call_transcription_response.rb +11 -78
  73. data/lib/bandwidth-sdk/models/call_transcription_track_enum.rb +1 -1
  74. data/lib/bandwidth-sdk/models/callback.rb +1 -1
  75. data/lib/bandwidth-sdk/models/callback_method_enum.rb +1 -1
  76. data/lib/bandwidth-sdk/models/card_width_enum.rb +1 -1
  77. data/lib/bandwidth-sdk/models/code_request.rb +11 -78
  78. data/lib/bandwidth-sdk/models/completed_lookup_status_enum.rb +1 -1
  79. data/lib/bandwidth-sdk/models/conference.rb +11 -78
  80. data/lib/bandwidth-sdk/models/conference_completed_callback.rb +11 -78
  81. data/lib/bandwidth-sdk/models/conference_created_callback.rb +11 -78
  82. data/lib/bandwidth-sdk/models/conference_member.rb +11 -78
  83. data/lib/bandwidth-sdk/models/conference_member_exit_callback.rb +11 -78
  84. data/lib/bandwidth-sdk/models/conference_member_join_callback.rb +11 -78
  85. data/lib/bandwidth-sdk/models/conference_recording_available_callback.rb +11 -78
  86. data/lib/bandwidth-sdk/models/conference_recording_metadata.rb +11 -78
  87. data/lib/bandwidth-sdk/models/conference_redirect_callback.rb +11 -78
  88. data/lib/bandwidth-sdk/models/conference_state_enum.rb +1 -1
  89. data/lib/bandwidth-sdk/models/contact.rb +19 -86
  90. data/lib/bandwidth-sdk/models/create_async_bulk_lookup_response.rb +11 -78
  91. data/lib/bandwidth-sdk/models/create_async_bulk_lookup_response_data.rb +11 -78
  92. data/lib/bandwidth-sdk/models/create_call.rb +41 -78
  93. data/lib/bandwidth-sdk/models/create_call_response.rb +81 -78
  94. data/lib/bandwidth-sdk/models/create_message_request_error.rb +31 -78
  95. data/lib/bandwidth-sdk/models/create_multi_channel_message_response.rb +11 -78
  96. data/lib/bandwidth-sdk/models/create_sync_lookup_response.rb +11 -78
  97. data/lib/bandwidth-sdk/models/create_sync_lookup_response_data.rb +11 -78
  98. data/lib/bandwidth-sdk/models/deactivation_event_enum.rb +1 -1
  99. data/lib/bandwidth-sdk/models/disconnect_callback.rb +11 -78
  100. data/lib/bandwidth-sdk/models/diversion.rb +11 -78
  101. data/lib/bandwidth-sdk/models/dtmf_callback.rb +11 -78
  102. data/lib/bandwidth-sdk/models/error.rb +11 -78
  103. data/lib/bandwidth-sdk/models/error_object.rb +41 -78
  104. data/lib/bandwidth-sdk/models/error_source.rb +11 -78
  105. data/lib/bandwidth-sdk/models/failure_webhook.rb +13 -80
  106. data/lib/bandwidth-sdk/models/field_error.rb +11 -78
  107. data/lib/bandwidth-sdk/models/file_format_enum.rb +1 -1
  108. data/lib/bandwidth-sdk/models/gather_callback.rb +11 -78
  109. data/lib/bandwidth-sdk/models/get_async_bulk_lookup_response.rb +11 -78
  110. data/lib/bandwidth-sdk/models/get_async_bulk_lookup_response_data.rb +11 -78
  111. data/lib/bandwidth-sdk/models/in_progress_lookup_status_enum.rb +1 -1
  112. data/lib/bandwidth-sdk/models/inbound_callback.rb +61 -78
  113. data/lib/bandwidth-sdk/models/inbound_callback_message.rb +81 -78
  114. data/lib/bandwidth-sdk/models/inbound_callback_type_enum.rb +1 -1
  115. data/lib/bandwidth-sdk/models/initiate_callback.rb +11 -78
  116. data/lib/bandwidth-sdk/models/latest_message_delivery_status_enum.rb +1 -1
  117. data/lib/bandwidth-sdk/models/line_type_enum.rb +1 -1
  118. data/lib/bandwidth-sdk/models/link.rb +11 -78
  119. data/lib/bandwidth-sdk/models/link_schema.rb +11 -78
  120. data/lib/bandwidth-sdk/models/links_object.rb +11 -78
  121. data/lib/bandwidth-sdk/models/list_message_direction_enum.rb +1 -1
  122. data/lib/bandwidth-sdk/models/list_message_item.rb +11 -78
  123. data/lib/bandwidth-sdk/models/lookup_error_response.rb +11 -78
  124. data/lib/bandwidth-sdk/models/lookup_error_schema.rb +11 -78
  125. data/lib/bandwidth-sdk/models/lookup_error_schema_meta.rb +11 -78
  126. data/lib/bandwidth-sdk/models/lookup_result.rb +11 -78
  127. data/lib/bandwidth-sdk/models/machine_detection_complete_callback.rb +11 -78
  128. data/lib/bandwidth-sdk/models/machine_detection_configuration.rb +11 -78
  129. data/lib/bandwidth-sdk/models/machine_detection_mode_enum.rb +1 -1
  130. data/lib/bandwidth-sdk/models/machine_detection_result.rb +11 -78
  131. data/lib/bandwidth-sdk/models/media.rb +11 -78
  132. data/lib/bandwidth-sdk/models/message.rb +11 -78
  133. data/lib/bandwidth-sdk/models/message_direction_enum.rb +1 -1
  134. data/lib/bandwidth-sdk/models/message_request.rb +31 -78
  135. data/lib/bandwidth-sdk/models/message_status_enum.rb +1 -1
  136. data/lib/bandwidth-sdk/models/message_type_enum.rb +1 -1
  137. data/lib/bandwidth-sdk/models/messages_list.rb +11 -78
  138. data/lib/bandwidth-sdk/models/messaging_code_response.rb +11 -78
  139. data/lib/bandwidth-sdk/models/messaging_request_error.rb +31 -78
  140. data/lib/bandwidth-sdk/models/mfa_forbidden_request_error.rb +11 -78
  141. data/lib/bandwidth-sdk/models/mfa_request_error.rb +11 -78
  142. data/lib/bandwidth-sdk/models/mfa_unauthorized_request_error.rb +11 -78
  143. data/lib/bandwidth-sdk/models/mms_message_content.rb +11 -78
  144. data/lib/bandwidth-sdk/models/mms_message_content_file.rb +11 -78
  145. data/lib/bandwidth-sdk/models/multi_channel_action.rb +71 -27
  146. data/lib/bandwidth-sdk/models/multi_channel_action_calendar_event.rb +41 -78
  147. data/lib/bandwidth-sdk/models/{multi_channel_channel_list_object.rb → multi_channel_channel_list_mms_object.rb} +60 -80
  148. data/lib/bandwidth-sdk/models/{multi_channel_message_response_data_channel_list_inner.rb → multi_channel_channel_list_mms_response_object.rb} +65 -81
  149. data/lib/bandwidth-sdk/models/multi_channel_channel_list_object_base.rb +238 -0
  150. data/lib/bandwidth-sdk/models/multi_channel_channel_list_owner_object.rb +163 -0
  151. data/lib/bandwidth-sdk/models/multi_channel_channel_list_rbm_object.rb +271 -0
  152. data/lib/bandwidth-sdk/models/{multi_channel_channel_list_object_content.rb → multi_channel_channel_list_rbm_object_all_of_content.rb} +5 -8
  153. data/lib/bandwidth-sdk/models/multi_channel_channel_list_rbm_response_object.rb +299 -0
  154. data/lib/bandwidth-sdk/models/multi_channel_channel_list_request_object.rb +103 -0
  155. data/lib/bandwidth-sdk/models/multi_channel_channel_list_response_object.rb +103 -0
  156. data/lib/bandwidth-sdk/models/multi_channel_channel_list_sms_object.rb +271 -0
  157. data/lib/bandwidth-sdk/models/multi_channel_channel_list_sms_response_object.rb +299 -0
  158. data/lib/bandwidth-sdk/models/multi_channel_error.rb +11 -78
  159. data/lib/bandwidth-sdk/models/multi_channel_message_channel_enum.rb +1 -1
  160. data/lib/bandwidth-sdk/models/multi_channel_message_content.rb +11 -78
  161. data/lib/bandwidth-sdk/models/multi_channel_message_request.rb +22 -79
  162. data/lib/bandwidth-sdk/models/multi_channel_message_response_data.rb +42 -79
  163. data/lib/bandwidth-sdk/models/opt_in_workflow.rb +25 -82
  164. data/lib/bandwidth-sdk/models/page_info.rb +11 -78
  165. data/lib/bandwidth-sdk/models/priority_enum.rb +1 -1
  166. data/lib/bandwidth-sdk/models/product_type_enum.rb +1 -1
  167. data/lib/bandwidth-sdk/models/rbm_action_base.rb +21 -78
  168. data/lib/bandwidth-sdk/models/rbm_action_dial.rb +31 -78
  169. data/lib/bandwidth-sdk/models/rbm_action_open_url.rb +21 -78
  170. data/lib/bandwidth-sdk/models/rbm_action_type_enum.rb +1 -1
  171. data/lib/bandwidth-sdk/models/rbm_action_view_location.rb +41 -78
  172. data/lib/bandwidth-sdk/models/rbm_card_content.rb +11 -78
  173. data/lib/bandwidth-sdk/models/rbm_card_content_media.rb +21 -78
  174. data/lib/bandwidth-sdk/models/rbm_location_response.rb +11 -78
  175. data/lib/bandwidth-sdk/models/rbm_media_height_enum.rb +1 -1
  176. data/lib/bandwidth-sdk/models/rbm_message_carousel_card.rb +21 -78
  177. data/lib/bandwidth-sdk/models/rbm_message_content_file.rb +11 -78
  178. data/lib/bandwidth-sdk/models/rbm_message_content_rich_card.rb +3 -4
  179. data/lib/bandwidth-sdk/models/rbm_message_content_text.rb +11 -78
  180. data/lib/bandwidth-sdk/models/rbm_message_media.rb +21 -78
  181. data/lib/bandwidth-sdk/models/rbm_standalone_card.rb +41 -78
  182. data/lib/bandwidth-sdk/models/rbm_suggestion_response.rb +11 -78
  183. data/lib/bandwidth-sdk/models/recording_available_callback.rb +11 -78
  184. data/lib/bandwidth-sdk/models/recording_complete_callback.rb +11 -78
  185. data/lib/bandwidth-sdk/models/recording_state_enum.rb +1 -1
  186. data/lib/bandwidth-sdk/models/recording_transcription_metadata.rb +11 -78
  187. data/lib/bandwidth-sdk/models/recording_transcriptions.rb +11 -78
  188. data/lib/bandwidth-sdk/models/redirect_callback.rb +11 -78
  189. data/lib/bandwidth-sdk/models/redirect_method_enum.rb +1 -1
  190. data/lib/bandwidth-sdk/models/sms_message_content.rb +11 -78
  191. data/lib/bandwidth-sdk/models/standalone_card_orientation_enum.rb +1 -1
  192. data/lib/bandwidth-sdk/models/status_callback.rb +61 -78
  193. data/lib/bandwidth-sdk/models/status_callback_message.rb +81 -78
  194. data/lib/bandwidth-sdk/models/status_callback_type_enum.rb +6 -6
  195. data/lib/bandwidth-sdk/models/stir_shaken.rb +11 -78
  196. data/lib/bandwidth-sdk/models/sync_lookup_request.rb +11 -78
  197. data/lib/bandwidth-sdk/models/telephone_number.rb +11 -78
  198. data/lib/bandwidth-sdk/models/tfv_basic_authentication.rb +11 -78
  199. data/lib/bandwidth-sdk/models/tfv_callback_status_enum.rb +1 -1
  200. data/lib/bandwidth-sdk/models/tfv_error.rb +11 -78
  201. data/lib/bandwidth-sdk/models/tfv_status.rb +13 -80
  202. data/lib/bandwidth-sdk/models/tfv_status_enum.rb +1 -1
  203. data/lib/bandwidth-sdk/models/tfv_submission_info.rb +21 -88
  204. data/lib/bandwidth-sdk/models/tfv_submission_wrapper.rb +11 -78
  205. data/lib/bandwidth-sdk/models/thumbnail_alignment_enum.rb +1 -1
  206. data/lib/bandwidth-sdk/models/transcribe_recording.rb +11 -78
  207. data/lib/bandwidth-sdk/models/transcription.rb +11 -78
  208. data/lib/bandwidth-sdk/models/transcription_available_callback.rb +11 -78
  209. data/lib/bandwidth-sdk/models/transfer_answer_callback.rb +11 -78
  210. data/lib/bandwidth-sdk/models/transfer_complete_callback.rb +11 -78
  211. data/lib/bandwidth-sdk/models/transfer_disconnect_callback.rb +11 -78
  212. data/lib/bandwidth-sdk/models/update_call.rb +11 -78
  213. data/lib/bandwidth-sdk/models/update_call_recording.rb +21 -78
  214. data/lib/bandwidth-sdk/models/update_conference.rb +11 -78
  215. data/lib/bandwidth-sdk/models/update_conference_member.rb +11 -78
  216. data/lib/bandwidth-sdk/models/verification_denial_webhook.rb +13 -80
  217. data/lib/bandwidth-sdk/models/verification_request.rb +51 -88
  218. data/lib/bandwidth-sdk/models/verification_update_request.rb +51 -88
  219. data/lib/bandwidth-sdk/models/verification_webhook.rb +13 -80
  220. data/lib/bandwidth-sdk/models/verify_code_request.rb +13 -80
  221. data/lib/bandwidth-sdk/models/verify_code_response.rb +11 -78
  222. data/lib/bandwidth-sdk/models/voice_api_error.rb +11 -78
  223. data/lib/bandwidth-sdk/models/voice_code_response.rb +11 -78
  224. data/lib/bandwidth-sdk/models/webhook_subscription.rb +13 -80
  225. data/lib/bandwidth-sdk/models/webhook_subscription_basic_authentication.rb +11 -78
  226. data/lib/bandwidth-sdk/models/webhook_subscription_request_schema.rb +15 -82
  227. data/lib/bandwidth-sdk/models/webhook_subscription_type_enum.rb +1 -1
  228. data/lib/bandwidth-sdk/models/webhook_subscriptions_list_body.rb +21 -78
  229. data/lib/bandwidth-sdk/version.rb +2 -2
  230. data/lib/bandwidth-sdk.rb +13 -4
  231. data/openapitools.json +1 -1
  232. data/spec/smoke/calls_api_spec.rb +50 -76
  233. data/spec/smoke/conferences_api_spec.rb +7 -5
  234. data/spec/smoke/media_api_spec.rb +4 -2
  235. data/spec/smoke/messages_api_spec.rb +9 -4
  236. data/spec/smoke/mfa_api_spec.rb +9 -4
  237. data/spec/smoke/multi_channel_api_spec.rb +128 -25
  238. data/spec/smoke/phone_number_lookup_api_spec.rb +7 -5
  239. data/spec/smoke/recordings_api_spec.rb +7 -33
  240. data/spec/smoke/statistics_api_spec.rb +16 -8
  241. data/spec/smoke/toll_free_verification_api_spec.rb +6 -4
  242. data/spec/smoke/transcriptions_api_spec.rb +7 -5
  243. data/spec/spec_helper.rb +2 -0
  244. data/spec/unit/api/multi_channel_api_spec.rb +13 -2
  245. data/spec/unit/models/verify_code_request_spec.rb +1 -1
  246. metadata +27 -8
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0.0
7
7
  Contact: letstalk@bandwidth.com
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.17.0
10
10
 
11
11
  =end
12
12
 
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Bandwidth
17
- class MmsMessageContentFile
17
+ class MmsMessageContentFile < ApiModelBase
18
18
  # The URL of a media attachment. For MMS, the API limits file size to 3.5MB. Specific carriers and channels may have a smaller limit that could cause a large file to fail, see [here](https://support.bandwidth.com/hc/en-us/articles/360014235473-What-are-the-MMS-file-size-limits) for more details.
19
19
  attr_accessor :file_url
20
20
 
@@ -25,9 +25,14 @@ module Bandwidth
25
25
  }
26
26
  end
27
27
 
28
+ # Returns attribute mapping this model knows about
29
+ def self.acceptable_attribute_map
30
+ attribute_map
31
+ end
32
+
28
33
  # Returns all the JSON keys this model knows about
29
34
  def self.acceptable_attributes
30
- attribute_map.values
35
+ acceptable_attribute_map.values
31
36
  end
32
37
 
33
38
  # Attribute type mapping.
@@ -51,9 +56,10 @@ module Bandwidth
51
56
  end
52
57
 
53
58
  # check to see if the attribute exists and convert string to symbol for hash key
59
+ acceptable_attribute_map = self.class.acceptable_attribute_map
54
60
  attributes = attributes.each_with_object({}) { |(k, v), h|
55
- if (!self.class.attribute_map.key?(k.to_sym))
56
- fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MmsMessageContentFile`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
61
+ if (!acceptable_attribute_map.key?(k.to_sym))
62
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MmsMessageContentFile`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
57
63
  end
58
64
  h[k.to_sym] = v
59
65
  }
@@ -147,61 +153,6 @@ module Bandwidth
147
153
  new(transformed_hash)
148
154
  end
149
155
 
150
- # Deserializes the data based on type
151
- # @param string type Data type
152
- # @param string value Value to be deserialized
153
- # @return [Object] Deserialized data
154
- def self._deserialize(type, value)
155
- case type.to_sym
156
- when :Time
157
- Time.parse(value)
158
- when :Date
159
- Date.parse(value)
160
- when :String
161
- value.to_s
162
- when :Integer
163
- value.to_i
164
- when :Float
165
- value.to_f
166
- when :Boolean
167
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
168
- true
169
- else
170
- false
171
- end
172
- when :Object
173
- # generic object (usually a Hash), return directly
174
- value
175
- when /\AArray<(?<inner_type>.+)>\z/
176
- inner_type = Regexp.last_match[:inner_type]
177
- value.map { |v| _deserialize(inner_type, v) }
178
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
179
- k_type = Regexp.last_match[:k_type]
180
- v_type = Regexp.last_match[:v_type]
181
- {}.tap do |hash|
182
- value.each do |k, v|
183
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
184
- end
185
- end
186
- else # model
187
- # models (e.g. Pet) or oneOf
188
- klass = Bandwidth.const_get(type)
189
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
190
- end
191
- end
192
-
193
- # Returns the string representation of the object
194
- # @return [String] String presentation of the object
195
- def to_s
196
- to_hash.to_s
197
- end
198
-
199
- # to_body is an alias to to_hash (backward compatibility)
200
- # @return [Hash] Returns the object in the form of hash
201
- def to_body
202
- to_hash
203
- end
204
-
205
156
  # Returns the object in the form of hash
206
157
  # @return [Hash] Returns the object in the form of hash
207
158
  def to_hash
@@ -217,23 +168,5 @@ module Bandwidth
217
168
  end
218
169
  hash
219
170
  end
220
-
221
- # Outputs non-array value in the form of hash
222
- # For object, use to_hash. Otherwise, just return the value
223
- # @param [Object] value Any valid value
224
- # @return [Hash] Returns the value in the form of hash
225
- def _to_hash(value)
226
- if value.is_a?(Array)
227
- value.compact.map { |v| _to_hash(v) }
228
- elsif value.is_a?(Hash)
229
- {}.tap do |hash|
230
- value.each { |k, v| hash[k] = _to_hash(v) }
231
- end
232
- elsif value.respond_to? :to_hash
233
- value.to_hash
234
- else
235
- value
236
- end
237
- end
238
171
  end
239
172
  end
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0.0
7
7
  Contact: letstalk@bandwidth.com
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.17.0
10
10
 
11
11
  =end
12
12
 
@@ -16,8 +16,8 @@ require 'time'
16
16
  module Bandwidth
17
17
  module MultiChannelAction
18
18
  class << self
19
- # List of class defined in oneOf (OpenAPI v3)
20
- def openapi_one_of
19
+ # List of class defined in anyOf (OpenAPI v3)
20
+ def openapi_any_of
21
21
  [
22
22
  :'MultiChannelActionCalendarEvent',
23
23
  :'RbmActionBase',
@@ -27,35 +27,79 @@ module Bandwidth
27
27
  ]
28
28
  end
29
29
 
30
- # Discriminator's property name (OpenAPI v3)
31
- def openapi_discriminator_name
32
- :'type'
33
- end
34
-
35
- # Discriminator's mapping (OpenAPI v3)
36
- def openapi_discriminator_mapping
37
- {
38
- :'CREATE_CALENDAR_EVENT' => :'MultiChannelActionCalendarEvent',
39
- :'DIAL_PHONE' => :'RbmActionDial',
40
- :'OPEN_URL' => :'RbmActionOpenUrl',
41
- :'REPLY' => :'RbmActionBase',
42
- :'REQUEST_LOCATION' => :'RbmActionBase',
43
- :'SHOW_LOCATION' => :'RbmActionViewLocation'
44
- }
45
- end
46
-
47
30
  # Builds the object
48
- # @param [Mixed] Data to be matched against the list of oneOf items
31
+ # @param [Mixed] Data to be matched against the list of anyOf items
49
32
  # @return [Object] Returns the model or the data itself
50
33
  def build(data)
51
- discriminator_value = data[openapi_discriminator_name]
52
- return nil if discriminator_value.nil?
53
-
54
- klass = openapi_discriminator_mapping[discriminator_value.to_s.to_sym]
55
- return nil unless klass
34
+ # Go through the list of anyOf items and attempt to identify the appropriate one.
35
+ # Note:
36
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
37
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
38
+ # - TODO: scalar values are de facto behaving as if they were nullable.
39
+ # - TODO: logging when debugging is set.
40
+ openapi_any_of.each do |klass|
41
+ begin
42
+ next if klass == :AnyType # "nullable: true"
43
+ return find_and_cast_into_type(klass, data)
44
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
45
+ end
46
+ end
56
47
 
57
- Bandwidth.const_get(klass).build_from_hash(data)
48
+ openapi_any_of.include?(:AnyType) ? data : nil
58
49
  end
50
+
51
+ private
52
+
53
+ SchemaMismatchError = Class.new(StandardError)
54
+
55
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
56
+ def find_and_cast_into_type(klass, data)
57
+ return if data.nil?
58
+
59
+ case klass.to_s
60
+ when 'Boolean'
61
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
62
+ when 'Float'
63
+ return data if data.instance_of?(Float)
64
+ when 'Integer'
65
+ return data if data.instance_of?(Integer)
66
+ when 'Time'
67
+ return Time.parse(data)
68
+ when 'Date'
69
+ return Date.iso8601(data)
70
+ when 'String'
71
+ return data if data.instance_of?(String)
72
+ when 'Object' # "type: object"
73
+ return data if data.instance_of?(Hash)
74
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
75
+ if data.instance_of?(Array)
76
+ sub_type = Regexp.last_match[:sub_type]
77
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
78
+ end
79
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
80
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
81
+ sub_type = Regexp.last_match[:sub_type]
82
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
83
+ end
84
+ else # model
85
+ const = Bandwidth.const_get(klass)
86
+ if const
87
+ if const.respond_to?(:openapi_any_of) # nested anyOf model
88
+ model = const.build(data)
89
+ return model if model
90
+ else
91
+ # raise if data contains keys that are not known to the model
92
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
93
+ model = const.build_from_hash(data)
94
+ return model if model
95
+ end
96
+ end
97
+ end
98
+
99
+ raise # if no match by now, raise
100
+ rescue
101
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
102
+ end
59
103
  end
60
104
  end
61
105
  end
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0.0
7
7
  Contact: letstalk@bandwidth.com
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.17.0
10
10
 
11
11
  =end
12
12
 
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Bandwidth
17
- class MultiChannelActionCalendarEvent
17
+ class MultiChannelActionCalendarEvent < ApiModelBase
18
18
  attr_accessor :type
19
19
 
20
20
  # Displayed text for user to click
@@ -70,9 +70,14 @@ module Bandwidth
70
70
  }
71
71
  end
72
72
 
73
+ # Returns attribute mapping this model knows about
74
+ def self.acceptable_attribute_map
75
+ attribute_map
76
+ end
77
+
73
78
  # Returns all the JSON keys this model knows about
74
79
  def self.acceptable_attributes
75
- attribute_map.values
80
+ acceptable_attribute_map.values
76
81
  end
77
82
 
78
83
  # Attribute type mapping.
@@ -109,9 +114,10 @@ module Bandwidth
109
114
  end
110
115
 
111
116
  # check to see if the attribute exists and convert string to symbol for hash key
117
+ acceptable_attribute_map = self.class.acceptable_attribute_map
112
118
  attributes = attributes.each_with_object({}) { |(k, v), h|
113
- if (!self.class.attribute_map.key?(k.to_sym))
114
- fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MultiChannelActionCalendarEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
119
+ if (!acceptable_attribute_map.key?(k.to_sym))
120
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MultiChannelActionCalendarEvent`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
115
121
  end
116
122
  h[k.to_sym] = v
117
123
  }
@@ -222,6 +228,16 @@ module Bandwidth
222
228
  true
223
229
  end
224
230
 
231
+ # Custom attribute writer method with validation
232
+ # @param [Object] type Value to be assigned
233
+ def type=(type)
234
+ if type.nil?
235
+ fail ArgumentError, 'type cannot be nil'
236
+ end
237
+
238
+ @type = type
239
+ end
240
+
225
241
  # Custom attribute writer method with validation
226
242
  # @param [Object] text Value to be assigned
227
243
  def text=(text)
@@ -264,6 +280,26 @@ module Bandwidth
264
280
  @title = title
265
281
  end
266
282
 
283
+ # Custom attribute writer method with validation
284
+ # @param [Object] start_time Value to be assigned
285
+ def start_time=(start_time)
286
+ if start_time.nil?
287
+ fail ArgumentError, 'start_time cannot be nil'
288
+ end
289
+
290
+ @start_time = start_time
291
+ end
292
+
293
+ # Custom attribute writer method with validation
294
+ # @param [Object] end_time Value to be assigned
295
+ def end_time=(end_time)
296
+ if end_time.nil?
297
+ fail ArgumentError, 'end_time cannot be nil'
298
+ end
299
+
300
+ @end_time = end_time
301
+ end
302
+
267
303
  # Custom attribute writer method with validation
268
304
  # @param [Object] description Value to be assigned
269
305
  def description=(description)
@@ -327,61 +363,6 @@ module Bandwidth
327
363
  new(transformed_hash)
328
364
  end
329
365
 
330
- # Deserializes the data based on type
331
- # @param string type Data type
332
- # @param string value Value to be deserialized
333
- # @return [Object] Deserialized data
334
- def self._deserialize(type, value)
335
- case type.to_sym
336
- when :Time
337
- Time.parse(value)
338
- when :Date
339
- Date.parse(value)
340
- when :String
341
- value.to_s
342
- when :Integer
343
- value.to_i
344
- when :Float
345
- value.to_f
346
- when :Boolean
347
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
348
- true
349
- else
350
- false
351
- end
352
- when :Object
353
- # generic object (usually a Hash), return directly
354
- value
355
- when /\AArray<(?<inner_type>.+)>\z/
356
- inner_type = Regexp.last_match[:inner_type]
357
- value.map { |v| _deserialize(inner_type, v) }
358
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
359
- k_type = Regexp.last_match[:k_type]
360
- v_type = Regexp.last_match[:v_type]
361
- {}.tap do |hash|
362
- value.each do |k, v|
363
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
364
- end
365
- end
366
- else # model
367
- # models (e.g. Pet) or oneOf
368
- klass = Bandwidth.const_get(type)
369
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
370
- end
371
- end
372
-
373
- # Returns the string representation of the object
374
- # @return [String] String presentation of the object
375
- def to_s
376
- to_hash.to_s
377
- end
378
-
379
- # to_body is an alias to to_hash (backward compatibility)
380
- # @return [Hash] Returns the object in the form of hash
381
- def to_body
382
- to_hash
383
- end
384
-
385
366
  # Returns the object in the form of hash
386
367
  # @return [Hash] Returns the object in the form of hash
387
368
  def to_hash
@@ -397,23 +378,5 @@ module Bandwidth
397
378
  end
398
379
  hash
399
380
  end
400
-
401
- # Outputs non-array value in the form of hash
402
- # For object, use to_hash. Otherwise, just return the value
403
- # @param [Object] value Any valid value
404
- # @return [Hash] Returns the value in the form of hash
405
- def _to_hash(value)
406
- if value.is_a?(Array)
407
- value.compact.map { |v| _to_hash(v) }
408
- elsif value.is_a?(Hash)
409
- {}.tap do |hash|
410
- value.each { |k, v| hash[k] = _to_hash(v) }
411
- end
412
- elsif value.respond_to? :to_hash
413
- value.to_hash
414
- else
415
- value
416
- end
417
- end
418
381
  end
419
382
  end
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0.0
7
7
  Contact: letstalk@bandwidth.com
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.17.0
10
10
 
11
11
  =end
12
12
 
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Bandwidth
17
- class MultiChannelChannelListObject
17
+ class MultiChannelChannelListMMSObject < ApiModelBase
18
18
  # The sender ID of the message. This could be an alphanumeric sender ID.
19
19
  attr_accessor :from
20
20
 
@@ -57,9 +57,14 @@ module Bandwidth
57
57
  }
58
58
  end
59
59
 
60
+ # Returns attribute mapping this model knows about
61
+ def self.acceptable_attribute_map
62
+ attribute_map
63
+ end
64
+
60
65
  # Returns all the JSON keys this model knows about
61
66
  def self.acceptable_attributes
62
- attribute_map.values
67
+ acceptable_attribute_map.values
63
68
  end
64
69
 
65
70
  # Attribute type mapping.
@@ -68,7 +73,7 @@ module Bandwidth
68
73
  :'from' => :'String',
69
74
  :'application_id' => :'String',
70
75
  :'channel' => :'MultiChannelMessageChannelEnum',
71
- :'content' => :'MultiChannelChannelListObjectContent'
76
+ :'content' => :'MmsMessageContent'
72
77
  }
73
78
  end
74
79
 
@@ -78,17 +83,25 @@ module Bandwidth
78
83
  ])
79
84
  end
80
85
 
86
+ # List of class defined in allOf (OpenAPI v3)
87
+ def self.openapi_all_of
88
+ [
89
+ :'MultiChannelChannelListObjectBase'
90
+ ]
91
+ end
92
+
81
93
  # Initializes the object
82
94
  # @param [Hash] attributes Model attributes in the form of hash
83
95
  def initialize(attributes = {})
84
96
  if (!attributes.is_a?(Hash))
85
- fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MultiChannelChannelListObject` initialize method'
97
+ fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MultiChannelChannelListMMSObject` initialize method'
86
98
  end
87
99
 
88
100
  # check to see if the attribute exists and convert string to symbol for hash key
101
+ acceptable_attribute_map = self.class.acceptable_attribute_map
89
102
  attributes = attributes.each_with_object({}) { |(k, v), h|
90
- if (!self.class.attribute_map.key?(k.to_sym))
91
- fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MultiChannelChannelListObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
103
+ if (!acceptable_attribute_map.key?(k.to_sym))
104
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MultiChannelChannelListMMSObject`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
92
105
  end
93
106
  h[k.to_sym] = v
94
107
  }
@@ -153,6 +166,46 @@ module Bandwidth
153
166
  true
154
167
  end
155
168
 
169
+ # Custom attribute writer method with validation
170
+ # @param [Object] from Value to be assigned
171
+ def from=(from)
172
+ if from.nil?
173
+ fail ArgumentError, 'from cannot be nil'
174
+ end
175
+
176
+ @from = from
177
+ end
178
+
179
+ # Custom attribute writer method with validation
180
+ # @param [Object] application_id Value to be assigned
181
+ def application_id=(application_id)
182
+ if application_id.nil?
183
+ fail ArgumentError, 'application_id cannot be nil'
184
+ end
185
+
186
+ @application_id = application_id
187
+ end
188
+
189
+ # Custom attribute writer method with validation
190
+ # @param [Object] channel Value to be assigned
191
+ def channel=(channel)
192
+ if channel.nil?
193
+ fail ArgumentError, 'channel cannot be nil'
194
+ end
195
+
196
+ @channel = channel
197
+ end
198
+
199
+ # Custom attribute writer method with validation
200
+ # @param [Object] content Value to be assigned
201
+ def content=(content)
202
+ if content.nil?
203
+ fail ArgumentError, 'content cannot be nil'
204
+ end
205
+
206
+ @content = content
207
+ end
208
+
156
209
  # Checks equality by comparing each attribute.
157
210
  # @param [Object] Object to be compared
158
211
  def ==(o)
@@ -199,61 +252,6 @@ module Bandwidth
199
252
  new(transformed_hash)
200
253
  end
201
254
 
202
- # Deserializes the data based on type
203
- # @param string type Data type
204
- # @param string value Value to be deserialized
205
- # @return [Object] Deserialized data
206
- def self._deserialize(type, value)
207
- case type.to_sym
208
- when :Time
209
- Time.parse(value)
210
- when :Date
211
- Date.parse(value)
212
- when :String
213
- value.to_s
214
- when :Integer
215
- value.to_i
216
- when :Float
217
- value.to_f
218
- when :Boolean
219
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
220
- true
221
- else
222
- false
223
- end
224
- when :Object
225
- # generic object (usually a Hash), return directly
226
- value
227
- when /\AArray<(?<inner_type>.+)>\z/
228
- inner_type = Regexp.last_match[:inner_type]
229
- value.map { |v| _deserialize(inner_type, v) }
230
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
231
- k_type = Regexp.last_match[:k_type]
232
- v_type = Regexp.last_match[:v_type]
233
- {}.tap do |hash|
234
- value.each do |k, v|
235
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
236
- end
237
- end
238
- else # model
239
- # models (e.g. Pet) or oneOf
240
- klass = Bandwidth.const_get(type)
241
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
242
- end
243
- end
244
-
245
- # Returns the string representation of the object
246
- # @return [String] String presentation of the object
247
- def to_s
248
- to_hash.to_s
249
- end
250
-
251
- # to_body is an alias to to_hash (backward compatibility)
252
- # @return [Hash] Returns the object in the form of hash
253
- def to_body
254
- to_hash
255
- end
256
-
257
255
  # Returns the object in the form of hash
258
256
  # @return [Hash] Returns the object in the form of hash
259
257
  def to_hash
@@ -269,23 +267,5 @@ module Bandwidth
269
267
  end
270
268
  hash
271
269
  end
272
-
273
- # Outputs non-array value in the form of hash
274
- # For object, use to_hash. Otherwise, just return the value
275
- # @param [Object] value Any valid value
276
- # @return [Hash] Returns the value in the form of hash
277
- def _to_hash(value)
278
- if value.is_a?(Array)
279
- value.compact.map { |v| _to_hash(v) }
280
- elsif value.is_a?(Hash)
281
- {}.tap do |hash|
282
- value.each { |k, v| hash[k] = _to_hash(v) }
283
- end
284
- elsif value.respond_to? :to_hash
285
- value.to_hash
286
- else
287
- value
288
- end
289
- end
290
270
  end
291
271
  end