bandwidth-sdk 7.1.0 → 9.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +10 -0
  3. data/lib/bandwidth/api_helper.rb +20 -17
  4. data/lib/bandwidth/configuration.rb +7 -19
  5. data/lib/bandwidth/http/faraday_client.rb +1 -1
  6. data/lib/bandwidth/messaging_lib/messaging/controllers/api_controller.rb +53 -42
  7. data/lib/bandwidth/messaging_lib/messaging/controllers/base_controller.rb +3 -5
  8. data/lib/bandwidth/messaging_lib/messaging/exceptions/messaging_exception.rb +5 -2
  9. data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_callback_message.rb +31 -11
  10. data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb +54 -25
  11. data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_message_item.rb +65 -32
  12. data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_messages_list.rb +23 -4
  13. data/lib/bandwidth/messaging_lib/messaging/models/deferred_result.rb +20 -4
  14. data/lib/bandwidth/messaging_lib/messaging/models/media.rb +23 -6
  15. data/lib/bandwidth/messaging_lib/messaging/models/message_request.rb +32 -14
  16. data/lib/bandwidth/messaging_lib/messaging/models/page_info.rb +28 -8
  17. data/lib/bandwidth/messaging_lib/messaging/models/tag.rb +20 -4
  18. data/lib/bandwidth/models/base_model.rb +11 -0
  19. data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/controllers/base_controller.rb +3 -5
  20. data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/controllers/mfa_controller.rb +21 -16
  21. data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/exceptions/error_with_request_exception.rb +5 -2
  22. data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/exceptions/forbidden_request_exception.rb +4 -1
  23. data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/exceptions/unauthorized_request_exception.rb +4 -1
  24. data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_code_request_schema.rb +27 -12
  25. data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_messaging_response.rb +17 -2
  26. data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_verify_code_response.rb +17 -2
  27. data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_verify_request_schema.rb +29 -10
  28. data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_voice_response.rb +17 -2
  29. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/controllers/api_controller.rb +212 -210
  30. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/controllers/base_controller.rb +3 -5
  31. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/exceptions/accounts_tnlookup400_error_exception.rb +4 -1
  32. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_request.rb +17 -2
  33. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_response.rb +20 -4
  34. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_status.rb +28 -7
  35. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/result.rb +43 -18
  36. data/lib/bandwidth/utilities/date_time_helper.rb +2 -2
  37. data/lib/bandwidth/utilities/file_wrapper.rb +1 -2
  38. data/lib/bandwidth/voice_lib/bxml/verbs/ring.rb +2 -1
  39. data/lib/bandwidth/voice_lib/voice/controllers/api_controller.rb +173 -161
  40. data/lib/bandwidth/voice_lib/voice/controllers/base_controller.rb +3 -5
  41. data/lib/bandwidth/voice_lib/voice/exceptions/api_error_exception.rb +6 -3
  42. data/lib/bandwidth/voice_lib/voice/models/call_callback.rb +343 -0
  43. data/lib/bandwidth/voice_lib/voice/models/call_recording_metadata.rb +78 -37
  44. data/lib/bandwidth/voice_lib/voice/models/call_state.rb +94 -42
  45. data/lib/bandwidth/voice_lib/voice/models/conference_callback.rb +211 -0
  46. data/lib/bandwidth/voice_lib/voice/models/conference_member_state.rb +35 -12
  47. data/lib/bandwidth/voice_lib/voice/models/conference_recording_metadata.rb +55 -24
  48. data/lib/bandwidth/voice_lib/voice/models/conference_state.rb +54 -17
  49. data/lib/bandwidth/voice_lib/voice/models/create_call_request.rb +173 -96
  50. data/lib/bandwidth/voice_lib/voice/models/create_call_response.rb +85 -41
  51. data/lib/bandwidth/voice_lib/voice/models/diversion.rb +80 -0
  52. data/lib/bandwidth/voice_lib/voice/models/fallback_method_enum.rb +17 -0
  53. data/lib/bandwidth/voice_lib/voice/models/machine_detection_configuration.rb +218 -0
  54. data/lib/bandwidth/voice_lib/voice/models/mode_enum.rb +20 -0
  55. data/lib/bandwidth/voice_lib/voice/models/modify_call_recording_request.rb +15 -2
  56. data/lib/bandwidth/voice_lib/voice/models/modify_call_request.rb +59 -19
  57. data/lib/bandwidth/voice_lib/voice/models/modify_conference_request.rb +55 -18
  58. data/lib/bandwidth/voice_lib/voice/models/transcribe_recording_request.rb +40 -12
  59. data/lib/bandwidth/voice_lib/voice/models/transcript.rb +20 -4
  60. data/lib/bandwidth/voice_lib/voice/models/transcription.rb +80 -0
  61. data/lib/bandwidth/voice_lib/voice/models/transcription_metadata.rb +26 -8
  62. data/lib/bandwidth/voice_lib/voice/models/transcription_response.rb +18 -1
  63. data/lib/bandwidth/voice_lib/voice.rb +7 -1
  64. data/lib/bandwidth/web_rtc_lib/utils/web_rtc_transfer.rb +5 -4
  65. data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/api_controller.rb +61 -50
  66. data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/base_controller.rb +3 -5
  67. data/lib/bandwidth/web_rtc_lib/web_rtc/exceptions/error_exception.rb +5 -2
  68. data/lib/bandwidth/web_rtc_lib/web_rtc/models/accounts_participants_response.rb +20 -5
  69. data/lib/bandwidth/web_rtc_lib/web_rtc/models/participant.rb +37 -14
  70. data/lib/bandwidth/web_rtc_lib/web_rtc/models/participant_subscription.rb +15 -2
  71. data/lib/bandwidth/web_rtc_lib/web_rtc/models/session.rb +20 -4
  72. data/lib/bandwidth/web_rtc_lib/web_rtc/models/subscriptions.rb +20 -3
  73. data/lib/bandwidth.rb +19 -18
  74. data/test/integration/test_integration.rb +110 -62
  75. metadata +13 -6
