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
 
@@ -59,6 +59,16 @@ module Bandwidth
59
59
  # @return [String]
60
60
  attr_accessor :password
61
61
 
62
+ # Defines the client ID used with OAuth2.
63
+ #
64
+ # @return [String]
65
+ attr_accessor :client_id
66
+
67
+ # Defines the client secret used with OAuth2.
68
+ #
69
+ # @return [String]
70
+ attr_accessor :client_secret
71
+
62
72
  # Defines the access token (Bearer) used with OAuth2.
63
73
  attr_accessor :access_token
64
74
 
@@ -182,6 +192,32 @@ module Bandwidth
182
192
  @inject_format = false
183
193
  @force_ending_format = false
184
194
  @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
195
+ @access_token_expiration = nil
196
+ @access_token_getter = Proc.new {
197
+ access_token_valid = @access_token && (@access_token_expiration.nil? || @access_token_expiration > Time.now + 60)
198
+ next @access_token if access_token_valid
199
+ next unless @client_id && @client_secret
200
+
201
+ puts "Refreshing access token..." if @debugging
202
+ # obtain new access token using client credentials
203
+ token_url = 'https://api.bandwidth.com/api/v1/oauth2/token'
204
+ auth_header = 'Basic ' + ["#{@client_id}:#{@client_secret}"].pack('m').delete("\r\n")
205
+ conn = Faraday.new(url: token_url) do |faraday|
206
+ faraday.request :url_encoded
207
+ faraday.adapter Faraday.default_adapter
208
+ end
209
+ response = conn.post do |req|
210
+ req.headers['Authorization'] = auth_header
211
+ req.headers['Content-Type'] = 'application/x-www-form-urlencoded'
212
+ req.body = 'grant_type=client_credentials'
213
+ end
214
+ if response.status != 200
215
+ raise "Failed to obtain access token: #{response.status} #{response.body}"
216
+ end
217
+ body = JSON.parse(response.body)
218
+ @access_token = body['access_token']
219
+ @access_token_expiration = Time.now + body['expires_in']
220
+ }
185
221
 
186
222
  yield(self) if block_given?
187
223
  end
@@ -245,6 +281,12 @@ module Bandwidth
245
281
  'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
246
282
  end
247
283
 
284
+ # Gets Bearer auth token string
285
+ def oauth_bearer_token
286
+ "Bearer #{access_token_with_refresh}" unless access_token_with_refresh.nil?
287
+ end
288
+
289
+
248
290
  # Returns Auth Settings hash for api client.
249
291
  def auth_settings
250
292
  {
@@ -255,6 +297,13 @@ module Bandwidth
255
297
  key: 'Authorization',
256
298
  value: basic_auth_token
257
299
  },
300
+ 'OAuth2' =>
301
+ {
302
+ type: 'oauth2',
303
+ in: 'header',
304
+ key: 'Authorization',
305
+ value: oauth_bearer_token
306
+ },
258
307
  }
259
308
  end
260
309
 
@@ -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 AccountStatistics
17
+ class AccountStatistics < ApiModelBase
18
18
  # The number of calls currently enqueued.
19
19
  attr_accessor :current_call_queue_size
20
20
 
@@ -29,9 +29,14 @@ module Bandwidth
29
29
  }
30
30
  end
31
31
 
32
+ # Returns attribute mapping this model knows about
33
+ def self.acceptable_attribute_map
34
+ attribute_map
35
+ end
36
+
32
37
  # Returns all the JSON keys this model knows about
33
38
  def self.acceptable_attributes
34
- attribute_map.values
39
+ acceptable_attribute_map.values
35
40
  end
36
41
 
37
42
  # Attribute type mapping.
@@ -56,9 +61,10 @@ module Bandwidth
56
61
  end
57
62
 
58
63
  # check to see if the attribute exists and convert string to symbol for hash key
64
+ acceptable_attribute_map = self.class.acceptable_attribute_map
59
65
  attributes = attributes.each_with_object({}) { |(k, v), h|
60
- if (!self.class.attribute_map.key?(k.to_sym))
61
- fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::AccountStatistics`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
+ if (!acceptable_attribute_map.key?(k.to_sym))
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::AccountStatistics`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
62
68
  end
63
69
  h[k.to_sym] = v
64
70
  }
