bandwidth-sdk 8.0.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 (72) hide show
  1. checksums.yaml +4 -4
  2. data/lib/bandwidth/api_helper.rb +19 -17
  3. data/lib/bandwidth/configuration.rb +7 -19
  4. data/lib/bandwidth/http/faraday_client.rb +1 -1
  5. data/lib/bandwidth/messaging_lib/messaging/controllers/api_controller.rb +53 -42
  6. data/lib/bandwidth/messaging_lib/messaging/controllers/base_controller.rb +3 -5
  7. data/lib/bandwidth/messaging_lib/messaging/exceptions/messaging_exception.rb +5 -2
  8. data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_callback_message.rb +31 -11
  9. data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb +54 -25
  10. data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_message_item.rb +65 -32
  11. data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_messages_list.rb +23 -4
  12. data/lib/bandwidth/messaging_lib/messaging/models/deferred_result.rb +20 -4
  13. data/lib/bandwidth/messaging_lib/messaging/models/media.rb +23 -6
  14. data/lib/bandwidth/messaging_lib/messaging/models/message_request.rb +32 -14
  15. data/lib/bandwidth/messaging_lib/messaging/models/page_info.rb +28 -8
  16. data/lib/bandwidth/messaging_lib/messaging/models/tag.rb +20 -4
  17. data/lib/bandwidth/models/base_model.rb +11 -0
  18. data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/controllers/base_controller.rb +3 -5
  19. data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/controllers/mfa_controller.rb +21 -16
  20. data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/exceptions/error_with_request_exception.rb +5 -2
  21. data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/exceptions/forbidden_request_exception.rb +4 -1
  22. data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/exceptions/unauthorized_request_exception.rb +4 -1
  23. data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_code_request_schema.rb +27 -12
  24. data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_messaging_response.rb +17 -2
  25. data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_verify_code_response.rb +17 -2
  26. data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_verify_request_schema.rb +29 -10
  27. data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_voice_response.rb +17 -2
  28. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/controllers/api_controller.rb +212 -210
  29. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/controllers/base_controller.rb +3 -5
  30. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/exceptions/accounts_tnlookup400_error_exception.rb +4 -1
  31. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_request.rb +17 -2
  32. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_response.rb +20 -4
  33. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_status.rb +28 -7
  34. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/result.rb +43 -18
  35. data/lib/bandwidth/utilities/date_time_helper.rb +2 -2
  36. data/lib/bandwidth/utilities/file_wrapper.rb +1 -2
  37. data/lib/bandwidth/voice_lib/voice/controllers/api_controller.rb +171 -150
  38. data/lib/bandwidth/voice_lib/voice/controllers/base_controller.rb +3 -5
  39. data/lib/bandwidth/voice_lib/voice/exceptions/api_error_exception.rb +6 -3
  40. data/lib/bandwidth/voice_lib/voice/models/call_callback.rb +343 -0
  41. data/lib/bandwidth/voice_lib/voice/models/call_recording_metadata.rb +78 -37
  42. data/lib/bandwidth/voice_lib/voice/models/call_state.rb +94 -42
  43. data/lib/bandwidth/voice_lib/voice/models/conference_callback.rb +211 -0
  44. data/lib/bandwidth/voice_lib/voice/models/conference_member_state.rb +35 -12
  45. data/lib/bandwidth/voice_lib/voice/models/conference_recording_metadata.rb +55 -24
  46. data/lib/bandwidth/voice_lib/voice/models/conference_state.rb +54 -17
  47. data/lib/bandwidth/voice_lib/voice/models/create_call_request.rb +173 -96
  48. data/lib/bandwidth/voice_lib/voice/models/create_call_response.rb +85 -41
  49. data/lib/bandwidth/voice_lib/voice/models/diversion.rb +80 -0
  50. data/lib/bandwidth/voice_lib/voice/models/fallback_method_enum.rb +17 -0
  51. data/lib/bandwidth/voice_lib/voice/models/machine_detection_configuration.rb +218 -0
  52. data/lib/bandwidth/voice_lib/voice/models/mode_enum.rb +20 -0
  53. data/lib/bandwidth/voice_lib/voice/models/modify_call_recording_request.rb +15 -2
  54. data/lib/bandwidth/voice_lib/voice/models/modify_call_request.rb +59 -19
  55. data/lib/bandwidth/voice_lib/voice/models/modify_conference_request.rb +55 -18
  56. data/lib/bandwidth/voice_lib/voice/models/transcribe_recording_request.rb +40 -12
  57. data/lib/bandwidth/voice_lib/voice/models/transcript.rb +20 -4
  58. data/lib/bandwidth/voice_lib/voice/models/transcription.rb +80 -0
  59. data/lib/bandwidth/voice_lib/voice/models/transcription_metadata.rb +26 -8
  60. data/lib/bandwidth/voice_lib/voice/models/transcription_response.rb +18 -1
  61. data/lib/bandwidth/voice_lib/voice.rb +7 -1
  62. data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/api_controller.rb +61 -50
  63. data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/base_controller.rb +3 -5
  64. data/lib/bandwidth/web_rtc_lib/web_rtc/exceptions/error_exception.rb +5 -2
  65. data/lib/bandwidth/web_rtc_lib/web_rtc/models/accounts_participants_response.rb +20 -5
  66. data/lib/bandwidth/web_rtc_lib/web_rtc/models/participant.rb +37 -14
  67. data/lib/bandwidth/web_rtc_lib/web_rtc/models/participant_subscription.rb +15 -2
  68. data/lib/bandwidth/web_rtc_lib/web_rtc/models/session.rb +20 -4
  69. data/lib/bandwidth/web_rtc_lib/web_rtc/models/subscriptions.rb +20 -3
  70. data/lib/bandwidth.rb +19 -18
  71. data/test/integration/test_integration.rb +75 -53
  72. metadata +9 -2