@@ -6,6 +6,9 @@
6
6
  module Bandwidth
7
7
  # CreateCallRequest Model.
8
8
  class CreateCallRequest < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
9
12
  # Format is E164
10
13
  # @return [String]
11
14
  attr_accessor :from
@@ -14,111 +17,134 @@ module Bandwidth
14
17
  # @return [String]
15
18
  attr_accessor :to
16
19
 
17
- # When calling a SIP URI, this will be sent as the 'User-To-User' header
18
- # within the initial INVITE. It must end with an 'encoding' parameter as
19
- # described in https://tools.ietf.org/html/rfc7433. This header cannot
20
- # exceed 256 characters, including the encoding parameter.
20
+ # A comma-separated list of 'User-To-User' headers to be sent in the INVITE
21
+ # when calling a SIP URI. Each value must end with an 'encoding' parameter
22
+ # as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
23
+ # 'base64' encodings are allowed. The entire value cannot exceed 350
24
+ # characters, including parameters and separators.
21
25
  # @return [String]
22
26
  attr_accessor :uui
23
27
 
24
- # When calling a SIP URI, this will be sent as the 'User-To-User' header
25
- # within the initial INVITE. It must end with an 'encoding' parameter as
26
- # described in https://tools.ietf.org/html/rfc7433. This header cannot
27
- # exceed 256 characters, including the encoding parameter.
28
+ # A comma-separated list of 'User-To-User' headers to be sent in the INVITE
29
+ # when calling a SIP URI. Each value must end with an 'encoding' parameter
30
+ # as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
31
+ # 'base64' encodings are allowed. The entire value cannot exceed 350
32
+ # characters, including parameters and separators.
28
33
  # @return [Float]
29
34
  attr_accessor :call_timeout
30
35
 
31
- # When calling a SIP URI, this will be sent as the 'User-To-User' header
32
- # within the initial INVITE. It must end with an 'encoding' parameter as
33
- # described in https://tools.ietf.org/html/rfc7433. This header cannot
34
- # exceed 256 characters, including the encoding parameter.
36
+ # A comma-separated list of 'User-To-User' headers to be sent in the INVITE
37
+ # when calling a SIP URI. Each value must end with an 'encoding' parameter
38
+ # as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
39
+ # 'base64' encodings are allowed. The entire value cannot exceed 350
40
+ # characters, including parameters and separators.
35
41
  # @return [Float]
