bandwidth-sdk 7.0.0 → 9.1.0

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 +19 -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 +171 -150
  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 +7 -2
  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 +95 -58
  75. metadata +10 -3
@@ -7,6 +7,9 @@ require 'date'
7
7
  module Bandwidth
8
8
  # CallState Model.
9
9
  class CallState < 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 :call_id
@@ -51,7 +54,7 @@ module Bandwidth
51
54
  # 'answered' and 'disconnected'. Additional states may be added in the
52
55
  # future, so your application must be tolerant of unknown values.
53
56
  # @return [Hash]
54
- attr_accessor :pai
57
+ attr_accessor :stir_shaken
55
58
 
56
59
  # The current state of the call. Current possible values are 'initiated',
57
60
  # 'answered' and 'disconnected'. Additional states may be added in the
@@ -119,7 +122,7 @@ module Bandwidth
119
122
  @_hash['direction'] = 'direction'
120
123
  @_hash['state'] = 'state'
121
124
  @_hash['identity'] = 'identity'
122
- @_hash['pai'] = 'pai'
125
+ @_hash['stir_shaken'] = 'stirShaken'
123
126
  @_hash['start_time'] = 'startTime'
124
127
  @_hash['answer_time'] = 'answerTime'
125
128
  @_hash['end_time'] = 'endTime'
@@ -130,6 +133,42 @@ module Bandwidth
130
133
  @_hash
131
134
  end
132
135
 
136
+ # An array for optional fields
137
+ def optionals
138
+ %w[
139
+ call_id
140
+ parent_call_id
141
+ application_id
142
+ account_id
143
+ to
144
+ from
145
+ direction
146
+ state
147
+ identity
148
+ stir_shaken
149
+ start_time
150
+ answer_time
151
+ end_time
152
+ disconnect_cause
153
+ error_message
154
+ error_id
155
+ last_update
156
+ ]
157
+ end
158
+
159
+ # An array for nullable fields
160
+ def nullables
161
+ %w[
162
+ parent_call_id
163
+ identity
164
+ answer_time
165
+ end_time
166
+ disconnect_cause
167
+ error_message
168
+ error_id
169
+ ]
170
+ end
171
+
133
172
  def initialize(call_id = nil,
134
173
  parent_call_id = nil,
135
174
  application_id = nil,
@@ -139,7 +178,7 @@ module Bandwidth
139
178
  direction = nil,
140
179
  state = nil,
141
180
  identity = nil,
142
- pai = nil,
181
+ stir_shaken = nil,
143
182
  start_time = nil,
144
183
  answer_time = nil,
145
184
  end_time = nil,
@@ -147,23 +186,23 @@ module Bandwidth
147
186
  error_message = nil,
148
187
  error_id = nil,
149
188
  last_update = nil)
150
- @call_id = call_id
151
- @parent_call_id = parent_call_id
152
- @application_id = application_id
153
- @account_id = account_id
154
- @to = to
155
- @from = from
156
- @direction = direction
157
- @state = state
158
- @identity = identity
159
- @pai = pai
160
- @start_time = start_time
161
- @answer_time = answer_time
162
- @end_time = end_time
163
- @disconnect_cause = disconnect_cause
164
- @error_message = error_message
165
- @error_id = error_id
166
- @last_update = last_update
189
+ @call_id = call_id unless call_id == SKIP
190
+ @parent_call_id = parent_call_id unless parent_call_id == SKIP
191
+ @application_id = application_id unless application_id == SKIP
192
+ @account_id = account_id unless account_id == SKIP
193
+ @to = to unless to == SKIP
194
+ @from = from unless from == SKIP
195
+ @direction = direction unless direction == SKIP
196
+ @state = state unless state == SKIP
197
+ @identity = identity unless identity == SKIP
198
+ @stir_shaken = stir_shaken unless stir_shaken == SKIP
199
+ @start_time = start_time unless start_time == SKIP
200
+ @answer_time = answer_time unless answer_time == SKIP
201
+ @end_time = end_time unless end_time == SKIP
202
+ @disconnect_cause = disconnect_cause unless disconnect_cause == SKIP
203
+ @error_message = error_message unless error_message == SKIP
204
+ @error_id = error_id unless error_id == SKIP
205
+ @last_update = last_update unless last_update == SKIP
167
206
  end
