bandwidth-sdk 6.2.0 → 9.0.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 (98) hide show
  1. checksums.yaml +4 -4
  2. data/lib/bandwidth/api_helper.rb +19 -29
  3. data/lib/bandwidth/client.rb +8 -8
  4. data/lib/bandwidth/configuration.rb +20 -32
  5. data/lib/bandwidth/http/auth/{two_factor_auth_basic_auth.rb → multi_factor_auth_basic_auth.rb} +3 -3
  6. data/lib/bandwidth/http/faraday_client.rb +1 -1
  7. data/lib/bandwidth/messaging_lib/messaging/client.rb +14 -5
  8. data/lib/bandwidth/messaging_lib/messaging/controllers/api_controller.rb +78 -71
  9. data/lib/bandwidth/messaging_lib/messaging/controllers/base_controller.rb +3 -5
  10. data/lib/bandwidth/messaging_lib/messaging/exceptions/messaging_exception.rb +5 -2
  11. data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_callback_message.rb +31 -11
  12. data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb +54 -25
  13. data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_message_item.rb +102 -24
  14. data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_messages_list.rb +23 -4
  15. data/lib/bandwidth/messaging_lib/messaging/models/deferred_result.rb +20 -4
  16. data/lib/bandwidth/messaging_lib/messaging/models/media.rb +27 -80
  17. data/lib/bandwidth/messaging_lib/messaging/models/message_request.rb +32 -14
  18. data/lib/bandwidth/messaging_lib/messaging/models/page_info.rb +28 -8
  19. data/lib/bandwidth/messaging_lib/messaging/models/tag.rb +20 -4
  20. data/lib/bandwidth/models/base_model.rb +30 -8
  21. data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/client.rb +15 -6
  22. data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/controllers/base_controller.rb +3 -5
  23. data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/controllers/mfa_controller.rb +28 -23
  24. data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/exceptions/error_with_request_exception.rb +5 -2
  25. data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/exceptions/forbidden_request_exception.rb +4 -1
  26. data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/exceptions/unauthorized_request_exception.rb +4 -1
  27. data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/models/two_factor_code_request_schema.rb +27 -12
  28. data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/models/two_factor_messaging_response.rb +17 -2
  29. data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/models/two_factor_verify_code_response.rb +17 -2
  30. data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/models/two_factor_verify_request_schema.rb +29 -10
  31. data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/models/two_factor_voice_response.rb +17 -2
  32. data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth.rb +23 -0
  33. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/controllers/api_controller.rb +212 -210
  34. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/controllers/base_controller.rb +3 -5
  35. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/exceptions/accounts_tnlookup400_error_exception.rb +4 -1
  36. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_request.rb +17 -2
  37. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_response.rb +20 -4
  38. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_status.rb +28 -7
  39. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/result.rb +43 -18
  40. data/lib/bandwidth/utilities/date_time_helper.rb +156 -0
  41. data/lib/bandwidth/utilities/file_wrapper.rb +1 -2
  42. data/lib/bandwidth/voice_lib/voice/client.rb +14 -5
  43. data/lib/bandwidth/voice_lib/voice/controllers/api_controller.rb +418 -379
  44. data/lib/bandwidth/voice_lib/voice/controllers/base_controller.rb +3 -5
  45. data/lib/bandwidth/voice_lib/voice/exceptions/{api_error_response_exception.rb → api_error_exception.rb} +8 -5
  46. data/lib/bandwidth/voice_lib/voice/models/call_callback.rb +343 -0
  47. data/lib/bandwidth/voice_lib/voice/models/call_recording_metadata.rb +250 -0
  48. data/lib/bandwidth/voice_lib/voice/models/call_state.rb +284 -0
  49. data/lib/bandwidth/voice_lib/voice/models/callback_method_enum.rb +2 -20
  50. data/lib/bandwidth/voice_lib/voice/models/conference_callback.rb +211 -0
  51. data/lib/bandwidth/voice_lib/voice/models/conference_event_method_enum.rb +2 -20
  52. data/lib/bandwidth/voice_lib/voice/models/{conference_member_detail.rb → conference_member_state.rb} +43 -20
  53. data/lib/bandwidth/voice_lib/voice/models/conference_recording_metadata.rb +173 -0
  54. data/lib/bandwidth/voice_lib/voice/models/conference_state.rb +153 -0
  55. data/lib/bandwidth/voice_lib/voice/models/create_call_request.rb +301 -0
  56. data/lib/bandwidth/voice_lib/voice/models/create_call_response.rb +256 -0
  57. data/lib/bandwidth/voice_lib/voice/models/diversion.rb +80 -0
  58. data/lib/bandwidth/voice_lib/voice/models/fallback_method_enum.rb +17 -0
  59. data/lib/bandwidth/voice_lib/voice/models/machine_detection_configuration.rb +218 -0
  60. data/lib/bandwidth/voice_lib/voice/models/mode_enum.rb +20 -0
  61. data/lib/bandwidth/voice_lib/voice/models/{modify_call_recording_state.rb → modify_call_recording_request.rb} +19 -6
  62. data/lib/bandwidth/voice_lib/voice/models/modify_call_request.rb +156 -0
  63. data/lib/bandwidth/voice_lib/voice/models/modify_conference_request.rb +144 -0
  64. data/lib/bandwidth/voice_lib/voice/models/state1_enum.rb +7 -4
  65. data/lib/bandwidth/voice_lib/voice/models/state_enum.rb +4 -7
  66. data/lib/bandwidth/voice_lib/voice/models/transcribe_recording_request.rb +108 -0
  67. data/lib/bandwidth/voice_lib/voice/models/transcript.rb +20 -4
  68. data/lib/bandwidth/voice_lib/voice/models/transcription.rb +35 -17
  69. data/lib/bandwidth/voice_lib/voice/models/transcription_metadata.rb +89 -0
  70. data/lib/bandwidth/voice_lib/voice/models/transcription_response.rb +18 -1
  71. data/lib/bandwidth/voice_lib/voice.rb +20 -18
  72. data/lib/bandwidth/web_rtc_lib/utils/web_rtc_transfer.rb +7 -2
  73. data/lib/bandwidth/web_rtc_lib/web_rtc/client.rb +4 -4
  74. data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/api_controller.rb +75 -64
  75. data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/base_controller.rb +3 -5
  76. data/lib/bandwidth/web_rtc_lib/web_rtc/exceptions/error_exception.rb +5 -2
  77. data/lib/bandwidth/web_rtc_lib/web_rtc/models/accounts_participants_response.rb +20 -5
  78. data/lib/bandwidth/web_rtc_lib/web_rtc/models/participant.rb +37 -14
  79. data/lib/bandwidth/web_rtc_lib/web_rtc/models/participant_subscription.rb +15 -2
  80. data/lib/bandwidth/web_rtc_lib/web_rtc/models/session.rb +20 -4
  81. data/lib/bandwidth/web_rtc_lib/web_rtc/models/subscriptions.rb +20 -3
  82. data/lib/bandwidth.rb +20 -18
  83. data/test/integration/test_integration.rb +92 -57
  84. metadata +35 -31
  85. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth.rb +0 -22
  86. data/lib/bandwidth/voice_lib/voice/models/api_call_response.rb +0 -207
  87. data/lib/bandwidth/voice_lib/voice/models/api_call_state_response.rb +0 -164
  88. data/lib/bandwidth/voice_lib/voice/models/api_create_call_request.rb +0 -248
  89. data/lib/bandwidth/voice_lib/voice/models/api_modify_call_request.rb +0 -116
  90. data/lib/bandwidth/voice_lib/voice/models/api_modify_conference_request.rb +0 -107
  91. data/lib/bandwidth/voice_lib/voice/models/api_transcribe_recording_request.rb +0 -80
  92. data/lib/bandwidth/voice_lib/voice/models/conference_detail.rb +0 -108
  93. data/lib/bandwidth/voice_lib/voice/models/conference_recording_metadata_response.rb +0 -126
  94. data/lib/bandwidth/voice_lib/voice/models/disconnect_cause_enum.rb +0 -47
  95. data/lib/bandwidth/voice_lib/voice/models/recording_metadata_response.rb +0 -190
  96. data/lib/bandwidth/voice_lib/voice/models/state2_enum.rb +0 -20
  97. data/lib/bandwidth/voice_lib/voice/models/status1_enum.rb +0 -29
  98. data/lib/bandwidth/voice_lib/voice/models/status3_enum.rb +0 -32