36
42
  attr_accessor :callback_timeout
37
43
 
38
- # When calling a SIP URI, this will be sent as the 'User-To-User' header
39
- # within the initial INVITE. It must end with an 'encoding' parameter as
40
- # described in https://tools.ietf.org/html/rfc7433. This header cannot
41
- # exceed 256 characters, including the encoding parameter.
44
+ # A comma-separated list of 'User-To-User' headers to be sent in the INVITE
45
+ # when calling a SIP URI. Each value must end with an 'encoding' parameter
46
+ # as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
47
+ # 'base64' encodings are allowed. The entire value cannot exceed 350
48
+ # characters, including parameters and separators.
42
49
  # @return [String]
43
50
  attr_accessor :answer_url
44
51
 
45
- # When calling a SIP URI, this will be sent as the 'User-To-User' header
46
- # within the initial INVITE. It must end with an 'encoding' parameter as
47
- # described in https://tools.ietf.org/html/rfc7433. This header cannot
48
- # exceed 256 characters, including the encoding parameter.
52
+ # A comma-separated list of 'User-To-User' headers to be sent in the INVITE
53
+ # when calling a SIP URI. Each value must end with an 'encoding' parameter
54
+ # as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
55
+ # 'base64' encodings are allowed. The entire value cannot exceed 350
56
+ # characters, including parameters and separators.
49
57
  # @return [String]
50
58
  attr_accessor :answer_fallback_url
51
59
 
52
- # When calling a SIP URI, this will be sent as the 'User-To-User' header
53
- # within the initial INVITE. It must end with an 'encoding' parameter as
54
- # described in https://tools.ietf.org/html/rfc7433. This header cannot
55
- # exceed 256 characters, including the encoding parameter.
60
+ # A comma-separated list of 'User-To-User' headers to be sent in the INVITE
61
+ # when calling a SIP URI. Each value must end with an 'encoding' parameter
62
+ # as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
63
+ # 'base64' encodings are allowed. The entire value cannot exceed 350
64
+ # characters, including parameters and separators.
56
65
  # @return [String]
57
66
  attr_accessor :username
58
67
 
59
- # When calling a SIP URI, this will be sent as the 'User-To-User' header
60
- # within the initial INVITE. It must end with an 'encoding' parameter as
61
- # described in https://tools.ietf.org/html/rfc7433. This header cannot
62
- # exceed 256 characters, including the encoding parameter.
68
+ # A comma-separated list of 'User-To-User' headers to be sent in the INVITE
69
+ # when calling a SIP URI. Each value must end with an 'encoding' parameter
70
+ # as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
71
+ # 'base64' encodings are allowed. The entire value cannot exceed 350
72
+ # characters, including parameters and separators.
63
73
  # @return [String]
64
74
  attr_accessor :password
65
75
 
66
- # When calling a SIP URI, this will be sent as the 'User-To-User' header
67
- # within the initial INVITE. It must end with an 'encoding' parameter as
68
- # described in https://tools.ietf.org/html/rfc7433. This header cannot
69
- # exceed 256 characters, including the encoding parameter.
76
+ # A comma-separated list of 'User-To-User' headers to be sent in the INVITE
77
+ # when calling a SIP URI. Each value must end with an 'encoding' parameter
78
+ # as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
79
+ # 'base64' encodings are allowed. The entire value cannot exceed 350
80
+ # characters, including parameters and separators.
70
81
  # @return [String]
71
82
  attr_accessor :fallback_username
72
83
 
73
- # When calling a SIP URI, this will be sent as the 'User-To-User' header
74
- # within the initial INVITE. It must end with an 'encoding' parameter as
75
- # described in https://tools.ietf.org/html/rfc7433. This header cannot
76
- # exceed 256 characters, including the encoding parameter.
84
+ # A comma-separated list of 'User-To-User' headers to be sent in the INVITE
85
+ # when calling a SIP URI. Each value must end with an 'encoding' parameter
86
+ # as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
87
+ # 'base64' encodings are allowed. The entire value cannot exceed 350
88
+ # characters, including parameters and separators.
77
89
  # @return [String]