@@ -131,61 +137,6 @@ module Bandwidth
131
137
  new(transformed_hash)
132
138
  end
133
139
 
134
- # Deserializes the data based on type
135
- # @param string type Data type
136
- # @param string value Value to be deserialized
137
- # @return [Object] Deserialized data
138
- def self._deserialize(type, value)
139
- case type.to_sym
140
- when :Time
141
- Time.parse(value)
142
- when :Date
143
- Date.parse(value)
144
- when :String
145
- value.to_s
146
- when :Integer
147
- value.to_i
148
- when :Float
149
- value.to_f
150
- when :Boolean
151
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
152
- true
153
- else
154
- false
155
- end
156
- when :Object
157
- # generic object (usually a Hash), return directly
158
- value
159
- when /\AArray<(?<inner_type>.+)>\z/
160
- inner_type = Regexp.last_match[:inner_type]
161
- value.map { |v| _deserialize(inner_type, v) }
162
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
163
- k_type = Regexp.last_match[:k_type]
164
- v_type = Regexp.last_match[:v_type]
165
- {}.tap do |hash|
166
- value.each do |k, v|
167
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
168
- end
169
- end
170
- else # model
171
- # models (e.g. Pet) or oneOf
172
- klass = Bandwidth.const_get(type)
173
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
174
- end
175
- end
176
-
177
- # Returns the string representation of the object
178
- # @return [String] String presentation of the object
179
- def to_s
180
- to_hash.to_s
181
- end
182
-
183
- # to_body is an alias to to_hash (backward compatibility)
184
- # @return [Hash] Returns the object in the form of hash
185
- def to_body
186
- to_hash
187
- end
188
-
189
140
  # Returns the object in the form of hash
190
141
  # @return [Hash] Returns the object in the form of hash
191
142
  def to_hash
@@ -201,23 +152,5 @@ module Bandwidth
201
152
  end
202
153
  hash
203
154
  end
204
-
205
- # Outputs non-array value in the form of hash
206
- # For object, use to_hash. Otherwise, just return the value
207
- # @param [Object] value Any valid value
208
- # @return [Hash] Returns the value in the form of hash
209
- def _to_hash(value)
210
- if value.is_a?(Array)
211
- value.compact.map { |v| _to_hash(v) }
212
- elsif value.is_a?(Hash)
213
- {}.tap do |hash|
214
- value.each { |k, v| hash[k] = _to_hash(v) }
215
- end
216
- elsif value.respond_to? :to_hash
217
- value.to_hash
218
- else
219
- value
220
- end
221
- end
222
155
  end
223
156
  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 AdditionalDenialReason
17
+ class AdditionalDenialReason < ApiModelBase
18
18
  # Reason code for denial.
19
19
  attr_accessor :status_code
20
20
 
@@ -33,9 +33,14 @@ module Bandwidth
33
33
  }
34
34
  end
35
35
 
36
+ # Returns attribute mapping this model knows about
37
+ def self.acceptable_attribute_map
38
+ attribute_map
39
+ end
40
+
36
41
  # Returns all the JSON keys this model knows about
37
42
  def self.acceptable_attributes
38
- attribute_map.values
43
+ acceptable_attribute_map.values
39
44
  end
40
45
 
41
46
  # Attribute type mapping.
@@ -61,9 +66,10 @@ module Bandwidth
61
66
  end
62
67
 
63
68
  # check to see if the attribute exists and convert string to symbol for hash key
69
+ acceptable_attribute_map = self.class.acceptable_attribute_map
64
70
  attributes = attributes.each_with_object({}) { |(k, v), h|
65
- if (!self.class.attribute_map.key?(k.to_sym))
66
- fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::AdditionalDenialReason`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
71
+ if (!acceptable_attribute_map.key?(k.to_sym))
72
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::AdditionalDenialReason`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
67
73
  end
68
74
  h[k.to_sym] = v
69
75
  }
@@ -117,6 +123,36 @@ module Bandwidth
117
123
  true