@@ -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
@@ -6,6 +6,9 @@
6
6
  module Bandwidth
7
7
  # ApiError class.
8
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
@@ -7,6 +7,9 @@ require 'date'
7
7
  module Bandwidth
8
8
  # CallRecordingMetadata Model.
9
9
  class CallRecordingMetadata < 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 :application_id
@@ -112,6 +115,37 @@ module Bandwidth
112
115
  @_hash
113
116
  end
114
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
+
115
149
  def initialize(application_id = nil,
116
150
  account_id = nil,
117
151
  call_id = nil,
@@ -130,24 +164,24 @@ module Bandwidth
130
164
  status = nil,
131
165
  media_url = nil,
132
166
  transcription = nil)
133
- @application_id = application_id
134
- @account_id = account_id
135
- @call_id = call_id
136
- @parent_call_id = parent_call_id
137
- @recording_id = recording_id
138
- @to = to
139
- @from = from
140
- @transfer_caller_id = transfer_caller_id
141
- @transfer_to = transfer_to
142
- @duration = duration
143
- @direction = direction
144
- @channels = channels
145
- @start_time = start_time
146
- @end_time = end_time
147
- @file_format = file_format
148
- @status = status
149
- @media_url = media_url
150
- @transcription = transcription
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
151
185
  end
152
186
 
153
187
  # Creates an instance of the object from a hash.
@@ -155,25 +189,32 @@ module Bandwidth
155
189
  return nil unless hash
156
190
 
157
191
  # Extract variables from the hash.
158
- application_id = hash['applicationId']
159
- account_id = hash['accountId']
160
- call_id = hash['callId']
161
- parent_call_id = hash['parentCallId']
162
- recording_id = hash['recordingId']
163
- to = hash['to']
164
- from = hash['from']
165
- transfer_caller_id = hash['transferCallerId']
166
- transfer_to = hash['transferTo']
167
- duration = hash['duration']
168
- direction = hash['direction']
169
- channels = hash['channels']
170
- start_time = DateTimeHelper.from_rfc3339(hash['startTime']) if
171
- hash['startTime']
172
- end_time = DateTimeHelper.from_rfc3339(hash['endTime']) if
173
- hash['endTime']
174
- file_format = hash['fileFormat']
175
- status = hash['status']
176
- media_url = hash['mediaUrl']
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
177
218
  transcription = TranscriptionMetadata.from_hash(hash['transcription']) if
178
219
  hash['transcription']
179
220