78
90
  attr_accessor :fallback_password
79
91
 
80
- # When calling a SIP URI, this will be sent as the 'User-To-User' header
81
- # within the initial INVITE. It must end with an 'encoding' parameter as
82
- # described in https://tools.ietf.org/html/rfc7433. This header cannot
83
- # exceed 256 characters, including the encoding parameter.
92
+ # A comma-separated list of 'User-To-User' headers to be sent in the INVITE
93
+ # when calling a SIP URI. Each value must end with an 'encoding' parameter
94
+ # as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
95
+ # 'base64' encodings are allowed. The entire value cannot exceed 350
96
+ # characters, including parameters and separators.
84
97
  # @return [AnswerMethodEnum]
85
98
  attr_accessor :answer_method
86
99
 
87
- # When calling a SIP URI, this will be sent as the 'User-To-User' header
88
- # within the initial INVITE. It must end with an 'encoding' parameter as
89
- # described in https://tools.ietf.org/html/rfc7433. This header cannot
90
- # exceed 256 characters, including the encoding parameter.
100
+ # A comma-separated list of 'User-To-User' headers to be sent in the INVITE
101
+ # when calling a SIP URI. Each value must end with an 'encoding' parameter
102
+ # as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
103
+ # 'base64' encodings are allowed. The entire value cannot exceed 350
104
+ # characters, including parameters and separators.
91
105
  # @return [AnswerFallbackMethodEnum]
92
106
  attr_accessor :answer_fallback_method
93
107
 
94
- # When calling a SIP URI, this will be sent as the 'User-To-User' header
95
- # within the initial INVITE. It must end with an 'encoding' parameter as
96
- # described in https://tools.ietf.org/html/rfc7433. This header cannot
97
- # exceed 256 characters, including the encoding parameter.
108
+ # A comma-separated list of 'User-To-User' headers to be sent in the INVITE
109
+ # when calling a SIP URI. Each value must end with an 'encoding' parameter
110
+ # as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
111
+ # 'base64' encodings are allowed. The entire value cannot exceed 350
112
+ # characters, including parameters and separators.
98
113
  # @return [String]
99
114
  attr_accessor :disconnect_url
100
115
 
101
- # When calling a SIP URI, this will be sent as the 'User-To-User' header
102
- # within the initial INVITE. It must end with an 'encoding' parameter as
103
- # described in https://tools.ietf.org/html/rfc7433. This header cannot
104
- # exceed 256 characters, including the encoding parameter.
116
+ # A comma-separated list of 'User-To-User' headers to be sent in the INVITE
117
+ # when calling a SIP URI. Each value must end with an 'encoding' parameter
118
+ # as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
119
+ # 'base64' encodings are allowed. The entire value cannot exceed 350
120
+ # characters, including parameters and separators.
105
121
  # @return [DisconnectMethodEnum]
106
122
  attr_accessor :disconnect_method
107
123
 
108
- # When calling a SIP URI, this will be sent as the 'User-To-User' header
109
- # within the initial INVITE. It must end with an 'encoding' parameter as
110
- # described in https://tools.ietf.org/html/rfc7433. This header cannot
111
- # exceed 256 characters, including the encoding parameter.
124
+ # A comma-separated list of 'User-To-User' headers to be sent in the INVITE
125
+ # when calling a SIP URI. Each value must end with an 'encoding' parameter
126
+ # as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
127
+ # 'base64' encodings are allowed. The entire value cannot exceed 350
128
+ # characters, including parameters and separators.
112
129
  # @return [String]
113
130
  attr_accessor :tag
114
131
 
115
- # When calling a SIP URI, this will be sent as the 'User-To-User' header
116
- # within the initial INVITE. It must end with an 'encoding' parameter as
117
- # described in https://tools.ietf.org/html/rfc7433. This header cannot
118
- # exceed 256 characters, including the encoding parameter.
132
+ # A comma-separated list of 'User-To-User' headers to be sent in the INVITE
133
+ # when calling a SIP URI. Each value must end with an 'encoding' parameter
134
+ # as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
135
+ # 'base64' encodings are allowed. The entire value cannot exceed 350
136
+ # characters, including parameters and separators.
119
137
  # @return [String]
