bandwidth-sdk 6.2.0 → 9.0.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -19,14 +19,12 @@ module Bandwidth
19
19
 
20
20
  def validate_parameters(args)
21
21
  args.each do |_name, value|
22
- if value.nil?
23
- raise ArgumentError, "Required parameter #{_name} cannot be nil."
24
- end
22
+ raise ArgumentError, "Required parameter #{_name} cannot be nil." if value.nil?
25
23
  end
26
24
  end
27
25
 
28
26
  def execute_request(request, binary: false)
29
- @http_call_back.on_before_request(request) if @http_call_back
27
+ @http_call_back&.on_before_request(request)
30
28
 
31
29
  APIHelper.clean_hash(request.headers)
32
30
  request.headers.merge!(@global_headers)
@@ -36,7 +34,7 @@ module Bandwidth
36
34
  else
37
35
  config.http_client.execute_as_string(request)
38
36
  end
39
- @http_call_back.on_after_response(response) if @http_call_back
37
+ @http_call_back&.on_after_response(response)
40
38
 
41
39
  response
42
40
  end
@@ -4,8 +4,11 @@
4
4
  # ( https://apimatic.io ).
5
5
 
6
6
  module Bandwidth
7
- # ApiErrorResponse class.
8
- class ApiErrorResponseException < APIException
7
+ # ApiError class.
8
+ class ApiErrorException < APIException
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
9
12
  # TODO: Write general description for this method
10
13
  # @return [String]
11
14
  attr_accessor :type
@@ -31,9 +34,9 @@ module Bandwidth
31
34
  # @param [Hash] The deserialized response sent by the server in the
32
35
  # response body.
33
36
  def unbox(hash)
34
- @type = hash['type']
35
- @description = hash['description']
36
- @id = hash['id']
37
+ @type = hash.key?('type') ? hash['type'] : SKIP
38
+ @description = hash.key?('description') ? hash['description'] : SKIP
39
+ @id = hash.key?('id') ? hash['id'] : SKIP
37
40
  end
38
41
  end
39
42
  end