118
124
  end
119
125
 
126
+ # Custom attribute writer method with validation
127
+ # @param [Object] status_code Value to be assigned
128
+ def status_code=(status_code)
129
+ if status_code.nil?
130
+ fail ArgumentError, 'status_code cannot be nil'
131
+ end
132
+
133
+ @status_code = status_code
134
+ end
135
+
136
+ # Custom attribute writer method with validation
137
+ # @param [Object] reason Value to be assigned
138
+ def reason=(reason)
139
+ if reason.nil?
140
+ fail ArgumentError, 'reason cannot be nil'
141
+ end
142
+
143
+ @reason = reason
144
+ end
145
+
146
+ # Custom attribute writer method with validation
147
+ # @param [Object] resubmit_allowed Value to be assigned
148
+ def resubmit_allowed=(resubmit_allowed)
149
+ if resubmit_allowed.nil?
150
+ fail ArgumentError, 'resubmit_allowed cannot be nil'
151
+ end
152
+
153
+ @resubmit_allowed = resubmit_allowed
154
+ end
155
+
120
156
  # Checks equality by comparing each attribute.
121
157
  # @param [Object] Object to be compared
122
158
  def ==(o)
@@ -162,61 +198,6 @@ module Bandwidth
162
198
  new(transformed_hash)
163
199
  end
164
200
 
165
- # Deserializes the data based on type
166
- # @param string type Data type
167
- # @param string value Value to be deserialized
168
- # @return [Object] Deserialized data
169
- def self._deserialize(type, value)
170
- case type.to_sym
171
- when :Time
172
- Time.parse(value)
173
- when :Date
174
- Date.parse(value)
175
- when :String
176
- value.to_s
177
- when :Integer
178
- value.to_i
179
- when :Float
180
- value.to_f
181
- when :Boolean
182
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
183
- true
184
- else
185
- false
186
- end
187
- when :Object
188
- # generic object (usually a Hash), return directly
189
- value
190
- when /\AArray<(?<inner_type>.+)>\z/
191
- inner_type = Regexp.last_match[:inner_type]
192
- value.map { |v| _deserialize(inner_type, v) }
193
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
194
- k_type = Regexp.last_match[:k_type]
195
- v_type = Regexp.last_match[:v_type]
196
- {}.tap do |hash|
197
- value.each do |k, v|
198
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
199
- end
200
- end
201
- else # model
202
- # models (e.g. Pet) or oneOf
203
- klass = Bandwidth.const_get(type)
204
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
205
- end
206
- end
207
-
208
- # Returns the string representation of the object
209
- # @return [String] String presentation of the object
210
- def to_s
211
- to_hash.to_s
212
- end
213
-
214
- # to_body is an alias to to_hash (backward compatibility)
215
- # @return [Hash] Returns the object in the form of hash
216
- def to_body
217
- to_hash
218
- end
219
-
220
201
  # Returns the object in the form of hash
221
202
  # @return [Hash] Returns the object in the form of hash
222
203
  def to_hash
@@ -232,23 +213,5 @@ module Bandwidth
232
213
  end
233
214
  hash
234
215
  end
235
-
236
- # Outputs non-array value in the form of hash
237
- # For object, use to_hash. Otherwise, just return the value
238
- # @param [Object] value Any valid value
239
- # @return [Hash] Returns the value in the form of hash
240
- def _to_hash(value)
241
- if value.is_a?(Array)
242
- value.compact.map { |v| _to_hash(v) }
243
- elsif value.is_a?(Hash)
244
- {}.tap do |hash|
245
- value.each { |k, v| hash[k] = _to_hash(v) }
246
- end
247
- elsif value.respond_to? :to_hash
248
- value.to_hash
249
- else
250
- value
251
- end
252
- end
253
216
  end
254
217
  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 Address
17
+ class Address < ApiModelBase
18
18
  # The name of the business using the toll-free number.
19
19
  attr_accessor :name
20
20
 
@@ -49,9 +49,14 @@ module Bandwidth
49
49
  }
50
50
  end
51
51
 