120
138
  attr_accessor :application_id
121
139
 
140
+ # A comma-separated list of 'User-To-User' headers to be sent in the INVITE
141
+ # when calling a SIP URI. Each value must end with an 'encoding' parameter
142
+ # as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
143
+ # 'base64' encodings are allowed. The entire value cannot exceed 350
144
+ # characters, including parameters and separators.
145
+ # @return [MachineDetectionRequest]
146
+ attr_accessor :machine_detection
147
+
122
148
  # A mapping from model property names to API property names.
123
149
  def self.names
124
150
  @_hash = {} if @_hash.nil?
@@ -139,9 +165,49 @@ module Bandwidth
139
165
  @_hash['disconnect_method'] = 'disconnectMethod'
140
166
  @_hash['tag'] = 'tag'
141
167
  @_hash['application_id'] = 'applicationId'
168
+ @_hash['machine_detection'] = 'machineDetection'
142
169
  @_hash
143
170
  end
144
171
 
172
+ # An array for optional fields
173
+ def optionals
174
+ %w[
175
+ uui
176
+ call_timeout
177
+ callback_timeout
178
+ answer_fallback_url
179
+ username
180
+ password
181
+ fallback_username
182
+ fallback_password
183
+ answer_method
184
+ answer_fallback_method
185
+ disconnect_url
186
+ disconnect_method
187
+ tag
188
+ machine_detection
189
+ ]
190
+ end
191
+
192
+ # An array for nullable fields
193
+ def nullables
194
+ %w[
195
+ uui
196
+ call_timeout
197
+ callback_timeout
198
+ answer_fallback_url
199
+ username
200
+ password
201
+ fallback_username
202
+ fallback_password
203
+ answer_method
204
+ answer_fallback_method
205
+ disconnect_url
206
+ disconnect_method
207
+ tag
208
+ ]
209
+ end
210
+
145
211
  def initialize(from = nil,
146
212
  to = nil,
147
213
  answer_url = nil,
@@ -158,24 +224,26 @@ module Bandwidth
158
224
  answer_fallback_method = nil,
159
225
  disconnect_url = nil,
160
226
  disconnect_method = nil,
161
- tag = nil)
162
- @from = from
163
- @to = to
164
- @uui = uui
165
- @call_timeout = call_timeout
166
- @callback_timeout = callback_timeout
167
- @answer_url = answer_url
168
- @answer_fallback_url = answer_fallback_url
169
- @username = username
170
- @password = password
171
- @fallback_username = fallback_username
172
- @fallback_password = fallback_password
173
- @answer_method = answer_method
174
- @answer_fallback_method = answer_fallback_method
175
- @disconnect_url = disconnect_url
176
- @disconnect_method = disconnect_method
177
- @tag = tag
178
- @application_id = application_id
227
+ tag = nil,
228
+ machine_detection = nil)
229
+ @from = from unless from == SKIP
230
+ @to = to unless to == SKIP
231
+ @uui = uui unless uui == SKIP
232
+ @call_timeout = call_timeout unless call_timeout == SKIP
233
+ @callback_timeout = callback_timeout unless callback_timeout == SKIP
234
+ @answer_url = answer_url unless answer_url == SKIP
235
+ @answer_fallback_url = answer_fallback_url unless answer_fallback_url == SKIP
236
+ @username = username unless username == SKIP
237
+ @password = password unless password == SKIP
238
+ @fallback_username = fallback_username unless fallback_username == SKIP
239
+ @fallback_password = fallback_password unless fallback_password == SKIP
240
+ @answer_method = answer_method unless answer_method == SKIP
241
+ @answer_fallback_method = answer_fallback_method unless answer_fallback_method == SKIP
242
+ @disconnect_url = disconnect_url unless disconnect_url == SKIP
243
+ @disconnect_method = disconnect_method unless disconnect_method == SKIP
244
+ @tag = tag unless tag == SKIP
245
+ @application_id = application_id unless application_id == SKIP
246
+ @machine_detection = machine_detection unless machine_detection == SKIP
179
247
  end
180
248
 