168
207
 
169
208
  # Creates an instance of the object from a hash.
@@ -171,27 +210,40 @@ module Bandwidth
171
210
  return nil unless hash
172
211
 
173
212
  # Extract variables from the hash.
174
- call_id = hash['callId']
175
- parent_call_id = hash['parentCallId']
176
- application_id = hash['applicationId']
177
- account_id = hash['accountId']
178
- to = hash['to']
179
- from = hash['from']
180
- direction = hash['direction']
181
- state = hash['state']
182
- identity = hash['identity']
183
- pai = hash['pai']
184
- start_time = DateTimeHelper.from_rfc3339(hash['startTime']) if
185
- hash['startTime']
186
- answer_time = DateTimeHelper.from_rfc3339(hash['answerTime']) if
187
- hash['answerTime']
188
- end_time = DateTimeHelper.from_rfc3339(hash['endTime']) if
189
- hash['endTime']
190
- disconnect_cause = hash['disconnectCause']
191
- error_message = hash['errorMessage']
192
- error_id = hash['errorId']
193
- last_update = DateTimeHelper.from_rfc3339(hash['lastUpdate']) if
194
- hash['lastUpdate']
213
+ call_id = hash.key?('callId') ? hash['callId'] : SKIP
214
+ parent_call_id = hash.key?('parentCallId') ? hash['parentCallId'] : SKIP
215
+ application_id = hash.key?('applicationId') ? hash['applicationId'] : SKIP
216
+ account_id = hash.key?('accountId') ? hash['accountId'] : SKIP
217
+ to = hash.key?('to') ? hash['to'] : SKIP
218
+ from = hash.key?('from') ? hash['from'] : SKIP
219
+ direction = hash.key?('direction') ? hash['direction'] : SKIP
220
+ state = hash.key?('state') ? hash['state'] : SKIP
221
+ identity = hash.key?('identity') ? hash['identity'] : SKIP
222
+ stir_shaken = hash.key?('stirShaken') ? hash['stirShaken'] : SKIP
223
+ start_time = if hash.key?('startTime')
224
+ (DateTimeHelper.from_rfc3339(hash['startTime']) if hash['startTime'])
225
+ else
226
+ SKIP
227
+ end
228
+ answer_time = if hash.key?('answerTime')
229
+ (DateTimeHelper.from_rfc3339(hash['answerTime']) if hash['answerTime'])
230
+ else
231
+ SKIP
232
+ end
233
+ end_time = if hash.key?('endTime')
234
+ (DateTimeHelper.from_rfc3339(hash['endTime']) if hash['endTime'])
235
+ else
236
+ SKIP
237
+ end
238
+ disconnect_cause =
239
+ hash.key?('disconnectCause') ? hash['disconnectCause'] : SKIP
240
+ error_message = hash.key?('errorMessage') ? hash['errorMessage'] : SKIP
241
+ error_id = hash.key?('errorId') ? hash['errorId'] : SKIP
242
+ last_update = if hash.key?('lastUpdate')
243
+ (DateTimeHelper.from_rfc3339(hash['lastUpdate']) if hash['lastUpdate'])
244
+ else
245
+ SKIP
246
+ end
195
247
 
196
248
  # Create object from extracted values.