52
+ # Returns attribute mapping this model knows about
53
+ def self.acceptable_attribute_map
54
+ attribute_map
55
+ end
56
+
52
57
  # Returns all the JSON keys this model knows about
53
58
  def self.acceptable_attributes
54
- attribute_map.values
59
+ acceptable_attribute_map.values
55
60
  end
56
61
 
57
62
  # Attribute type mapping.
@@ -82,9 +87,10 @@ module Bandwidth
82
87
  end
83
88
 
84
89
  # check to see if the attribute exists and convert string to symbol for hash key
90
+ acceptable_attribute_map = self.class.acceptable_attribute_map
85
91
  attributes = attributes.each_with_object({}) { |(k, v), h|
86
- if (!self.class.attribute_map.key?(k.to_sym))
87
- fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::Address`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
92
+ if (!acceptable_attribute_map.key?(k.to_sym))
93
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::Address`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
88
94
  end
89
95
  h[k.to_sym] = v
90
96
  }
@@ -144,7 +150,7 @@ module Bandwidth
144
150
  end
145
151
 
146
152
  if @name.to_s.length < 1
147
- invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
153
+ invalid_properties.push('invalid value for "name", the character length must be greater than or equal to 1.')
148
154
  end
149
155
 
150
156
  if @addr1.nil?
@@ -156,7 +162,7 @@ module Bandwidth
156
162
  end
157
163
 
158
164
  if @addr1.to_s.length < 1
159
- invalid_properties.push('invalid value for "addr1", the character length must be great than or equal to 1.')
165
+ invalid_properties.push('invalid value for "addr1", the character length must be greater than or equal to 1.')
160
166
  end
161
167
 
162
168
  if !@addr2.nil? && @addr2.to_s.length > 500
@@ -164,7 +170,7 @@ module Bandwidth
164
170
  end
165
171
 
166
172
  if !@addr2.nil? && @addr2.to_s.length < 0
167
- invalid_properties.push('invalid value for "addr2", the character length must be great than or equal to 0.')
173
+ invalid_properties.push('invalid value for "addr2", the character length must be greater than or equal to 0.')
168
174
  end
169
175
 
170
176
  if @city.nil?
@@ -176,7 +182,7 @@ module Bandwidth
176
182
  end
177
183
 
178
184
  if @city.to_s.length < 1
179
- invalid_properties.push('invalid value for "city", the character length must be great than or equal to 1.')
185
+ invalid_properties.push('invalid value for "city", the character length must be greater than or equal to 1.')
180
186
  end
181
187
 
182
188
  if @state.nil?
@@ -188,7 +194,7 @@ module Bandwidth
188
194
  end
189
195
 
190
196
  if @state.to_s.length < 1
191
- invalid_properties.push('invalid value for "state", the character length must be great than or equal to 1.')
197
+ invalid_properties.push('invalid value for "state", the character length must be greater than or equal to 1.')
192
198
  end
193
199
 
194
200
  if @zip.nil?
@@ -209,7 +215,7 @@ module Bandwidth
209
215
  end
210
216
 
211
217
  if @url.to_s.length < 1
212
- invalid_properties.push('invalid value for "url", the character length must be great than or equal to 1.')
218
+ invalid_properties.push('invalid value for "url", the character length must be greater than or equal to 1.')
213
219
  end
214
220
 
215
221
  invalid_properties
@@ -253,7 +259,7 @@ module Bandwidth
253
259
  end
254
260
 
255
261
  if name.to_s.length < 1
256
- fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
262
+ fail ArgumentError, 'invalid value for "name", the character length must be greater than or equal to 1.'
257
263
  end
258
264
 
259
265
  @name = name
@@ -271,7 +277,7 @@ module Bandwidth
271
277
  end
272
278
 
273
279
  if addr1.to_s.length < 1
274
- fail ArgumentError, 'invalid value for "addr1", the character length must be great than or equal to 1.'
280
+ fail ArgumentError, 'invalid value for "addr1", the character length must be greater than or equal to 1.'
275
281
  end
276
282
 
277
283
  @addr1 = addr1
@@ -285,7 +291,7 @@ module Bandwidth
285
291
  end