181
249
  # Creates an instance of the object from a hash.
@@ -183,23 +251,31 @@ module Bandwidth
183
251
  return nil unless hash
184
252
 
185
253
  # Extract variables from the hash.
186
- from = hash['from']
187
- to = hash['to']
188
- answer_url = hash['answerUrl']
189
- application_id = hash['applicationId']
190
- uui = hash['uui']
191
- call_timeout = hash['callTimeout']
192
- callback_timeout = hash['callbackTimeout']
193
- answer_fallback_url = hash['answerFallbackUrl']
194
- username = hash['username']
195
- password = hash['password']
196
- fallback_username = hash['fallbackUsername']
197
- fallback_password = hash['fallbackPassword']
198
- answer_method = hash['answerMethod']
199
- answer_fallback_method = hash['answerFallbackMethod']
200
- disconnect_url = hash['disconnectUrl']
201
- disconnect_method = hash['disconnectMethod']
202
- tag = hash['tag']
254
+ from = hash.key?('from') ? hash['from'] : SKIP
255
+ to = hash.key?('to') ? hash['to'] : SKIP
256
+ answer_url = hash.key?('answerUrl') ? hash['answerUrl'] : SKIP
257
+ application_id = hash.key?('applicationId') ? hash['applicationId'] : SKIP
258
+ uui = hash.key?('uui') ? hash['uui'] : SKIP
259
+ call_timeout = hash.key?('callTimeout') ? hash['callTimeout'] : SKIP
260
+ callback_timeout =
261
+ hash.key?('callbackTimeout') ? hash['callbackTimeout'] : SKIP
262
+ answer_fallback_url =
263
+ hash.key?('answerFallbackUrl') ? hash['answerFallbackUrl'] : SKIP
264
+ username = hash.key?('username') ? hash['username'] : SKIP
265
+ password = hash.key?('password') ? hash['password'] : SKIP
266
+ fallback_username =
267
+ hash.key?('fallbackUsername') ? hash['fallbackUsername'] : SKIP
268
+ fallback_password =
269
+ hash.key?('fallbackPassword') ? hash['fallbackPassword'] : SKIP
270
+ answer_method = hash.key?('answerMethod') ? hash['answerMethod'] : SKIP
271
+ answer_fallback_method =
272
+ hash.key?('answerFallbackMethod') ? hash['answerFallbackMethod'] : SKIP
273
+ disconnect_url = hash.key?('disconnectUrl') ? hash['disconnectUrl'] : SKIP
274
+ disconnect_method =
275
+ hash.key?('disconnectMethod') ? hash['disconnectMethod'] : SKIP
276
+ tag = hash.key?('tag') ? hash['tag'] : SKIP
277
+ machine_detection = MachineDetectionConfiguration.from_hash(hash['machineDetection']) if
278
+ hash['machineDetection']
203
279
 
204
280
  # Create object from extracted values.
205
281
  CreateCallRequest.new(from,
@@ -218,7 +294,8 @@ module Bandwidth
218
294
  answer_fallback_method,
219
295
  disconnect_url,
220
296
  disconnect_method,
221
- tag)
297
+ tag,
298
+ machine_detection)
222
299
  end
223
300
  end
224
301
  end
@@ -7,6 +7,9 @@ require 'date'
7
7
  module Bandwidth
8
8
  # CreateCallResponse Model.
9
9
  class CreateCallResponse < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
10
13
  # TODO: Write general description for this method
11
14
  # @return [String]
12
15
  attr_accessor :account_id
@@ -113,6 +116,38 @@ module Bandwidth
113
116
  @_hash
114
117
  end
115
118
 
119
+ # An array for optional fields
120
+ def optionals
121
+ %w[
122
+ start_time
123
+ call_timeout
124
+ callback_timeout
125
+ answer_fallback_url
126
+ answer_fallback_method
127
+ disconnect_url
128
+ username
129
+ password
130
+ fallback_username
131
+ fallback_password
132
+ tag
133
+ ]
134
+ end
135
+
136
+ # An array for nullable fields
137
+ def nullables
138
+ %w[
139
+ answer_fallback_url
140
+ answer_fallback_method
141
+ disconnect_url
142
+ disconnect_method
143
+ username
144
+ password
145
+ fallback_username
146
+ fallback_password
147
+ tag
148
+ ]
149
+ end
150
+
116
151
  def initialize(account_id = nil,
117
152
  call_id = nil,
118
153
  application_id = nil,
@@ -133,26 +168,26 @@ module Bandwidth
133
168
  fallback_username = nil,
134
169
  fallback_password = nil,
135
170
  tag = nil)