197
249
  CallState.new(call_id,
@@ -203,7 +255,7 @@ module Bandwidth
203
255
  direction,
204
256
  state,
205
257
  identity,
206
- pai,
258
+ stir_shaken,
207
259
  start_time,
208
260
  answer_time,
209
261
  end_time,
@@ -0,0 +1,211 @@
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 conference events
9
+ class ConferenceCallback < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # TODO: Write general description for this method
14
+ # @return [String]
15
+ attr_accessor :conference_id
16
+
17
+ # TODO: Write general description for this method
18
+ # @return [String]
19
+ attr_accessor :name
20
+
21
+ # TODO: Write general description for this method
22
+ # @return [String]
23
+ attr_accessor :event_type
24
+
25
+ # TODO: Write general description for this method
26
+ # @return [String]
27
+ attr_accessor :event_time
28
+
29
+ # TODO: Write general description for this method
30
+ # @return [String]
31
+ attr_accessor :tag
32
+
33
+ # TODO: Write general description for this method
34
+ # @return [String]
35
+ attr_accessor :call_id
36
+
37
+ # TODO: Write general description for this method
38
+ # @return [String]
39
+ attr_accessor :to
40
+
41
+ # TODO: Write general description for this method
42
+ # @return [String]
43
+ attr_accessor :from
44
+
45
+ # TODO: Write general description for this method
46
+ # @return [String]
47
+ attr_accessor :account_id
48
+
49
+ # TODO: Write general description for this method
50
+ # @return [String]
51
+ attr_accessor :recording_id
52
+
53
+ # TODO: Write general description for this method
54
+ # @return [Integer]
55
+ attr_accessor :channels
56
+
57
+ # TODO: Write general description for this method
58
+ # @return [String]
59
+ attr_accessor :start_time
60
+
61
+ # TODO: Write general description for this method
62
+ # @return [String]
63
+ attr_accessor :end_time
64
+
65
+ # TODO: Write general description for this method
66
+ # @return [String]
67
+ attr_accessor :duration
68
+
69
+ # TODO: Write general description for this method
70
+ # @return [String]
71
+ attr_accessor :file_format
72
+
73
+ # TODO: Write general description for this method
74
+ # @return [String]
75
+ attr_accessor :media_url
76
+
77
+ # TODO: Write general description for this method
78
+ # @return [String]
79
+ attr_accessor :status
80
+
81
+ # A mapping from model property names to API property names.
82
+ def self.names
83
+ @_hash = {} if @_hash.nil?
84
+ @_hash['conference_id'] = 'conferenceId'
85
+ @_hash['name'] = 'name'
86
+ @_hash['event_type'] = 'eventType'
87
+ @_hash['event_time'] = 'eventTime'
88
+ @_hash['tag'] = 'tag'
89
+ @_hash['call_id'] = 'callId'
90
+ @_hash['to'] = 'to'
91
+ @_hash['from'] = 'from'
92
+ @_hash['account_id'] = 'accountId'
93
+ @_hash['recording_id'] = 'recordingId'
94
+ @_hash['channels'] = 'channels'
95
+ @_hash['start_time'] = 'startTime'
96
+ @_hash['end_time'] = 'endTime'
97
+ @_hash['duration'] = 'duration'
98
+ @_hash['file_format'] = 'fileFormat'
99
+ @_hash['media_url'] = 'mediaUrl'
100
+ @_hash['status'] = 'status'
101
+ @_hash
102
+ end
103
+
104
+ # An array for optional fields
105
+ def optionals
106
+ %w[
107
+ conference_id
108
+ name
109
+ event_type
110
+ event_time
111
+ tag
112
+ call_id
113
+ to
114
+ from
115
+ account_id
116
+ recording_id
117
+ channels
118
+ start_time
119
+ end_time
120
+ duration
121
+ file_format
122
+ media_url
123
+ status
124
+ ]
125
+ end
126
+
127
+ # An array for nullable fields
128
+ def nullables
129
+ []
130
+ end
131
+
132
+ def initialize(conference_id = nil,
133
+ name = nil,
134
+ event_type = nil,
135
+ event_time = nil,
136
+ tag = nil,
137
+ call_id = nil,
138
+ to = nil,
139
+ from = nil,
140
+ account_id = nil,
141
+ recording_id = nil,
142
+ channels = nil,
143
+ start_time = nil,
144
+ end_time = nil,
145
+ duration = nil,
146
+ file_format = nil,
147
+ media_url = nil,
148
+ status = nil)
149
+ @conference_id = conference_id unless conference_id == SKIP
150
+ @name = name unless name == SKIP
151
+ @event_type = event_type unless event_type == SKIP
152
+ @event_time = event_time unless event_time == SKIP
153
+ @tag = tag unless tag == SKIP
154
+ @call_id = call_id unless call_id == SKIP
155
+ @to = to unless to == SKIP
156
+ @from = from unless from == SKIP
157
+ @account_id = account_id unless account_id == SKIP
158
+ @recording_id = recording_id unless recording_id == SKIP
159
+ @channels = channels unless channels == SKIP
160
+ @start_time = start_time unless start_time == SKIP
161
+ @end_time = end_time unless end_time == SKIP
162
+ @duration = duration unless duration == SKIP
163
+ @file_format = file_format unless file_format == SKIP
164
+ @media_url = media_url unless media_url == SKIP
165
+ @status = status unless status == SKIP
166
+ end
167
+
168
+ # Creates an instance of the object from a hash.
169
+ def self.from_hash(hash)
170
+ return nil unless hash
171
+
172
+ # Extract variables from the hash.
173
+ conference_id = hash.key?('conferenceId') ? hash['conferenceId'] : SKIP
174
+ name = hash.key?('name') ? hash['name'] : SKIP
175
+ event_type = hash.key?('eventType') ? hash['eventType'] : SKIP
176
+ event_time = hash.key?('eventTime') ? hash['eventTime'] : SKIP
177
+ tag = hash.key?('tag') ? hash['tag'] : SKIP
178
+ call_id = hash.key?('callId') ? hash['callId'] : SKIP
179
+ to = hash.key?('to') ? hash['to'] : SKIP
180
+ from = hash.key?('from') ? hash['from'] : SKIP
181
+ account_id = hash.key?('accountId') ? hash['accountId'] : SKIP
182
+ recording_id = hash.key?('recordingId') ? hash['recordingId'] : SKIP
183
+ channels = hash.key?('channels') ? hash['channels'] : SKIP
184
+ start_time = hash.key?('startTime') ? hash['startTime'] : SKIP
185
+ end_time = hash.key?('endTime') ? hash['endTime'] : SKIP
186
+ duration = hash.key?('duration') ? hash['duration'] : SKIP
187
+ file_format = hash.key?('fileFormat') ? hash['fileFormat'] : SKIP
188
+ media_url = hash.key?('mediaUrl') ? hash['mediaUrl'] : SKIP
189
+ status = hash.key?('status') ? hash['status'] : SKIP
190
+
191
+ # Create object from extracted values.
192
+ ConferenceCallback.new(conference_id,
193
+ name,
194
+ event_type,
195
+ event_time,
196
+ tag,
197
+ call_id,
198
+ to,
199
+ from,
200
+ account_id,
201
+ recording_id,
202
+ channels,
203
+ start_time,
204
+ end_time,
205
+ duration,
206
+ file_format,
207
+ media_url,
208
+ status)
209
+ end
210
+ end
211
+ end
@@ -6,6 +6,9 @@
6
6
  module Bandwidth
7
7
  # ConferenceMemberState Model.
8
8
  class ConferenceMemberState < BaseModel
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 :call_id
@@ -42,18 +45,37 @@ module Bandwidth
42
45
  @_hash
43
46
  end
44
47
 
48
+ # An array for optional fields
49
+ def optionals
50
+ %w[
51
+ call_id
52
+ conference_id
53
+ member_url
54
+ mute
55
+ hold
56
+ call_ids_to_coach
57
+ ]
58
+ end
59
+
60
+ # An array for nullable fields
61
+ def nullables
62
+ %w[
63
+ call_ids_to_coach
64
+ ]
65
+ end
66
+
45
67
  def initialize(call_id = nil,
46
68
  conference_id = nil,
47
69
  member_url = nil,
48
70
  mute = nil,
49
71
  hold = nil,
50
72
  call_ids_to_coach = nil)
51
- @call_id = call_id
52
- @conference_id = conference_id
53
- @member_url = member_url
54
- @mute = mute
55
- @hold = hold
56
- @call_ids_to_coach = call_ids_to_coach
73
+ @call_id = call_id unless call_id == SKIP
74
+ @conference_id = conference_id unless conference_id == SKIP
75
+ @member_url = member_url unless member_url == SKIP
76
+ @mute = mute unless mute == SKIP
77
+ @hold = hold unless hold == SKIP
78
+ @call_ids_to_coach = call_ids_to_coach unless call_ids_to_coach == SKIP
57
79
  end
58
80
 
59
81
  # Creates an instance of the object from a hash.
@@ -61,12 +83,13 @@ module Bandwidth
61
83
  return nil unless hash
62
84
 
63
85
  # Extract variables from the hash.
64
- call_id = hash['callId']
65
- conference_id = hash['conferenceId']
66
- member_url = hash['memberUrl']
67
- mute = hash['mute']
68
- hold = hash['hold']
69
- call_ids_to_coach = hash['callIdsToCoach']
86
+ call_id = hash.key?('callId') ? hash['callId'] : SKIP
87
+ conference_id = hash.key?('conferenceId') ? hash['conferenceId'] : SKIP
88
+ member_url = hash.key?('memberUrl') ? hash['memberUrl'] : SKIP
89
+ mute = hash.key?('mute') ? hash['mute'] : SKIP
90
+ hold = hash.key?('hold') ? hash['hold'] : SKIP
91
+ call_ids_to_coach =
92
+ hash.key?('callIdsToCoach') ? hash['callIdsToCoach'] : SKIP
70
93
 
71
94
  # Create object from extracted values.
72
95
  ConferenceMemberState.new(call_id,
@@ -7,6 +7,9 @@ require 'date'
7
7
  module Bandwidth
8
8
  # ConferenceRecordingMetadata Model.
9
9
  class ConferenceRecordingMetadata < 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
@@ -74,6 +77,28 @@ module Bandwidth
74
77
  @_hash
75
78
  end
76
79
 
80
+ # An array for optional fields
81
+ def optionals
82
+ %w[
83
+ account_id
84
+ conference_id
85
+ name
86
+ recording_id
87
+ duration
88
+ channels
89
+ start_time
90
+ end_time
91
+ file_format
92
+ status
93
+ media_url
94
+ ]
95
+ end
96
+
97
+ # An array for nullable fields
98
+ def nullables
99
+ []
100
+ end
101
+
77
102
  def initialize(account_id = nil,
78
103
  conference_id = nil,
79
104
  name = nil,
@@ -85,17 +110,17 @@ module Bandwidth
85
110
  file_format = nil,
86
111
  status = nil,
87
112
  media_url = nil)
88
- @account_id = account_id
89
- @conference_id = conference_id
90
- @name = name
91
- @recording_id = recording_id
92
- @duration = duration
93
- @channels = channels
94
- @start_time = start_time
95
- @end_time = end_time
96
- @file_format = file_format
97
- @status = status
98
- @media_url = media_url
113
+ @account_id = account_id unless account_id == SKIP
114
+ @conference_id = conference_id unless conference_id == SKIP
115
+ @name = name unless name == SKIP
116
+ @recording_id = recording_id unless recording_id == SKIP
117
+ @duration = duration unless duration == SKIP
118
+ @channels = channels unless channels == SKIP
119
+ @start_time = start_time unless start_time == SKIP
120
+ @end_time = end_time unless end_time == SKIP
121
+ @file_format = file_format unless file_format == SKIP
122
+ @status = status unless status == SKIP
123
+ @media_url = media_url unless media_url == SKIP
99
124
  end
100
125
 
101
126
  # Creates an instance of the object from a hash.
@@ -103,19 +128,25 @@ module Bandwidth
103
128
  return nil unless hash
104
129
 
105
130
  # Extract variables from the hash.
106
- account_id = hash['accountId']
107
- conference_id = hash['conferenceId']
108
- name = hash['name']
109
- recording_id = hash['recordingId']
110
- duration = hash['duration']
111
- channels = hash['channels']
112
- start_time = DateTimeHelper.from_rfc3339(hash['startTime']) if
113
- hash['startTime']
114
- end_time = DateTimeHelper.from_rfc3339(hash['endTime']) if
115
- hash['endTime']
116
- file_format = hash['fileFormat']
117
- status = hash['status']
118
- media_url = hash['mediaUrl']
131
+ account_id = hash.key?('accountId') ? hash['accountId'] : SKIP
132
+ conference_id = hash.key?('conferenceId') ? hash['conferenceId'] : SKIP
133
+ name = hash.key?('name') ? hash['name'] : SKIP
134
+ recording_id = hash.key?('recordingId') ? hash['recordingId'] : SKIP
135
+ duration = hash.key?('duration') ? hash['duration'] : SKIP
136
+ channels = hash.key?('channels') ? hash['channels'] : SKIP
137
+ start_time = if hash.key?('startTime')
138
+ (DateTimeHelper.from_rfc3339(hash['startTime']) if hash['startTime'])
139
+ else
140
+ SKIP
141
+ end
142
+ end_time = if hash.key?('endTime')
143
+ (DateTimeHelper.from_rfc3339(hash['endTime']) if hash['endTime'])
144
+ else
145
+ SKIP
146
+ end
147
+ file_format = hash.key?('fileFormat') ? hash['fileFormat'] : SKIP
148
+ status = hash.key?('status') ? hash['status'] : SKIP
149
+ media_url = hash.key?('mediaUrl') ? hash['mediaUrl'] : SKIP
119
150
 
120
151
  # Create object from extracted values.
121
152
  ConferenceRecordingMetadata.new(account_id,
@@ -7,6 +7,9 @@ require 'date'
7
7
  module Bandwidth
8
8
  # ConferenceState Model.
9
9
  class ConferenceState < 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 :id
@@ -53,6 +56,30 @@ module Bandwidth
53
56
  @_hash
54
57
  end
55
58
 
59
+ # An array for optional fields
60
+ def optionals
61
+ %w[
62
+ id
63
+ name
64
+ created_time
65
+ completed_time
66
+ conference_event_url
67
+ conference_event_method
68
+ tag
69
+ active_members
70
+ ]
71
+ end
72
+
73
+ # An array for nullable fields
74
+ def nullables
75
+ %w[
76
+ completed_time
77
+ conference_event_url
78
+ conference_event_method
79
+ tag
80
+ ]
81
+ end
82
+
56
83
  def initialize(id = nil,
57
84
  name = nil,
58
85
  created_time = nil,
@@ -61,14 +88,14 @@ module Bandwidth
61
88
  conference_event_method = nil,
62
89
  tag = nil,
63
90
  active_members = nil)
64
- @id = id
65
- @name = name
66
- @created_time = created_time
67
- @completed_time = completed_time
68
- @conference_event_url = conference_event_url
69
- @conference_event_method = conference_event_method
70
- @tag = tag
71
- @active_members = active_members
91
+ @id = id unless id == SKIP
92
+ @name = name unless name == SKIP
93
+ @created_time = created_time unless created_time == SKIP
94
+ @completed_time = completed_time unless completed_time == SKIP
95
+ @conference_event_url = conference_event_url unless conference_event_url == SKIP
96
+ @conference_event_method = conference_event_method unless conference_event_method == SKIP
97
+ @tag = tag unless tag == SKIP
98
+ @active_members = active_members unless active_members == SKIP
72
99
  end
73
100
 
74
101
  # Creates an instance of the object from a hash.
@@ -76,15 +103,23 @@ module Bandwidth
76
103
  return nil unless hash
77
104
 
78
105
  # Extract variables from the hash.
79
- id = hash['id']
80
- name = hash['name']
81
- created_time = DateTimeHelper.from_rfc3339(hash['createdTime']) if
82
- hash['createdTime']
83
- completed_time = DateTimeHelper.from_rfc3339(hash['completedTime']) if
84
- hash['completedTime']
85
- conference_event_url = hash['conferenceEventUrl']
86
- conference_event_method = hash['conferenceEventMethod']
87
- tag = hash['tag']
106
+ id = hash.key?('id') ? hash['id'] : SKIP
107
+ name = hash.key?('name') ? hash['name'] : SKIP
108
+ created_time = if hash.key?('createdTime')
109
+ (DateTimeHelper.from_rfc3339(hash['createdTime']) if hash['createdTime'])
110
+ else
111
+ SKIP
112
+ end
113
+ completed_time = if hash.key?('completedTime')
114
+ (DateTimeHelper.from_rfc3339(hash['completedTime']) if hash['completedTime'])
115
+ else
116
+ SKIP
117
+ end
118
+ conference_event_url =
119
+ hash.key?('conferenceEventUrl') ? hash['conferenceEventUrl'] : SKIP
120
+ conference_event_method =
121
+ hash.key?('conferenceEventMethod') ? hash['conferenceEventMethod'] : SKIP
122
+ tag = hash.key?('tag') ? hash['tag'] : SKIP
88
123
  # Parameter is an array, so we need to iterate through it
89
124
  active_members = nil
90
125
  unless hash['activeMembers'].nil?
@@ -94,6 +129,8 @@ module Bandwidth
94
129
  end
95
130
  end
96
131
 
132
+ active_members = SKIP unless hash.key?('activeMembers')
133
+
97
134
  # Create object from extracted values.
98
135
  ConferenceState.new(id,
99
136
  name,