@@ -0,0 +1,343 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Bandwidth
7
+ # This object represents all possible fields that may be included in callbacks
8
+ # related to call events, including events that come from BXML verbs
9
+ class CallCallback < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # TODO: Write general description for this method
14
+ # @return [String]
15
+ attr_accessor :event_type
16
+
17
+ # TODO: Write general description for this method
18
+ # @return [String]
19
+ attr_accessor :event_time
20
+
21
+ # TODO: Write general description for this method
22
+ # @return [String]
23
+ attr_accessor :account_id
24
+
25
+ # TODO: Write general description for this method
26
+ # @return [String]
27
+ attr_accessor :application_id
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 [String]
35
+ attr_accessor :to
36
+
37
+ # TODO: Write general description for this method
38
+ # @return [String]
39
+ attr_accessor :direction
40
+
41
+ # TODO: Write general description for this method
42
+ # @return [String]
43
+ attr_accessor :call_id
44
+
45
+ # TODO: Write general description for this method
46
+ # @return [String]
47
+ attr_accessor :call_url
48
+
49
+ # TODO: Write general description for this method
50
+ # @return [String]
51
+ attr_accessor :start_time
52
+
53
+ # TODO: Write general description for this method
54
+ # @return [String]
55
+ attr_accessor :answer_time
56
+
57
+ # TODO: Write general description for this method
58
+ # @return [String]
59
+ attr_accessor :transfer_caller_id
60
+
61
+ # TODO: Write general description for this method
62
+ # @return [String]
63
+ attr_accessor :transfer_to
64
+
65
+ # TODO: Write general description for this method
66
+ # @return [String]
67
+ attr_accessor :cause
68
+
69
+ # TODO: Write general description for this method
70
+ # @return [String]
71
+ attr_accessor :error_message
72
+
73
+ # TODO: Write general description for this method
74
+ # @return [String]
75
+ attr_accessor :error_id
76
+
77
+ # TODO: Write general description for this method
78
+ # @return [String]
79
+ attr_accessor :end_time
80
+
81
+ # TODO: Write general description for this method
82
+ # @return [String]
83
+ attr_accessor :digit
84
+
85
+ # TODO: Write general description for this method
86
+ # @return [String]
87
+ attr_accessor :parent_call_id
88
+
89
+ # TODO: Write general description for this method
90
+ # @return [String]
91
+ attr_accessor :recording_id
92
+
93
+ # TODO: Write general description for this method
94
+ # @return [String]
95
+ attr_accessor :duration
96
+
97
+ # TODO: Write general description for this method
98
+ # @return [String]
99
+ attr_accessor :file_format
100
+
101
+ # TODO: Write general description for this method
102
+ # @return [String]
103
+ attr_accessor :media_url
104
+
105
+ # TODO: Write general description for this method
106
+ # @return [String]
107
+ attr_accessor :tag
108
+
109
+ # TODO: Write general description for this method
110
+ # @return [Integer]
111
+ attr_accessor :channels
112
+
113
+ # TODO: Write general description for this method
114
+ # @return [String]
115
+ attr_accessor :status
116
+
117
+ # TODO: Write general description for this method
118
+ # @return [String]
119
+ attr_accessor :digits
120
+
121
+ # TODO: Write general description for this method
122
+ # @return [String]
123
+ attr_accessor :terminating_digit
124
+
125
+ # TODO: Write general description for this method
126
+ # @return [Transcription]
127
+ attr_accessor :transcription
128
+
129
+ # TODO: Write general description for this method
130
+ # @return [Diversion]
131
+ attr_accessor :diversion
132
+
133
+ # A mapping from model property names to API property names.
134
+ def self.names
135
+ @_hash = {} if @_hash.nil?
136
+ @_hash['event_type'] = 'eventType'
137
+ @_hash['event_time'] = 'eventTime'
138
+ @_hash['account_id'] = 'accountId'
139
+ @_hash['application_id'] = 'applicationId'
140
+ @_hash['from'] = 'from'
141
+ @_hash['to'] = 'to'
142
+ @_hash['direction'] = 'direction'
143
+ @_hash['call_id'] = 'callId'
144
+ @_hash['call_url'] = 'callUrl'
145
+ @_hash['start_time'] = 'startTime'
146
+ @_hash['answer_time'] = 'answerTime'
147
+ @_hash['transfer_caller_id'] = 'transferCallerId'
148
+ @_hash['transfer_to'] = 'transferTo'
149
+ @_hash['cause'] = 'cause'
150
+ @_hash['error_message'] = 'errorMessage'
151
+ @_hash['error_id'] = 'errorId'
152
+ @_hash['end_time'] = 'endTime'
153
+ @_hash['digit'] = 'digit'
154
+ @_hash['parent_call_id'] = 'parentCallId'
155
+ @_hash['recording_id'] = 'recordingId'
156
+ @_hash['duration'] = 'duration'
157
+ @_hash['file_format'] = 'fileFormat'
158
+ @_hash['media_url'] = 'mediaUrl'
159
+ @_hash['tag'] = 'tag'
160
+ @_hash['channels'] = 'channels'
161
+ @_hash['status'] = 'status'
162
+ @_hash['digits'] = 'digits'
163
+ @_hash['terminating_digit'] = 'terminatingDigit'
164
+ @_hash['transcription'] = 'transcription'
165
+ @_hash['diversion'] = 'diversion'
166
+ @_hash
167
+ end
168
+
169
+ # An array for optional fields
170
+ def optionals
171
+ %w[
172
+ event_type
173
+ event_time
174
+ account_id
175
+ application_id
176
+ from
177
+ to
178
+ direction
179
+ call_id
180
+ call_url
181
+ start_time
182
+ answer_time
183
+ transfer_caller_id
184
+ transfer_to
185
+ cause
186
+ error_message
187
+ error_id
188
+ end_time
189
+ digit
190
+ parent_call_id
191
+ recording_id
192
+ duration
193
+ file_format
194
+ media_url
195
+ tag
196
+ channels
197
+ status
198
+ digits
199
+ terminating_digit
200
+ transcription
201
+ diversion
202
+ ]
203
+ end
204
+
205
+ # An array for nullable fields
206
+ def nullables
207
+ []
208
+ end
209
+
210
+ def initialize(event_type = nil,
211
+ event_time = nil,
212
+ account_id = nil,
213
+ application_id = nil,
214
+ from = nil,
215
+ to = nil,
216
+ direction = nil,
217
+ call_id = nil,
218
+ call_url = nil,
219
+ start_time = nil,
220
+ answer_time = nil,
221
+ transfer_caller_id = nil,
222
+ transfer_to = nil,
223
+ cause = nil,
224
+ error_message = nil,
225
+ error_id = nil,
226
+ end_time = nil,
227
+ digit = nil,
228
+ parent_call_id = nil,
229
+ recording_id = nil,
230
+ duration = nil,
231
+ file_format = nil,
232
+ media_url = nil,
233
+ tag = nil,
234
+ channels = nil,
235
+ status = nil,
236
+ digits = nil,
237
+ terminating_digit = nil,
238
+ transcription = nil,
239
+ diversion = nil)
240
+ @event_type = event_type unless event_type == SKIP
241
+ @event_time = event_time unless event_time == SKIP
242
+ @account_id = account_id unless account_id == SKIP
243
+ @application_id = application_id unless application_id == SKIP
244
+ @from = from unless from == SKIP
245
+ @to = to unless to == SKIP
246
+ @direction = direction unless direction == SKIP
247
+ @call_id = call_id unless call_id == SKIP
248
+ @call_url = call_url unless call_url == SKIP
249
+ @start_time = start_time unless start_time == SKIP
250
+ @answer_time = answer_time unless answer_time == SKIP
251
+ @transfer_caller_id = transfer_caller_id unless transfer_caller_id == SKIP
252
+ @transfer_to = transfer_to unless transfer_to == SKIP
253
+ @cause = cause unless cause == SKIP
254
+ @error_message = error_message unless error_message == SKIP
255
+ @error_id = error_id unless error_id == SKIP
256
+ @end_time = end_time unless end_time == SKIP
257
+ @digit = digit unless digit == SKIP
258
+ @parent_call_id = parent_call_id unless parent_call_id == SKIP
259
+ @recording_id = recording_id unless recording_id == SKIP
260
+ @duration = duration unless duration == SKIP
261
+ @file_format = file_format unless file_format == SKIP
262
+ @media_url = media_url unless media_url == SKIP
263
+ @tag = tag unless tag == SKIP
264
+ @channels = channels unless channels == SKIP
265
+ @status = status unless status == SKIP
266
+ @digits = digits unless digits == SKIP
267
+ @terminating_digit = terminating_digit unless terminating_digit == SKIP
268
+ @transcription = transcription unless transcription == SKIP
269
+ @diversion = diversion unless diversion == SKIP
270
+ end
271
+
272
+ # Creates an instance of the object from a hash.
273
+ def self.from_hash(hash)
274
+ return nil unless hash
275
+
276
+ # Extract variables from the hash.
277
+ event_type = hash.key?('eventType') ? hash['eventType'] : SKIP
278
+ event_time = hash.key?('eventTime') ? hash['eventTime'] : SKIP
279
+ account_id = hash.key?('accountId') ? hash['accountId'] : SKIP
280
+ application_id = hash.key?('applicationId') ? hash['applicationId'] : SKIP
281
+ from = hash.key?('from') ? hash['from'] : SKIP
282
+ to = hash.key?('to') ? hash['to'] : SKIP
283
+ direction = hash.key?('direction') ? hash['direction'] : SKIP
284
+ call_id = hash.key?('callId') ? hash['callId'] : SKIP
285
+ call_url = hash.key?('callUrl') ? hash['callUrl'] : SKIP
286
+ start_time = hash.key?('startTime') ? hash['startTime'] : SKIP
287
+ answer_time = hash.key?('answerTime') ? hash['answerTime'] : SKIP
288
+ transfer_caller_id =
289
+ hash.key?('transferCallerId') ? hash['transferCallerId'] : SKIP
290
+ transfer_to = hash.key?('transferTo') ? hash['transferTo'] : SKIP
291
+ cause = hash.key?('cause') ? hash['cause'] : SKIP
292
+ error_message = hash.key?('errorMessage') ? hash['errorMessage'] : SKIP
293
+ error_id = hash.key?('errorId') ? hash['errorId'] : SKIP
294
+ end_time = hash.key?('endTime') ? hash['endTime'] : SKIP
295
+ digit = hash.key?('digit') ? hash['digit'] : SKIP
296
+ parent_call_id = hash.key?('parentCallId') ? hash['parentCallId'] : SKIP
297
+ recording_id = hash.key?('recordingId') ? hash['recordingId'] : SKIP
298
+ duration = hash.key?('duration') ? hash['duration'] : SKIP
299
+ file_format = hash.key?('fileFormat') ? hash['fileFormat'] : SKIP
300
+ media_url = hash.key?('mediaUrl') ? hash['mediaUrl'] : SKIP
301
+ tag = hash.key?('tag') ? hash['tag'] : SKIP
302
+ channels = hash.key?('channels') ? hash['channels'] : SKIP
303
+ status = hash.key?('status') ? hash['status'] : SKIP
304
+ digits = hash.key?('digits') ? hash['digits'] : SKIP
305
+ terminating_digit =
306
+ hash.key?('terminatingDigit') ? hash['terminatingDigit'] : SKIP
307
+ transcription = Transcription.from_hash(hash['transcription']) if hash['transcription']
308
+ diversion = Diversion.from_hash(hash['diversion']) if hash['diversion']
309
+
310
+ # Create object from extracted values.
311
+ CallCallback.new(event_type,
312
+ event_time,
313
+ account_id,
314
+ application_id,
315
+ from,
316
+ to,
317
+ direction,
318
+ call_id,
319
+ call_url,
320
+ start_time,
321
+ answer_time,
322
+ transfer_caller_id,
323
+ transfer_to,
324
+ cause,
325
+ error_message,
326
+ error_id,
327
+ end_time,
328
+ digit,
329
+ parent_call_id,
330
+ recording_id,
331
+ duration,
332
+ file_format,
333
+ media_url,
334
+ tag,
335
+ channels,
336
+ status,
337
+ digits,
338
+ terminating_digit,
339
+ transcription,
340
+ diversion)
341
+ end
342
+ end
343
+ end
@@ -0,0 +1,250 @@
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
+ # CallRecordingMetadata Model.
9
+ class CallRecordingMetadata < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # TODO: Write general description for this method
14
+ # @return [String]
15
+ attr_accessor :application_id
16
+
17
+ # TODO: Write general description for this method
18
+ # @return [String]
19
+ attr_accessor :account_id
20
+
21
+ # TODO: Write general description for this method
22
+ # @return [String]
23
+ attr_accessor :call_id
24
+
25
+ # TODO: Write general description for this method
26
+ # @return [String]
27
+ attr_accessor :parent_call_id
28
+
29
+ # TODO: Write general description for this method
30
+ # @return [String]
31
+ attr_accessor :recording_id
32
+
33
+ # TODO: Write general description for this method
34
+ # @return [String]
35
+ attr_accessor :to
36
+
37
+ # TODO: Write general description for this method
38
+ # @return [String]
39
+ attr_accessor :from
40
+
41
+ # TODO: Write general description for this method
42
+ # @return [String]
43
+ attr_accessor :transfer_caller_id
44
+
45
+ # TODO: Write general description for this method
46
+ # @return [String]
47
+ attr_accessor :transfer_to
48
+
49
+ # Format is ISO-8601
50
+ # @return [String]
51
+ attr_accessor :duration
52
+
53
+ # Format is ISO-8601
54
+ # @return [DirectionEnum]
55
+ attr_accessor :direction
56
+
57
+ # Format is ISO-8601
58
+ # @return [Integer]
59
+ attr_accessor :channels
60
+
61
+ # Format is ISO-8601
62
+ # @return [DateTime]
63
+ attr_accessor :start_time
64
+
65
+ # Format is ISO-8601
66
+ # @return [DateTime]
67
+ attr_accessor :end_time
68
+
69
+ # Format is ISO-8601
70
+ # @return [FileFormatEnum]
71
+ attr_accessor :file_format
72
+
73
+ # The current status of the recording. Current values are 'processing',
74
+ # 'partial', 'complete', 'deleted' and 'error'. Additional states may be
75
+ # added in the future, so your application must be tolerant of unknown
76
+ # values.
77
+ # @return [String]
78
+ attr_accessor :status
79
+
80
+ # The current status of the recording. Current values are 'processing',
81
+ # 'partial', 'complete', 'deleted' and 'error'. Additional states may be
82
+ # added in the future, so your application must be tolerant of unknown
83
+ # values.
84
+ # @return [String]
85
+ attr_accessor :media_url
86
+
87
+ # The current status of the recording. Current values are 'processing',
88
+ # 'partial', 'complete', 'deleted' and 'error'. Additional states may be
89
+ # added in the future, so your application must be tolerant of unknown
90
+ # values.
91
+ # @return [TranscriptionMetadata]
92
+ attr_accessor :transcription
93
+
94
+ # A mapping from model property names to API property names.
95
+ def self.names
96
+ @_hash = {} if @_hash.nil?
97
+ @_hash['application_id'] = 'applicationId'
98
+ @_hash['account_id'] = 'accountId'
99
+ @_hash['call_id'] = 'callId'
100
+ @_hash['parent_call_id'] = 'parentCallId'
101
+ @_hash['recording_id'] = 'recordingId'
102
+ @_hash['to'] = 'to'
103
+ @_hash['from'] = 'from'
104
+ @_hash['transfer_caller_id'] = 'transferCallerId'
105
+ @_hash['transfer_to'] = 'transferTo'
106
+ @_hash['duration'] = 'duration'
107
+ @_hash['direction'] = 'direction'
108
+ @_hash['channels'] = 'channels'
109
+ @_hash['start_time'] = 'startTime'
110
+ @_hash['end_time'] = 'endTime'
111
+ @_hash['file_format'] = 'fileFormat'
112
+ @_hash['status'] = 'status'
113
+ @_hash['media_url'] = 'mediaUrl'
114
+ @_hash['transcription'] = 'transcription'
115
+ @_hash
116
+ end
117
+
118
+ # An array for optional fields
119
+ def optionals
120
+ %w[
121
+ application_id
122
+ account_id
123
+ call_id
124
+ parent_call_id
125
+ recording_id
126
+ to
127
+ from
128
+ transfer_caller_id
129
+ transfer_to
130
+ duration
131
+ direction
132
+ channels
133
+ start_time
134
+ end_time
135
+ file_format
136
+ status
137
+ media_url
138
+ transcription
139
+ ]
140
+ end
141
+
142
+ # An array for nullable fields
143
+ def nullables
144
+ %w[
145
+ parent_call_id
146
+ ]
147
+ end
148
+
149
+ def initialize(application_id = nil,
150
+ account_id = nil,
151
+ call_id = nil,
152
+ parent_call_id = nil,
153
+ recording_id = nil,
154
+ to = nil,
155
+ from = nil,
156
+ transfer_caller_id = nil,
157
+ transfer_to = nil,
158
+ duration = nil,
159
+ direction = nil,
160
+ channels = nil,
161
+ start_time = nil,
162
+ end_time = nil,
163
+ file_format = nil,
164
+ status = nil,
165
+ media_url = nil,
166
+ transcription = nil)
167
+ @application_id = application_id unless application_id == SKIP
168
+ @account_id = account_id unless account_id == SKIP
169
+ @call_id = call_id unless call_id == SKIP
170
+ @parent_call_id = parent_call_id unless parent_call_id == SKIP
171
+ @recording_id = recording_id unless recording_id == SKIP
172
+ @to = to unless to == SKIP
173
+ @from = from unless from == SKIP
174
+ @transfer_caller_id = transfer_caller_id unless transfer_caller_id == SKIP
175
+ @transfer_to = transfer_to unless transfer_to == SKIP
176
+ @duration = duration unless duration == SKIP
177
+ @direction = direction unless direction == SKIP
178
+ @channels = channels unless channels == SKIP
179
+ @start_time = start_time unless start_time == SKIP
180
+ @end_time = end_time unless end_time == SKIP
181
+ @file_format = file_format unless file_format == SKIP
182
+ @status = status unless status == SKIP
183
+ @media_url = media_url unless media_url == SKIP
184
+ @transcription = transcription unless transcription == SKIP
185
+ end
186
+
187
+ # Creates an instance of the object from a hash.
188
+ def self.from_hash(hash)
189
+ return nil unless hash
190
+
191
+ # Extract variables from the hash.
192
+ application_id = hash.key?('applicationId') ? hash['applicationId'] : SKIP
193
+ account_id = hash.key?('accountId') ? hash['accountId'] : SKIP
194
+ call_id = hash.key?('callId') ? hash['callId'] : SKIP
195
+ parent_call_id = hash.key?('parentCallId') ? hash['parentCallId'] : SKIP
196
+ recording_id = hash.key?('recordingId') ? hash['recordingId'] : SKIP
197
+ to = hash.key?('to') ? hash['to'] : SKIP
198
+ from = hash.key?('from') ? hash['from'] : SKIP
199
+ transfer_caller_id =
200
+ hash.key?('transferCallerId') ? hash['transferCallerId'] : SKIP
201
+ transfer_to = hash.key?('transferTo') ? hash['transferTo'] : SKIP
202
+ duration = hash.key?('duration') ? hash['duration'] : SKIP
203
+ direction = hash.key?('direction') ? hash['direction'] : SKIP
204
+ channels = hash.key?('channels') ? hash['channels'] : SKIP
205
+ start_time = if hash.key?('startTime')
206
+ (DateTimeHelper.from_rfc3339(hash['startTime']) if hash['startTime'])
207
+ else
208
+ SKIP
209
+ end
210
+ end_time = if hash.key?('endTime')
211
+ (DateTimeHelper.from_rfc3339(hash['endTime']) if hash['endTime'])
212
+ else
213
+ SKIP
214
+ end
215
+ file_format = hash.key?('fileFormat') ? hash['fileFormat'] : SKIP
216
+ status = hash.key?('status') ? hash['status'] : SKIP
217
+ media_url = hash.key?('mediaUrl') ? hash['mediaUrl'] : SKIP
218
+ transcription = TranscriptionMetadata.from_hash(hash['transcription']) if
219
+ hash['transcription']
220
+
221
+ # Create object from extracted values.
222
+ CallRecordingMetadata.new(application_id,
223
+ account_id,
224
+ call_id,
225
+ parent_call_id,
226
+ recording_id,
227
+ to,
228
+ from,
229
+ transfer_caller_id,
230
+ transfer_to,
231
+ duration,
232
+ direction,
233
+ channels,
234
+ start_time,
235
+ end_time,
236
+ file_format,
237
+ status,
238
+ media_url,
239
+ transcription)
240
+ end
241
+
242
+ def to_start_time
243
+ DateTimeHelper.to_rfc3339(start_time)
244
+ end
245
+
246
+ def to_end_time
247
+ DateTimeHelper.to_rfc3339(end_time)
248
+ end
249
+ end
250
+ end