136
- @account_id = account_id
137
- @call_id = call_id
138
- @application_id = application_id
139
- @to = to
140
- @from = from
141
- @start_time = start_time
142
- @call_url = call_url
143
- @call_timeout = call_timeout
144
- @callback_timeout = callback_timeout
145
- @answer_url = answer_url
146
- @answer_method = answer_method
147
- @answer_fallback_url = answer_fallback_url
148
- @answer_fallback_method = answer_fallback_method
149
- @disconnect_url = disconnect_url
150
- @disconnect_method = disconnect_method
151
- @username = username
152
- @password = password
153
- @fallback_username = fallback_username
154
- @fallback_password = fallback_password
155
- @tag = tag
171
+ @account_id = account_id unless account_id == SKIP
172
+ @call_id = call_id unless call_id == SKIP
173
+ @application_id = application_id unless application_id == SKIP
174
+ @to = to unless to == SKIP
175
+ @from = from unless from == SKIP
176
+ @start_time = start_time unless start_time == SKIP
177
+ @call_url = call_url unless call_url == SKIP
178
+ @call_timeout = call_timeout unless call_timeout == SKIP
179
+ @callback_timeout = callback_timeout unless callback_timeout == SKIP
180
+ @answer_url = answer_url unless answer_url == SKIP
181
+ @answer_method = answer_method unless answer_method == SKIP
182
+ @answer_fallback_url = answer_fallback_url unless answer_fallback_url == SKIP
183
+ @answer_fallback_method = answer_fallback_method unless answer_fallback_method == SKIP
184
+ @disconnect_url = disconnect_url unless disconnect_url == SKIP
185
+ @disconnect_method = disconnect_method unless disconnect_method == SKIP
186
+ @username = username unless username == SKIP
187
+ @password = password unless password == SKIP
188
+ @fallback_username = fallback_username unless fallback_username == SKIP
189
+ @fallback_password = fallback_password unless fallback_password == SKIP
190
+ @tag = tag unless tag == SKIP
156
191
  end
157
192
 
158
193
  # Creates an instance of the object from a hash.
@@ -160,27 +195,36 @@ module Bandwidth
160
195
  return nil unless hash
161
196
 
162
197
  # Extract variables from the hash.