@@ -0,0 +1,256 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ require 'date'
7
+ module Bandwidth
8
+ # CreateCallResponse Model.
9
+ class CreateCallResponse < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # TODO: Write general description for this method
14
+ # @return [String]
15
+ attr_accessor :account_id
16
+
17
+ # TODO: Write general description for this method
18
+ # @return [String]
19
+ attr_accessor :call_id
20
+
21
+ # TODO: Write general description for this method
22
+ # @return [String]
23
+ attr_accessor :application_id
24
+
25
+ # TODO: Write general description for this method
26
+ # @return [String]
27
+ attr_accessor :to
28
+
29
+ # TODO: Write general description for this method
30
+ # @return [String]
31
+ attr_accessor :from
32
+
33
+ # TODO: Write general description for this method
34
+ # @return [DateTime]
35
+ attr_accessor :start_time
36
+
37
+ # TODO: Write general description for this method
38
+ # @return [String]
39
+ attr_accessor :call_url
40
+
41
+ # TODO: Write general description for this method
42
+ # @return [Float]
43
+ attr_accessor :call_timeout
44
+
45
+ # TODO: Write general description for this method
46
+ # @return [Float]
47
+ attr_accessor :callback_timeout
48
+
49
+ # TODO: Write general description for this method
50
+ # @return [String]
51
+ attr_accessor :answer_url
52
+
53
+ # TODO: Write general description for this method
54
+ # @return [AnswerMethodEnum]
55
+ attr_accessor :answer_method
56
+
57
+ # TODO: Write general description for this method
58
+ # @return [String]
59
+ attr_accessor :answer_fallback_url
60
+
61
+ # TODO: Write general description for this method
62
+ # @return [AnswerFallbackMethodEnum]
63
+ attr_accessor :answer_fallback_method
64
+
65
+ # TODO: Write general description for this method
66
+ # @return [String]
67
+ attr_accessor :disconnect_url
68
+
69
+ # TODO: Write general description for this method
70
+ # @return [DisconnectMethodEnum]
71
+ attr_accessor :disconnect_method
72
+
73
+ # TODO: Write general description for this method
74
+ # @return [String]
75
+ attr_accessor :username
76
+
77
+ # TODO: Write general description for this method
78
+ # @return [String]
79
+ attr_accessor :password
80
+
81
+ # TODO: Write general description for this method
82
+ # @return [String]
83
+ attr_accessor :fallback_username
84
+
85
+ # TODO: Write general description for this method
86
+ # @return [String]
87
+ attr_accessor :fallback_password
88
+
89
+ # TODO: Write general description for this method
90
+ # @return [String]
91
+ attr_accessor :tag
92
+
93
+ # A mapping from model property names to API property names.
94
+ def self.names
95
+ @_hash = {} if @_hash.nil?
96
+ @_hash['account_id'] = 'accountId'
97
+ @_hash['call_id'] = 'callId'
98
+ @_hash['application_id'] = 'applicationId'
99
+ @_hash['to'] = 'to'
100
+ @_hash['from'] = 'from'
101
+ @_hash['start_time'] = 'startTime'
102
+ @_hash['call_url'] = 'callUrl'
103
+ @_hash['call_timeout'] = 'callTimeout'
104
+ @_hash['callback_timeout'] = 'callbackTimeout'
105
+ @_hash['answer_url'] = 'answerUrl'
106
+ @_hash['answer_method'] = 'answerMethod'
107
+ @_hash['answer_fallback_url'] = 'answerFallbackUrl'
108
+ @_hash['answer_fallback_method'] = 'answerFallbackMethod'
109
+ @_hash['disconnect_url'] = 'disconnectUrl'
110
+ @_hash['disconnect_method'] = 'disconnectMethod'
111
+ @_hash['username'] = 'username'
112
+ @_hash['password'] = 'password'
113
+ @_hash['fallback_username'] = 'fallbackUsername'
114
+ @_hash['fallback_password'] = 'fallbackPassword'
115
+ @_hash['tag'] = 'tag'
116
+ @_hash
117
+ end
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
+
151
+ def initialize(account_id = nil,
152
+ call_id = nil,
153
+ application_id = nil,
154
+ to = nil,
155
+ from = nil,
156
+ call_url = nil,
157
+ answer_url = nil,
158
+ answer_method = nil,
159
+ disconnect_method = nil,
160
+ start_time = nil,
161
+ call_timeout = nil,
162
+ callback_timeout = nil,
163
+ answer_fallback_url = nil,
164
+ answer_fallback_method = nil,
165
+ disconnect_url = nil,
166
+ username = nil,
167
+ password = nil,
168
+ fallback_username = nil,
169
+ fallback_password = nil,
170
+ tag = nil)
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
191
+ end
192
+
193
+ # Creates an instance of the object from a hash.
194
+ def self.from_hash(hash)
195
+ return nil unless hash
196
+
197
+ # Extract variables from the hash.
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
228
+
229
+ # Create object from extracted values.
230
+ CreateCallResponse.new(account_id,
231
+ call_id,
232
+ application_id,
233
+ to,
234
+ from,
235
+ call_url,
236
+ answer_url,
237
+ answer_method,
238
+ disconnect_method,
239
+ start_time,
240
+ call_timeout,
241
+ callback_timeout,
242
+ answer_fallback_url,
243
+ answer_fallback_method,
244
+ disconnect_url,
245
+ username,
246
+ password,
247
+ fallback_username,
248
+ fallback_password,
249
+ tag)
250
+ end
251
+
252
+ def to_start_time
253
+ DateTimeHelper.to_rfc3339(start_time)
254
+ end
255
+ end
256
+ end
@@ -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
@@ -0,0 +1,218 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Bandwidth
7
+ # MachineDetectionConfiguration Model.
8
+ class MachineDetectionConfiguration < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The machine detection mode. If set to 'async', the detection result will
13
+ # be sent in a 'machineDetectionComplete' callback. If set to 'sync', the
14
+ # 'answer' callback will wait for the machine detection to complete and will
15
+ # include its result. Default is 'async'.
16
+ # @return [ModeEnum]
17
+ attr_accessor :mode
18
+
19
+ # Total amount of time (in seconds) before giving up.
20
+ # @return [Float]
21
+ attr_accessor :detection_timeout
22
+
23
+ # If no speech is detected in this period, a callback with a 'silence'
24
+ # result is sent. Default is 10 seconds.
25
+ # @return [Float]
26
+ attr_accessor :silence_timeout
27
+
28
+ # When speech has ended and a result couldn't be determined based on the
29
+ # audio content itself, this value is used to determine if the speaker is a
30
+ # machine based on the speech duration. If the length of the speech detected
31
+ # is greater than or equal to this threshold, the result will be
32
+ # 'answering-machine'. If the length of speech detected is below this
33
+ # threshold, the result will be 'human'. Default is 10 seconds.
34
+ # @return [Float]
35
+ attr_accessor :speech_threshold
36
+
37
+ # Amount of silence (in seconds) before assuming the callee has finished
38
+ # speaking.
39
+ # @return [Float]
40
+ attr_accessor :speech_end_threshold
41
+
42
+ # If set to 'true' and if an answering machine is detected, the
43
+ # 'answering-machine' callback will be delayed until the machine is done
44
+ # speaking or until the 'detectionTimeout' is exceeded. If false, the
45
+ # 'answering-machine' result is sent immediately. Default is 'false'.
46
+ # @return [Boolean]
47
+ attr_accessor :delay_result
48
+
49
+ # The URL to send the 'machineDetectionComplete' callback when the detection
50
+ # is completed. Only for 'async' mode.
51
+ # @return [String]
52
+ attr_accessor :callback_url
53
+
54
+ # The URL to send the 'machineDetectionComplete' callback when the detection
55
+ # is completed. Only for 'async' mode.
56
+ # @return [CallbackMethodEnum]
57
+ attr_accessor :callback_method
58
+
59
+ # The URL to send the 'machineDetectionComplete' callback when the detection
60
+ # is completed. Only for 'async' mode.
61
+ # @return [String]
62
+ attr_accessor :fallback_url
63
+
64
+ # The URL to send the 'machineDetectionComplete' callback when the detection
65
+ # is completed. Only for 'async' mode.
66
+ # @return [FallbackMethodEnum]
67
+ attr_accessor :fallback_method
68
+
69
+ # The URL to send the 'machineDetectionComplete' callback when the detection
70
+ # is completed. Only for 'async' mode.
71
+ # @return [String]
72
+ attr_accessor :username
73
+
74
+ # The URL to send the 'machineDetectionComplete' callback when the detection
75
+ # is completed. Only for 'async' mode.
76
+ # @return [String]
77
+ attr_accessor :password
78
+
79
+ # The URL to send the 'machineDetectionComplete' callback when the detection
80
+ # is completed. Only for 'async' mode.
81
+ # @return [String]
82
+ attr_accessor :fallback_username
83
+
84
+ # The URL to send the 'machineDetectionComplete' callback when the detection
85
+ # is completed. Only for 'async' mode.
86
+ # @return [String]
87
+ attr_accessor :fallback_password
88
+
89
+ # A mapping from model property names to API property names.
90
+ def self.names
91
+ @_hash = {} if @_hash.nil?
92
+ @_hash['mode'] = 'mode'
93
+ @_hash['detection_timeout'] = 'detectionTimeout'
94
+ @_hash['silence_timeout'] = 'silenceTimeout'
95
+ @_hash['speech_threshold'] = 'speechThreshold'
96
+ @_hash['speech_end_threshold'] = 'speechEndThreshold'
97
+ @_hash['delay_result'] = 'delayResult'
98
+ @_hash['callback_url'] = 'callbackUrl'
99
+ @_hash['callback_method'] = 'callbackMethod'
100
+ @_hash['fallback_url'] = 'fallbackUrl'
101
+ @_hash['fallback_method'] = 'fallbackMethod'
102
+ @_hash['username'] = 'username'
103
+ @_hash['password'] = 'password'
104
+ @_hash['fallback_username'] = 'fallbackUsername'
105
+ @_hash['fallback_password'] = 'fallbackPassword'
106
+ @_hash
107
+ end
108
+
109
+ # An array for optional fields
110
+ def optionals
111
+ %w[
112
+ mode
113
+ detection_timeout
114
+ silence_timeout
115
+ speech_threshold
116
+ speech_end_threshold
117
+ delay_result
118
+ callback_url
119
+ callback_method
120
+ fallback_url
121
+ fallback_method
122
+ username
123
+ password
124
+ fallback_username
125
+ fallback_password
126
+ ]
127
+ end
128
+
129
+ # An array for nullable fields
130
+ def nullables
131
+ %w[
132
+ callback_url
133
+ callback_method
134
+ fallback_url
135
+ fallback_method
136
+ username
137
+ password
138
+ fallback_username
139
+ fallback_password
140
+ ]
141
+ end
142
+
143
+ def initialize(mode = nil,
144
+ detection_timeout = nil,
145
+ silence_timeout = nil,
146
+ speech_threshold = nil,
147
+ speech_end_threshold = nil,
148
+ delay_result = nil,
149
+ callback_url = nil,
150
+ callback_method = nil,
151
+ fallback_url = nil,
152
+ fallback_method = nil,
153
+ username = nil,
154
+ password = nil,
155
+ fallback_username = nil,
156
+ fallback_password = nil)
157
+ @mode = mode unless mode == SKIP
158
+ @detection_timeout = detection_timeout unless detection_timeout == SKIP
159
+ @silence_timeout = silence_timeout unless silence_timeout == SKIP
160
+ @speech_threshold = speech_threshold unless speech_threshold == SKIP
161
+ @speech_end_threshold = speech_end_threshold unless speech_end_threshold == SKIP
162
+ @delay_result = delay_result unless delay_result == SKIP
163
+ @callback_url = callback_url unless callback_url == SKIP
164
+ @callback_method = callback_method unless callback_method == SKIP
165
+ @fallback_url = fallback_url unless fallback_url == SKIP
166
+ @fallback_method = fallback_method unless fallback_method == SKIP
167
+ @username = username unless username == SKIP
168
+ @password = password unless password == SKIP
169
+ @fallback_username = fallback_username unless fallback_username == SKIP
170
+ @fallback_password = fallback_password unless fallback_password == SKIP
171
+ end
172
+
173
+ # Creates an instance of the object from a hash.
174
+ def self.from_hash(hash)
175
+ return nil unless hash
176
+
177
+ # Extract variables from the hash.
178
+ mode = hash.key?('mode') ? hash['mode'] : SKIP
179
+ detection_timeout =
180
+ hash.key?('detectionTimeout') ? hash['detectionTimeout'] : SKIP
181
+ silence_timeout =
182
+ hash.key?('silenceTimeout') ? hash['silenceTimeout'] : SKIP
183
+ speech_threshold =
184
+ hash.key?('speechThreshold') ? hash['speechThreshold'] : SKIP
185
+ speech_end_threshold =
186
+ hash.key?('speechEndThreshold') ? hash['speechEndThreshold'] : SKIP
187
+ delay_result = hash.key?('delayResult') ? hash['delayResult'] : SKIP
188
+ callback_url = hash.key?('callbackUrl') ? hash['callbackUrl'] : SKIP
189
+ callback_method =
190
+ hash.key?('callbackMethod') ? hash['callbackMethod'] : SKIP
191
+ fallback_url = hash.key?('fallbackUrl') ? hash['fallbackUrl'] : SKIP
192
+ fallback_method =
193
+ hash.key?('fallbackMethod') ? hash['fallbackMethod'] : SKIP
194
+ username = hash.key?('username') ? hash['username'] : SKIP
195
+ password = hash.key?('password') ? hash['password'] : SKIP
196
+ fallback_username =
197
+ hash.key?('fallbackUsername') ? hash['fallbackUsername'] : SKIP
198
+ fallback_password =
199
+ hash.key?('fallbackPassword') ? hash['fallbackPassword'] : SKIP
200
+
201
+ # Create object from extracted values.
202
+ MachineDetectionConfiguration.new(mode,
203
+ detection_timeout,
204
+ silence_timeout,
205
+ speech_threshold,
206
+ speech_end_threshold,
207
+ delay_result,
208
+ callback_url,
209
+ callback_method,
210
+ fallback_url,
211
+ fallback_method,
212
+ username,
213
+ password,
214
+ fallback_username,
215
+ fallback_password)
216
+ end
217
+ end
218
+ end
@@ -0,0 +1,20 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Bandwidth
7
+ # The machine detection mode. If set to 'async', the detection result will be
8
+ # sent in a 'machineDetectionComplete' callback. If set to 'sync', the
9
+ # 'answer' callback will wait for the machine detection to complete and will
10
+ # include its result. Default is 'async'.
11
+ class ModeEnum
12
+ MODE_ENUM = [
13
+ # TODO: Write general description for SYNC
14
+ SYNC = 'sync'.freeze,
15
+
16
+ # TODO: Write general description for ASYNC
17
+ ASYNC = 'async'.freeze
18
+ ].freeze
19
+ end
20
+ end
@@ -4,10 +4,13 @@
4
4
  # ( https://apimatic.io ).