286
292
 
287
293
  if !addr2.nil? && addr2.to_s.length < 0
288
- fail ArgumentError, 'invalid value for "addr2", the character length must be great than or equal to 0.'
294
+ fail ArgumentError, 'invalid value for "addr2", the character length must be greater than or equal to 0.'
289
295
  end
290
296
 
291
297
  @addr2 = addr2
@@ -303,7 +309,7 @@ module Bandwidth
303
309
  end
304
310
 
305
311
  if city.to_s.length < 1
306
- fail ArgumentError, 'invalid value for "city", the character length must be great than or equal to 1.'
312
+ fail ArgumentError, 'invalid value for "city", the character length must be greater than or equal to 1.'
307
313
  end
308
314
 
309
315
  @city = city
@@ -321,7 +327,7 @@ module Bandwidth
321
327
  end
322
328
 
323
329
  if state.to_s.length < 1
324
- fail ArgumentError, 'invalid value for "state", the character length must be great than or equal to 1.'
330
+ fail ArgumentError, 'invalid value for "state", the character length must be greater than or equal to 1.'
325
331
  end
326
332
 
327
333
  @state = state
@@ -354,7 +360,7 @@ module Bandwidth
354
360
  end
355
361
 
356
362
  if url.to_s.length < 1
357
- fail ArgumentError, 'invalid value for "url", the character length must be great than or equal to 1.'
363
+ fail ArgumentError, 'invalid value for "url", the character length must be greater than or equal to 1.'
358
364
  end
359
365
 
360
366
  @url = url
@@ -409,61 +415,6 @@ module Bandwidth
409
415
  new(transformed_hash)
410
416
  end
411
417
 
412
- # Deserializes the data based on type
413
- # @param string type Data type
414
- # @param string value Value to be deserialized
415
- # @return [Object] Deserialized data
416
- def self._deserialize(type, value)
417
- case type.to_sym
418
- when :Time
419
- Time.parse(value)
420
- when :Date
421
- Date.parse(value)
422
- when :String
423
- value.to_s
424
- when :Integer
425
- value.to_i
426
- when :Float
427
- value.to_f
428
- when :Boolean
429
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
430
- true
431
- else
432
- false
433
- end
434
- when :Object
435
- # generic object (usually a Hash), return directly
436
- value
437
- when /\AArray<(?<inner_type>.+)>\z/
438
- inner_type = Regexp.last_match[:inner_type]
439
- value.map { |v| _deserialize(inner_type, v) }
440
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
441
- k_type = Regexp.last_match[:k_type]
442
- v_type = Regexp.last_match[:v_type]
443
- {}.tap do |hash|
444
- value.each do |k, v|
445
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
446
- end
447
- end
448
- else # model
449
- # models (e.g. Pet) or oneOf
450
- klass = Bandwidth.const_get(type)
451
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
452
- end
453
- end
454
-
455
- # Returns the string representation of the object
456
- # @return [String] String presentation of the object
457
- def to_s
458
- to_hash.to_s
459
- end
460
-
461
- # to_body is an alias to to_hash (backward compatibility)
462
- # @return [Hash] Returns the object in the form of hash
463
- def to_body
464
- to_hash
465
- end
466
-
467
418
  # Returns the object in the form of hash
468
419
  # @return [Hash] Returns the object in the form of hash
469
420
  def to_hash
@@ -479,23 +430,5 @@ module Bandwidth
479
430
  end
480
431
  hash
481
432
  end
482
-
483
- # Outputs non-array value in the form of hash
484
- # For object, use to_hash. Otherwise, just return the value
485
- # @param [Object] value Any valid value
486
- # @return [Hash] Returns the value in the form of hash
487
- def _to_hash(value)
488
- if value.is_a?(Array)
489
- value.compact.map { |v| _to_hash(v) }
490
- elsif value.is_a?(Hash)
491
- {}.tap do |hash|
492
- value.each { |k, v| hash[k] = _to_hash(v) }
493
- end
494
- elsif value.respond_to? :to_hash
495
- value.to_hash
496
- else
497
- value
498
- end
499
- end
500
433
  end
501
434
  end