163
- account_id = hash['accountId']
164
- call_id = hash['callId']
165
- application_id = hash['applicationId']
166
- to = hash['to']
167
- from = hash['from']
168
- call_url = hash['callUrl']
169
- answer_url = hash['answerUrl']
170
- answer_method = hash['answerMethod']
171
- disconnect_method = hash['disconnectMethod']
172
- start_time = DateTimeHelper.from_rfc3339(hash['startTime']) if
173
- hash['startTime']
174
- call_timeout = hash['callTimeout']
175
- callback_timeout = hash['callbackTimeout']
176
- answer_fallback_url = hash['answerFallbackUrl']
177
- answer_fallback_method = hash['answerFallbackMethod']
178
- disconnect_url = hash['disconnectUrl']
179
- username = hash['username']
180
- password = hash['password']
181
- fallback_username = hash['fallbackUsername']
182
- fallback_password = hash['fallbackPassword']
183
- tag = hash['tag']
198
+ account_id = hash.key?('accountId') ? hash['accountId'] : SKIP
199
+ call_id = hash.key?('callId') ? hash['callId'] : SKIP
200
+ application_id = hash.key?('applicationId') ? hash['applicationId'] : SKIP
201
+ to = hash.key?('to') ? hash['to'] : SKIP
202
+ from = hash.key?('from') ? hash['from'] : SKIP
203
+ call_url = hash.key?('callUrl') ? hash['callUrl'] : SKIP
204
+ answer_url = hash.key?('answerUrl') ? hash['answerUrl'] : SKIP
205
+ answer_method = hash.key?('answerMethod') ? hash['answerMethod'] : SKIP
206
+ disconnect_method =
207
+ hash.key?('disconnectMethod') ? hash['disconnectMethod'] : SKIP
208
+ start_time = if hash.key?('startTime')
209
+ (DateTimeHelper.from_rfc3339(hash['startTime']) if hash['startTime'])
210
+ else
211
+ SKIP
212
+ end
213
+ call_timeout = hash.key?('callTimeout') ? hash['callTimeout'] : SKIP
214
+ callback_timeout =
215
+ hash.key?('callbackTimeout') ? hash['callbackTimeout'] : SKIP
216
+ answer_fallback_url =
217
+ hash.key?('answerFallbackUrl') ? hash['answerFallbackUrl'] : SKIP
218
+ answer_fallback_method =
219
+ hash.key?('answerFallbackMethod') ? hash['answerFallbackMethod'] : SKIP
220
+ disconnect_url = hash.key?('disconnectUrl') ? hash['disconnectUrl'] : SKIP
221
+ username = hash.key?('username') ? hash['username'] : SKIP
222
+ password = hash.key?('password') ? hash['password'] : SKIP
223
+ fallback_username =
224
+ hash.key?('fallbackUsername') ? hash['fallbackUsername'] : SKIP
225
+ fallback_password =
226
+ hash.key?('fallbackPassword') ? hash['fallbackPassword'] : SKIP
227
+ tag = hash.key?('tag') ? hash['tag'] : SKIP
184
228
 
185
229
  # Create object from extracted values.
186
230
  CreateCallResponse.new(account_id,
@@ -0,0 +1,80 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Bandwidth
7
+ # Diversion Model.
8
+ class Diversion < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :reason
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [String]
18
+ attr_accessor :privacy
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [String]
22
+ attr_accessor :unknown
23
+
24
+ # TODO: Write general description for this method
25
+ # @return [String]
26
+ attr_accessor :orig_to
27
+
28
+ # A mapping from model property names to API property names.
29
+ def self.names
30
+ @_hash = {} if @_hash.nil?
31
+ @_hash['reason'] = 'reason'
32
+ @_hash['privacy'] = 'privacy'
33
+ @_hash['unknown'] = 'unknown'
34
+ @_hash['orig_to'] = 'origTo'
35
+ @_hash
36
+ end
37
+
38
+ # An array for optional fields
39
+ def optionals
40
+ %w[
41
+ reason
42
+ privacy
43
+ unknown
44
+ orig_to
45
+ ]
46
+ end
47
+
48
+ # An array for nullable fields
49
+ def nullables
50
+ []
51
+ end
52
+
53
+ def initialize(reason = nil,
54
+ privacy = nil,
55
+ unknown = nil,
56
+ orig_to = nil)
57
+ @reason = reason unless reason == SKIP
58
+ @privacy = privacy unless privacy == SKIP
59
+ @unknown = unknown unless unknown == SKIP
60
+ @orig_to = orig_to unless orig_to == SKIP
61
+ end
62
+
63
+ # Creates an instance of the object from a hash.
64
+ def self.from_hash(hash)
65
+ return nil unless hash
66
+
67
+ # Extract variables from the hash.
68
+ reason = hash.key?('reason') ? hash['reason'] : SKIP
69
+ privacy = hash.key?('privacy') ? hash['privacy'] : SKIP
70
+ unknown = hash.key?('unknown') ? hash['unknown'] : SKIP
71
+ orig_to = hash.key?('origTo') ? hash['origTo'] : SKIP
72
+
73
+ # Create object from extracted values.
74
+ Diversion.new(reason,
75
+ privacy,
76
+ unknown,
77
+ orig_to)
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,17 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Bandwidth
7
+ # FallbackMethod.
8
+ class FallbackMethodEnum
9
+ FALLBACK_METHOD_ENUM = [
10
+ # TODO: Write general description for POST
11
+ POST = 'POST'.freeze,
12
+
13
+ # TODO: Write general description for GET
14
+ GET = 'GET'.freeze
15
+ ].freeze
16
+ end
17
+ end