5
5
 
6
6
  module Bandwidth
7
- # ModifyCallRecordingState Model.
8
- class ModifyCallRecordingState < BaseModel
7
+ # ModifyCallRecordingRequest Model.
8
+ class ModifyCallRecordingRequest < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
9
12
  # TODO: Write general description for this method
10
- # @return [State2Enum]
13
+ # @return [State1Enum]
11
14
  attr_accessor :state
12
15
 
13
16
  # A mapping from model property names to API property names.
@@ -17,8 +20,18 @@ module Bandwidth
17
20
  @_hash
18
21
  end
19
22
 
23
+ # An array for optional fields
24
+ def optionals
25
+ []
26
+ end
27
+
28
+ # An array for nullable fields
29
+ def nullables
30
+ []
31
+ end
32
+
20
33
  def initialize(state = nil)
21
- @state = state
34
+ @state = state unless state == SKIP
22
35
  end
23
36
 
24
37
  # Creates an instance of the object from a hash.
@@ -26,10 +39,10 @@ module Bandwidth
26
39
  return nil unless hash
27
40
 
28
41
  # Extract variables from the hash.
29
- state = hash['state']
42
+ state = hash.key?('state') ? hash['state'] : SKIP
30
43
 
31
44
  # Create object from extracted values.
32
- ModifyCallRecordingState.new(state)
45
+ ModifyCallRecordingRequest.new(state)
33
46
  end
34
47
  end
35
48
  end