bandwidth-sdk 3.4.0 → 3.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/lib/bandwidth.rb +2 -0
  3. data/lib/bandwidth/api_helper.rb +14 -9
  4. data/lib/bandwidth/client.rb +11 -2
  5. data/lib/bandwidth/configuration.rb +23 -5
  6. data/lib/bandwidth/http/auth/web_rtc_basic_auth.rb +22 -0
  7. data/lib/bandwidth/messaging_lib/messaging/client.rb +7 -2
  8. data/lib/bandwidth/messaging_lib/messaging/controllers/api_controller.rb +18 -12
  9. data/lib/bandwidth/messaging_lib/messaging/controllers/base_controller.rb +1 -1
  10. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth.rb +1 -0
  11. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/client.rb +7 -2
  12. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/controllers/api_controller.rb +38 -9
  13. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/controllers/base_controller.rb +1 -1
  14. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/exceptions/invalid_request_exception.rb +29 -0
  15. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_code_request_schema.rb +30 -4
  16. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_verify_request_schema.rb +33 -10
  17. data/lib/bandwidth/voice_lib/bxml/verbs/bridge.rb +22 -0
  18. data/lib/bandwidth/voice_lib/voice.rb +6 -2
  19. data/lib/bandwidth/voice_lib/voice/client.rb +7 -2
  20. data/lib/bandwidth/voice_lib/voice/controllers/api_controller.rb +625 -55
  21. data/lib/bandwidth/voice_lib/voice/controllers/base_controller.rb +1 -1
  22. data/lib/bandwidth/voice_lib/voice/models/call_engine_modify_conference_request.rb +38 -2
  23. data/lib/bandwidth/voice_lib/voice/models/conference_detail.rb +105 -0
  24. data/lib/bandwidth/voice_lib/voice/models/conference_event_method_enum.rb +35 -0
  25. data/lib/bandwidth/voice_lib/voice/models/conference_member_detail.rb +80 -0
  26. data/lib/bandwidth/voice_lib/voice/models/conference_recording_metadata_response.rb +125 -0
  27. data/lib/bandwidth/voice_lib/voice/models/recording_metadata_response.rb +27 -0
  28. data/lib/bandwidth/voice_lib/voice/models/status1_enum.rb +4 -1
  29. data/lib/bandwidth/voice_lib/voice/models/{status2_enum.rb → status3_enum.rb} +3 -3
  30. data/lib/bandwidth/voice_lib/voice/models/transcription.rb +1 -1
  31. data/lib/bandwidth/web_rtc_lib/web_rtc.rb +21 -0
  32. data/lib/bandwidth/web_rtc_lib/web_rtc/client.rb +49 -0
  33. data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/api_controller.rb +692 -0
  34. data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/base_controller.rb +49 -0
  35. data/lib/bandwidth/web_rtc_lib/web_rtc/exceptions/error_exception.rb +34 -0
  36. data/lib/bandwidth/web_rtc_lib/web_rtc/models/accounts_participants_response.rb +47 -0
  37. data/lib/bandwidth/web_rtc_lib/web_rtc/models/participant.rb +83 -0
  38. data/lib/bandwidth/web_rtc_lib/web_rtc/models/participant_subscription.rb +35 -0
  39. data/lib/bandwidth/web_rtc_lib/web_rtc/models/publish_permission_enum.rb +17 -0
  40. data/lib/bandwidth/web_rtc_lib/web_rtc/models/session.rb +44 -0
  41. data/lib/bandwidth/web_rtc_lib/web_rtc/models/subscriptions.rb +54 -0
  42. metadata +41 -11
@@ -0,0 +1,29 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Bandwidth
7
+ # InvalidRequest class.
8
+ class InvalidRequestException < APIException
9
+ # An error message pertaining to what the issue could be
10
+ # @return [String]
11
+ attr_accessor :result
12
+
13
+ # The constructor.
14
+ # @param [String] The reason for raising an exception.
15
+ # @param [HttpResponse] The HttpReponse of the API call.
16
+ def initialize(reason, response)
17
+ super(reason, response)
18
+ hash = APIHelper.json_deserialize(@response.raw_body)
19
+ unbox(hash)
20
+ end
21
+
22
+ # Populates this object by extracting properties from a hash.
23
+ # @param [Hash] The deserialized response sent by the server in the
24
+ # response body.
25
+ def unbox(hash)
26
+ @result = hash['result']
27
+ end
28
+ end
29
+ end
@@ -6,22 +6,38 @@
6
6
  module Bandwidth
7
7
  # TwoFactorCodeRequestSchema Model.
8
8
  class TwoFactorCodeRequestSchema < BaseModel
9
- # TODO: Write general description for this method
9
+ # The phone number to send the 2fa code to.
10
10
  # @return [String]
11
11
  attr_accessor :to
12
12
 
13
- # TODO: Write general description for this method
13
+ # The application phone number, the sender of the 2fa code.
14
14
  # @return [String]
15
15
  attr_accessor :from
16
16
 
17
- # TODO: Write general description for this method
17
+ # The application unique ID, obtained from Bandwidth.
18
18
  # @return [String]
19
19
  attr_accessor :application_id
20
20
 
21
- # TODO: Write general description for this method
21
+ # An optional field to denote what scope or action the 2fa code is
22
+ # addressing. If not supplied, defaults to "2FA".
22
23
  # @return [String]
23
24
  attr_accessor :scope
24
25
 
26
+ # The message format of the 2fa code. There are three values that the
27
+ # system will replace "{CODE}", "{NAME}", "{SCOPE}". The "{SCOPE}" and
28
+ # "{NAME} value template are optional, while "{CODE}" must be supplied. As
29
+ # the name would suggest, code will be replace with the actual 2fa code.
30
+ # Name is replaced with the application name, configured during provisioning
31
+ # of 2fa. The scope value is the same value sent during the call and
32
+ # partitioned by the server.
33
+ # @return [String]
34
+ attr_accessor :message
35
+
36
+ # The number of digits for your 2fa code. The valid number ranges from 2 to
37
+ # 8, inclusively.
38
+ # @return [Float]
39
+ attr_accessor :digits
40
+
25
41
  # A mapping from model property names to API property names.
26
42
  def self.names
27
43
  @_hash = {} if @_hash.nil?
@@ -29,17 +45,23 @@ module Bandwidth
29
45
  @_hash['from'] = 'from'
30
46
  @_hash['application_id'] = 'applicationId'
31
47
  @_hash['scope'] = 'scope'
48
+ @_hash['message'] = 'message'
49
+ @_hash['digits'] = 'digits'
32
50
  @_hash
33
51
  end
34
52
 
35
53
  def initialize(to = nil,
36
54
  from = nil,
37
55
  application_id = nil,
56
+ message = nil,
57
+ digits = nil,
38
58
  scope = nil)
39
59
  @to = to
40
60
  @from = from
41
61
  @application_id = application_id
42
62
  @scope = scope
63
+ @message = message
64
+ @digits = digits
43
65
  end
44
66
 
45
67
  # Creates an instance of the object from a hash.
@@ -50,12 +72,16 @@ module Bandwidth
50
72
  to = hash['to']
51
73
  from = hash['from']
52
74
  application_id = hash['applicationId']
75
+ message = hash['message']
76
+ digits = hash['digits']
53
77
  scope = hash['scope']
54
78
 
55
79
  # Create object from extracted values.
56
80
  TwoFactorCodeRequestSchema.new(to,
57
81
  from,
58
82
  application_id,
83
+ message,
84
+ digits,
59
85
  scope)
60
86
  end
61
87
  end
@@ -6,23 +6,36 @@
6
6
  module Bandwidth
7
7
  # TwoFactorVerifyRequestSchema Model.
8
8
  class TwoFactorVerifyRequestSchema < BaseModel
9
- # TODO: Write general description for this method
9
+ # The phone number to send the 2fa code to.
10
10
  # @return [String]
11
11
  attr_accessor :to
12
12
 
13
- # TODO: Write general description for this method
13
+ # The application phone number, the sender of the 2fa code.
14
14
  # @return [String]
15
15
  attr_accessor :from
16
16
 
17
- # TODO: Write general description for this method
17
+ # The application unique ID, obtained from Bandwidth.
18
18
  # @return [String]
19
19
  attr_accessor :application_id
20
20
 
21
- # TODO: Write general description for this method
21
+ # An optional field to denote what scope or action the 2fa code is
22
+ # addressing. If not supplied, defaults to "2FA".
22
23
  # @return [String]
23
24
  attr_accessor :scope
24
25
 
25
- # TODO: Write general description for this method
26
+ # The number of digits for your 2fa code. The valid number ranges from 2 to
27
+ # 8, inclusively.
28
+ # @return [Float]
29
+ attr_accessor :digits
30
+
31
+ # The time period, in minutes, to validate the 2fa code. By setting this to
32
+ # 3 minutes, it will mean any code generated within the last 3 minutes are
33
+ # still valid. The valid range for expiration time is between 0 and 15
34
+ # minutes, exclusively and inclusively, respectively.
35
+ # @return [Float]
36
+ attr_accessor :expiration_time_in_minutes
37
+
38
+ # The generated 2fa code to check if valid
26
39
  # @return [String]
27
40
  attr_accessor :code
28
41
 
@@ -33,6 +46,8 @@ module Bandwidth
33
46
  @_hash['from'] = 'from'
34
47
  @_hash['application_id'] = 'applicationId'
35
48
  @_hash['scope'] = 'scope'
49
+ @_hash['digits'] = 'digits'
50
+ @_hash['expiration_time_in_minutes'] = 'expirationTimeInMinutes'
36
51
  @_hash['code'] = 'code'
37
52
  @_hash
38
53
  end
@@ -40,12 +55,16 @@ module Bandwidth
40
55
  def initialize(to = nil,
41
56
  from = nil,
42
57
  application_id = nil,
43
- scope = nil,
44
- code = nil)
58
+ digits = nil,
59
+ expiration_time_in_minutes = nil,
60
+ code = nil,
61
+ scope = nil)
45
62
  @to = to
46
63
  @from = from
47
64
  @application_id = application_id
48
65
  @scope = scope
66
+ @digits = digits
67
+ @expiration_time_in_minutes = expiration_time_in_minutes
49
68
  @code = code
50
69
  end
51
70
 
@@ -57,15 +76,19 @@ module Bandwidth
57
76
  to = hash['to']
58
77
  from = hash['from']
59
78
  application_id = hash['applicationId']
60
- scope = hash['scope']
79
+ digits = hash['digits']
80
+ expiration_time_in_minutes = hash['expirationTimeInMinutes']
61
81
  code = hash['code']
82
+ scope = hash['scope']
62
83
 
63
84
  # Create object from extracted values.
64
85
  TwoFactorVerifyRequestSchema.new(to,
65
86
  from,
66
87
  application_id,
67
- scope,
68
- code)
88
+ digits,
89
+ expiration_time_in_minutes,
90
+ code,
91
+ scope)
69
92
  end
70
93
  end
71
94
  end
@@ -0,0 +1,22 @@
1
+ require_relative 'xml_verb'
2
+
3
+ module Bandwidth
4
+ module Voice
5
+ # The Bridge verb allows you to connect 2 calls
6
+ class Bridge
7
+ include XmlVerb
8
+
9
+ def to_bxml(xml)
10
+ xml.Bridge(call_id, compact_hash({
11
+ 'bridgeCompleteUrl' => bridge_complete_url,
12
+ 'bridgeCompleteMethod' => bridge_complete_method,
13
+ 'bridgeTargetCompleteUrl' => bridge_target_complete_url,
14
+ 'bridgeTargetCompleteMethod' => bridge_target_complete_method,
15
+ 'username' => username,
16
+ 'password' => password,
17
+ 'tag' => tag
18
+ }))
19
+ end
20
+ end
21
+ end
22
+ end
@@ -11,8 +11,11 @@ require_relative 'voice/models/api_call_response.rb'
11
11
  require_relative 'voice/models/api_call_state_response.rb'
12
12
  require_relative 'voice/models/api_create_call_request.rb'
13
13
  require_relative 'voice/models/api_modify_call_request.rb'
14
- require_relative 'voice/models/api_transcribe_recording_request.rb'
15
14
  require_relative 'voice/models/call_engine_modify_conference_request.rb'
15
+ require_relative 'voice/models/api_transcribe_recording_request.rb'
16
+ require_relative 'voice/models/conference_detail.rb'
17
+ require_relative 'voice/models/conference_member_detail.rb'
18
+ require_relative 'voice/models/conference_recording_metadata_response.rb'
16
19
  require_relative 'voice/models/modify_call_recording_state.rb'
17
20
  require_relative 'voice/models/recording_metadata_response.rb'
18
21
  require_relative 'voice/models/transcript.rb'
@@ -20,6 +23,7 @@ require_relative 'voice/models/transcription.rb'
20
23
  require_relative 'voice/models/transcription_response.rb'
21
24
  require_relative 'voice/models/answer_method_enum.rb'
22
25
  require_relative 'voice/models/callback_method_enum.rb'
26
+ require_relative 'voice/models/conference_event_method_enum.rb'
23
27
  require_relative 'voice/models/direction_enum.rb'
24
28
  require_relative 'voice/models/disconnect_cause_enum.rb'
25
29
  require_relative 'voice/models/disconnect_method_enum.rb'
@@ -30,7 +34,7 @@ require_relative 'voice/models/state1_enum.rb'
30
34
  require_relative 'voice/models/state2_enum.rb'
31
35
  require_relative 'voice/models/status_enum.rb'
32
36
  require_relative 'voice/models/status1_enum.rb'
33
- require_relative 'voice/models/status2_enum.rb'
37
+ require_relative 'voice/models/status3_enum.rb'
34
38
 
35
39
  # Exceptions
36
40
  require_relative 'voice/exceptions/api_error_response_exception.rb'
@@ -22,7 +22,10 @@ module Bandwidth
22
22
  two_factor_auth_basic_auth_user_name: 'TODO: Replace',
23
23
  two_factor_auth_basic_auth_password: 'TODO: Replace',
24
24
  voice_basic_auth_user_name: 'TODO: Replace',
25
- voice_basic_auth_password: 'TODO: Replace', config: nil)
25
+ voice_basic_auth_password: 'TODO: Replace',
26
+ web_rtc_basic_auth_user_name: 'TODO: Replace',
27
+ web_rtc_basic_auth_password: 'TODO: Replace',
28
+ config: nil)
26
29
  @config = if config.nil?
27
30
  Configuration.new(timeout: timeout,
28
31
  max_retries: max_retries,
@@ -34,7 +37,9 @@ module Bandwidth
34
37
  two_factor_auth_basic_auth_user_name: two_factor_auth_basic_auth_user_name,
35
38
  two_factor_auth_basic_auth_password: two_factor_auth_basic_auth_password,
36
39
  voice_basic_auth_user_name: voice_basic_auth_user_name,
37
- voice_basic_auth_password: voice_basic_auth_password)
40
+ voice_basic_auth_password: voice_basic_auth_password,
41
+ web_rtc_basic_auth_user_name: web_rtc_basic_auth_user_name,
42
+ web_rtc_basic_auth_password: web_rtc_basic_auth_password)
38
43
  else
39
44
  config
40
45
  end
@@ -22,7 +22,7 @@ module Voice
22
22
  _query_builder << '/api/v2/accounts/{accountId}/calls'
23
23
  _query_builder = APIHelper.append_url_with_template_parameters(
24
24
  _query_builder,
25
- 'accountId' => account_id
25
+ 'accountId' => { 'value' => account_id, 'encode' => true }
26
26
  )
27
27
  _query_url = APIHelper.clean_url _query_builder
28
28
 
@@ -86,7 +86,9 @@ module Voice
86
86
 
87
87
  # Return appropriate response type.
88
88
  decoded = APIHelper.json_deserialize(_response.raw_body)
89
- ApiResponse.new(_response, data: ApiCallResponse.from_hash(decoded))
89
+ ApiResponse.new(
90
+ _response, data: ApiCallResponse.from_hash(decoded)
91
+ )
90
92
  end
91
93
 
92
94
  # Returns near-realtime metadata about the specified call
@@ -100,8 +102,8 @@ module Voice
100
102
  _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}'
101
103
  _query_builder = APIHelper.append_url_with_template_parameters(
102
104
  _query_builder,
103
- 'accountId' => account_id,
104
- 'callId' => call_id
105
+ 'accountId' => { 'value' => account_id, 'encode' => true },
106
+ 'callId' => { 'value' => call_id, 'encode' => true }
105
107
  )
106
108
  _query_url = APIHelper.clean_url _query_builder
107
109
 
@@ -163,7 +165,9 @@ module Voice
163
165
 
164
166
  # Return appropriate response type.
165
167
  decoded = APIHelper.json_deserialize(_response.raw_body)
166
- ApiResponse.new(_response, data: ApiCallStateResponse.from_hash(decoded))
168
+ ApiResponse.new(
169
+ _response, data: ApiCallStateResponse.from_hash(decoded)
170
+ )
167
171
  end
168
172
 
169
173
  # Interrupts and replaces an active call's BXML document
@@ -179,8 +183,8 @@ module Voice
179
183
  _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}'
180
184
  _query_builder = APIHelper.append_url_with_template_parameters(
181
185
  _query_builder,
182
- 'accountId' => account_id,
183
- 'callId' => call_id
186
+ 'accountId' => { 'value' => account_id, 'encode' => true },
187
+ 'callId' => { 'value' => call_id, 'encode' => true }
184
188
  )
185
189
  _query_url = APIHelper.clean_url _query_builder
186
190
 
@@ -258,8 +262,8 @@ module Voice
258
262
  _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recording'
259
263
  _query_builder = APIHelper.append_url_with_template_parameters(
260
264
  _query_builder,
261
- 'accountId' => account_id,
262
- 'callId' => call_id
265
+ 'accountId' => { 'value' => account_id, 'encode' => true },
266
+ 'callId' => { 'value' => call_id, 'encode' => true }
263
267
  )
264
268
  _query_url = APIHelper.clean_url _query_builder
265
269
 
@@ -328,31 +332,16 @@ module Voice
328
332
  # took place during the specified call
329
333
  # @param [String] account_id Required parameter: Example:
330
334
  # @param [String] call_id Required parameter: Example:
331
- # @param [String] from Optional parameter: Example:
332
- # @param [String] to Optional parameter: Example:
333
- # @param [String] min_start_time Optional parameter: Example:
334
- # @param [String] max_start_time Optional parameter: Example:
335
335
  # @return [List of RecordingMetadataResponse] response from the API call
336
336
  def get_query_metadata_for_account_and_call(account_id,
337
- call_id,
338
- from: nil,
339
- to: nil,
340
- min_start_time: nil,
341
- max_start_time: nil)
337
+ call_id)
342
338
  # Prepare query url.
343
339
  _query_builder = config.get_base_uri(Server::VOICEDEFAULT)
344
340
  _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings'
345
341
  _query_builder = APIHelper.append_url_with_template_parameters(
346
342
  _query_builder,
347
- 'accountId' => account_id,
348
- 'callId' => call_id
349
- )
350
- _query_builder = APIHelper.append_url_with_query_parameters(
351
- _query_builder,
352
- 'from' => from,
353
- 'to' => to,
354
- 'minStartTime' => min_start_time,
355
- 'maxStartTime' => max_start_time
343
+ 'accountId' => { 'value' => account_id, 'encode' => true },
344
+ 'callId' => { 'value' => call_id, 'encode' => true }
356
345
  )
357
346
  _query_url = APIHelper.clean_url _query_builder
358
347
 
@@ -433,9 +422,9 @@ module Voice
433
422
  _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}'
434
423
  _query_builder = APIHelper.append_url_with_template_parameters(
435
424
  _query_builder,
436
- 'accountId' => account_id,
437
- 'callId' => call_id,
438
- 'recordingId' => recording_id
425
+ 'accountId' => { 'value' => account_id, 'encode' => true },
426
+ 'callId' => { 'value' => call_id, 'encode' => true },
427
+ 'recordingId' => { 'value' => recording_id, 'encode' => true }
439
428
  )
440
429
  _query_url = APIHelper.clean_url _query_builder
441
430
 
@@ -497,8 +486,9 @@ module Voice
497
486
 
498
487
  # Return appropriate response type.
499
488
  decoded = APIHelper.json_deserialize(_response.raw_body)
500
- ApiResponse.new(_response,
501
- data: RecordingMetadataResponse.from_hash(decoded))
489
+ ApiResponse.new(
490
+ _response, data: RecordingMetadataResponse.from_hash(decoded)
491
+ )
502
492
  end
503
493
 
504
494
  # Deletes the specified recording
@@ -514,9 +504,9 @@ module Voice
514
504
  _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}'
515
505
  _query_builder = APIHelper.append_url_with_template_parameters(
516
506
  _query_builder,
517
- 'accountId' => account_id,
518
- 'callId' => call_id,
519
- 'recordingId' => recording_id
507
+ 'accountId' => { 'value' => account_id, 'encode' => true },
508
+ 'callId' => { 'value' => call_id, 'encode' => true },
509
+ 'recordingId' => { 'value' => recording_id, 'encode' => true }
520
510
  )
521
511
  _query_url = APIHelper.clean_url _query_builder
522
512
 
@@ -587,9 +577,9 @@ module Voice
587
577
  _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media'
588
578
  _query_builder = APIHelper.append_url_with_template_parameters(
589
579
  _query_builder,
590
- 'accountId' => account_id,
591
- 'callId' => call_id,
592
- 'recordingId' => recording_id
580
+ 'accountId' => { 'value' => account_id, 'encode' => true },
581
+ 'callId' => { 'value' => call_id, 'encode' => true },
582
+ 'recordingId' => { 'value' => recording_id, 'encode' => true }
593
583
  )
594
584
  _query_url = APIHelper.clean_url _query_builder
595
585
 
@@ -644,7 +634,9 @@ module Voice
644
634
  validate_response(_response)
645
635
 
646
636
  # Return appropriate response type.
647
- ApiResponse.new(_response, data: _response.raw_body)
637
+ ApiResponse.new(
638
+ _response, data: _response.raw_body
639
+ )
648
640
  end
649
641
 
650
642
  # Deletes the specified recording's media
@@ -660,9 +652,9 @@ module Voice
660
652
  _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media'
661
653
  _query_builder = APIHelper.append_url_with_template_parameters(
662
654
  _query_builder,
663
- 'accountId' => account_id,
664
- 'callId' => call_id,
665
- 'recordingId' => recording_id
655
+ 'accountId' => { 'value' => account_id, 'encode' => true },
656
+ 'callId' => { 'value' => call_id, 'encode' => true },
657
+ 'recordingId' => { 'value' => recording_id, 'encode' => true }
666
658
  )
667
659
  _query_url = APIHelper.clean_url _query_builder
668
660
 
@@ -733,9 +725,9 @@ module Voice
733
725
  _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'
734
726
  _query_builder = APIHelper.append_url_with_template_parameters(
735
727
  _query_builder,
736
- 'accountId' => account_id,
737
- 'callId' => call_id,
738
- 'recordingId' => recording_id
728
+ 'accountId' => { 'value' => account_id, 'encode' => true },
729
+ 'callId' => { 'value' => call_id, 'encode' => true },
730
+ 'recordingId' => { 'value' => recording_id, 'encode' => true }
739
731
  )
740
732
  _query_url = APIHelper.clean_url _query_builder
741
733
 
@@ -797,7 +789,9 @@ module Voice
797
789
 
798
790
  # Return appropriate response type.
799
791
  decoded = APIHelper.json_deserialize(_response.raw_body)
800
- ApiResponse.new(_response, data: TranscriptionResponse.from_hash(decoded))
792
+ ApiResponse.new(
793
+ _response, data: TranscriptionResponse.from_hash(decoded)
794
+ )
801
795
  end
802
796
 
803
797
  # Requests that the specified recording be transcribed
@@ -815,9 +809,9 @@ module Voice
815
809
  _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'
816
810
  _query_builder = APIHelper.append_url_with_template_parameters(
817
811
  _query_builder,
818
- 'accountId' => account_id,
819
- 'callId' => call_id,
820
- 'recordingId' => recording_id
812
+ 'accountId' => { 'value' => account_id, 'encode' => true },
813
+ 'callId' => { 'value' => call_id, 'encode' => true },
814
+ 'recordingId' => { 'value' => recording_id, 'encode' => true }
821
815
  )
822
816
  _query_url = APIHelper.clean_url _query_builder
823
817
 
@@ -901,9 +895,9 @@ module Voice
901
895
  _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'
902
896
  _query_builder = APIHelper.append_url_with_template_parameters(
903
897
  _query_builder,
904
- 'accountId' => account_id,
905
- 'callId' => call_id,
906
- 'recordingId' => recording_id
898
+ 'accountId' => { 'value' => account_id, 'encode' => true },
899
+ 'callId' => { 'value' => call_id, 'encode' => true },
900
+ 'recordingId' => { 'value' => recording_id, 'encode' => true }
907
901
  )
908
902
  _query_url = APIHelper.clean_url _query_builder
909
903
 
@@ -961,6 +955,180 @@ module Voice
961
955
  ApiResponse.new(_response)
962
956
  end
963
957
 
958
+ # Returns information about the conferences in the account
959
+ # @param [String] account_id Required parameter: Example:
960
+ # @param [Integer] page_size Optional parameter: Example:1000
961
+ # @param [String] page_token Optional parameter: Example:
962
+ # @param [String] name Optional parameter: Example:
963
+ # @param [String] min_created_time Optional parameter: Example:
964
+ # @param [String] max_created_time Optional parameter: Example:
965
+ # @return [List of ConferenceDetail] response from the API call
966
+ def get_conferences_by_account(account_id,
967
+ page_size: 1000,
968
+ page_token: nil,
969
+ name: nil,
970
+ min_created_time: nil,
971
+ max_created_time: nil)
972
+ # Prepare query url.
973
+ _query_builder = config.get_base_uri(Server::VOICEDEFAULT)
974
+ _query_builder << '/api/v2/accounts/{accountId}/conferences'
975
+ _query_builder = APIHelper.append_url_with_template_parameters(
976
+ _query_builder,
977
+ 'accountId' => { 'value' => account_id, 'encode' => true }
978
+ )
979
+ _query_builder = APIHelper.append_url_with_query_parameters(
980
+ _query_builder,
981
+ 'pageSize' => page_size,
982
+ 'pageToken' => page_token,
983
+ 'name' => name,
984
+ 'minCreatedTime' => min_created_time,
985
+ 'maxCreatedTime' => max_created_time
986
+ )
987
+ _query_url = APIHelper.clean_url _query_builder
988
+
989
+ # Prepare headers.
990
+ _headers = {
991
+ 'accept' => 'application/json'
992
+ }
993
+
994
+ # Prepare and execute HttpRequest.
995
+ _request = config.http_client.get(
996
+ _query_url,
997
+ headers: _headers
998
+ )
999
+ VoiceBasicAuth.apply(config, _request)
1000
+ _response = execute_request(_request)
1001
+
1002
+ # Validate response against endpoint and global error codes.
1003
+ if _response.status_code == 400
1004
+ raise ApiErrorResponseException.new(
1005
+ 'Something\'s not quite right... Your request is invalid. Please' \
1006
+ ' fix it before trying again.',
1007
+ _response
1008
+ )
1009
+ elsif _response.status_code == 401
1010
+ raise APIException.new(
1011
+ 'Your credentials are invalid. Please use your Bandwidth dashboard' \
1012
+ ' credentials to authenticate to the API.',
1013
+ _response
1014
+ )
1015
+ elsif _response.status_code == 403
1016
+ raise ApiErrorResponseException.new(
1017
+ 'User unauthorized to perform this action.',
1018
+ _response
1019
+ )
1020
+ elsif _response.status_code == 404
1021
+ raise ApiErrorResponseException.new(
1022
+ 'The resource specified cannot be found or does not belong to you.',
1023
+ _response
1024
+ )
1025
+ elsif _response.status_code == 415
1026
+ raise ApiErrorResponseException.new(
1027
+ 'We don\'t support that media type. If a request body is required,' \
1028
+ ' please send it to us as `application/json`.',
1029
+ _response
1030
+ )
1031
+ elsif _response.status_code == 429
1032
+ raise ApiErrorResponseException.new(
1033
+ 'You\'re sending requests to this endpoint too frequently. Please' \
1034
+ ' slow your request rate down and try again.',
1035
+ _response
1036
+ )
1037
+ elsif _response.status_code == 500
1038
+ raise ApiErrorResponseException.new(
1039
+ 'Something unexpected happened. Please try again.',
1040
+ _response
1041
+ )
1042
+ end
1043
+ validate_response(_response)
1044
+
1045
+ # Return appropriate response type.
1046
+ decoded = APIHelper.json_deserialize(_response.raw_body)
1047
+ ApiResponse.new(
1048
+ _response,
1049
+ data: decoded.map { |element| ConferenceDetail.from_hash(element) }
1050
+ )
1051
+ end
1052
+
1053
+ # Returns information about the specified conference
1054
+ # @param [String] account_id Required parameter: Example:
1055
+ # @param [String] conference_id Required parameter: Example:
1056
+ # @return [ConferenceDetail] response from the API call
1057
+ def get_conference_by_id(account_id,
1058
+ conference_id)
1059
+ # Prepare query url.
1060
+ _query_builder = config.get_base_uri(Server::VOICEDEFAULT)
1061
+ _query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}'
1062
+ _query_builder = APIHelper.append_url_with_template_parameters(
1063
+ _query_builder,
1064
+ 'accountId' => { 'value' => account_id, 'encode' => true },
1065
+ 'conferenceId' => { 'value' => conference_id, 'encode' => true }
1066
+ )
1067
+ _query_url = APIHelper.clean_url _query_builder
1068
+
1069
+ # Prepare headers.
1070
+ _headers = {
1071
+ 'accept' => 'application/json'
1072
+ }
1073
+
1074
+ # Prepare and execute HttpRequest.
1075
+ _request = config.http_client.get(
1076
+ _query_url,
1077
+ headers: _headers
1078
+ )
1079
+ VoiceBasicAuth.apply(config, _request)
1080
+ _response = execute_request(_request)
1081
+
1082
+ # Validate response against endpoint and global error codes.
1083
+ if _response.status_code == 400
1084
+ raise ApiErrorResponseException.new(
1085
+ 'Something\'s not quite right... Your request is invalid. Please' \
1086
+ ' fix it before trying again.',
1087
+ _response
1088
+ )
1089
+ elsif _response.status_code == 401
1090
+ raise APIException.new(
1091
+ 'Your credentials are invalid. Please use your Bandwidth dashboard' \
1092
+ ' credentials to authenticate to the API.',
1093
+ _response
1094
+ )
1095
+ elsif _response.status_code == 403
1096
+ raise ApiErrorResponseException.new(
1097
+ 'User unauthorized to perform this action.',
1098
+ _response
1099
+ )
1100
+ elsif _response.status_code == 404
1101
+ raise ApiErrorResponseException.new(
1102
+ 'The resource specified cannot be found or does not belong to you.',
1103
+ _response
1104
+ )
1105
+ elsif _response.status_code == 415
1106
+ raise ApiErrorResponseException.new(
1107
+ 'We don\'t support that media type. If a request body is required,' \
1108
+ ' please send it to us as `application/json`.',
1109
+ _response
1110
+ )
1111
+ elsif _response.status_code == 429
1112
+ raise ApiErrorResponseException.new(
1113
+ 'You\'re sending requests to this endpoint too frequently. Please' \
1114
+ ' slow your request rate down and try again.',
1115
+ _response
1116
+ )
1117
+ elsif _response.status_code == 500
1118
+ raise ApiErrorResponseException.new(
1119
+ 'Something unexpected happened. Please try again.',
1120
+ _response
1121
+ )
1122
+ end
1123
+ validate_response(_response)
1124
+
1125
+ # Return appropriate response type.
1126
+ decoded = APIHelper.json_deserialize(_response.raw_body)
1127
+ ApiResponse.new(
1128
+ _response, data: ConferenceDetail.from_hash(decoded)
1129
+ )
1130
+ end
1131
+
964
1132
  # Modify the conference state
965
1133
  # @param [String] account_id Required parameter: Example:
966
1134
  # @param [String] conference_id Required parameter: Example:
@@ -975,8 +1143,8 @@ module Voice
975
1143
  _query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}'
976
1144
  _query_builder = APIHelper.append_url_with_template_parameters(
977
1145
  _query_builder,
978
- 'accountId' => account_id,
979
- 'conferenceId' => conference_id
1146
+ 'accountId' => { 'value' => account_id, 'encode' => true },
1147
+ 'conferenceId' => { 'value' => conference_id, 'encode' => true }
980
1148
  )
981
1149
  _query_url = APIHelper.clean_url _query_builder
982
1150
 
@@ -1041,6 +1209,408 @@ module Voice
1041
1209
  ApiResponse.new(_response)
1042
1210
  end
1043
1211
 
1212
+ # Updates settings for a particular conference member
1213
+ # @param [String] account_id Required parameter: Example:
1214
+ # @param [String] conference_id Required parameter: Example:
1215
+ # @param [String] call_id Required parameter: Example:
1216
+ # @param [ConferenceMemberDetail] body Optional parameter: Example:
1217
+ # @return [void] response from the API call
1218
+ def modify_conference_member(account_id,
1219
+ conference_id,
1220
+ call_id,
1221
+ body: nil)
1222
+ # Prepare query url.
1223
+ _query_builder = config.get_base_uri(Server::VOICEDEFAULT)
1224
+ _query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}/members/{callId}'
1225
+ _query_builder = APIHelper.append_url_with_template_parameters(
1226
+ _query_builder,
1227
+ 'accountId' => { 'value' => account_id, 'encode' => true },
1228
+ 'conferenceId' => { 'value' => conference_id, 'encode' => true },
1229
+ 'callId' => { 'value' => call_id, 'encode' => true }
1230
+ )
1231
+ _query_url = APIHelper.clean_url _query_builder
1232
+
1233
+ # Prepare headers.
1234
+ _headers = {
1235
+ 'content-type' => 'application/json; charset=utf-8'
1236
+ }
1237
+
1238
+ # Prepare and execute HttpRequest.
1239
+ _request = config.http_client.put(
1240
+ _query_url,
1241
+ headers: _headers,
1242
+ parameters: body.to_json
1243
+ )
1244
+ VoiceBasicAuth.apply(config, _request)
1245
+ _response = execute_request(_request)
1246
+
1247
+ # Validate response against endpoint and global error codes.
1248
+ if _response.status_code == 400
1249
+ raise ApiErrorResponseException.new(
1250
+ 'Something\'s not quite right... Your request is invalid. Please' \
1251
+ ' fix it before trying again.',
1252
+ _response
1253
+ )
1254
+ elsif _response.status_code == 401
1255
+ raise APIException.new(
1256
+ 'Your credentials are invalid. Please use your Bandwidth dashboard' \
1257
+ ' credentials to authenticate to the API.',
1258
+ _response
1259
+ )
1260
+ elsif _response.status_code == 403
1261
+ raise ApiErrorResponseException.new(
1262
+ 'User unauthorized to perform this action.',
1263
+ _response
1264
+ )
1265
+ elsif _response.status_code == 404
1266
+ raise ApiErrorResponseException.new(
1267
+ 'The resource specified cannot be found or does not belong to you.',
1268
+ _response
1269
+ )
1270
+ elsif _response.status_code == 415
1271
+ raise ApiErrorResponseException.new(
1272
+ 'We don\'t support that media type. If a request body is required,' \
1273
+ ' please send it to us as `application/json`.',
1274
+ _response
1275
+ )
1276
+ elsif _response.status_code == 429
1277
+ raise ApiErrorResponseException.new(
1278
+ 'You\'re sending requests to this endpoint too frequently. Please' \
1279
+ ' slow your request rate down and try again.',
1280
+ _response
1281
+ )
1282
+ elsif _response.status_code == 500
1283
+ raise ApiErrorResponseException.new(
1284
+ 'Something unexpected happened. Please try again.',
1285
+ _response
1286
+ )
1287
+ end
1288
+ validate_response(_response)
1289
+
1290
+ # Return appropriate response type.
1291
+ ApiResponse.new(_response)
1292
+ end
1293
+
1294
+ # Returns information about the specified conference member
1295
+ # @param [String] account_id Required parameter: Example:
1296
+ # @param [String] conference_id Required parameter: Example:
1297
+ # @param [String] member_id Required parameter: Example:
1298
+ # @return [ConferenceMemberDetail] response from the API call
1299
+ def get_conference_member(account_id,
1300
+ conference_id,
1301
+ member_id)
1302
+ # Prepare query url.
1303
+ _query_builder = config.get_base_uri(Server::VOICEDEFAULT)
1304
+ _query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}/members/{memberId}'
1305
+ _query_builder = APIHelper.append_url_with_template_parameters(
1306
+ _query_builder,
1307
+ 'accountId' => { 'value' => account_id, 'encode' => true },
1308
+ 'conferenceId' => { 'value' => conference_id, 'encode' => true },
1309
+ 'memberId' => { 'value' => member_id, 'encode' => true }
1310
+ )
1311
+ _query_url = APIHelper.clean_url _query_builder
1312
+
1313
+ # Prepare headers.
1314
+ _headers = {
1315
+ 'accept' => 'application/json'
1316
+ }
1317
+
1318
+ # Prepare and execute HttpRequest.
1319
+ _request = config.http_client.get(
1320
+ _query_url,
1321
+ headers: _headers
1322
+ )
1323
+ VoiceBasicAuth.apply(config, _request)
1324
+ _response = execute_request(_request)
1325
+
1326
+ # Validate response against endpoint and global error codes.
1327
+ if _response.status_code == 400
1328
+ raise ApiErrorResponseException.new(
1329
+ 'Something\'s not quite right... Your request is invalid. Please' \
1330
+ ' fix it before trying again.',
1331
+ _response
1332
+ )
1333
+ elsif _response.status_code == 401
1334
+ raise APIException.new(
1335
+ 'Your credentials are invalid. Please use your Bandwidth dashboard' \
1336
+ ' credentials to authenticate to the API.',
1337
+ _response
1338
+ )
1339
+ elsif _response.status_code == 403
1340
+ raise ApiErrorResponseException.new(
1341
+ 'User unauthorized to perform this action.',
1342
+ _response
1343
+ )
1344
+ elsif _response.status_code == 404
1345
+ raise ApiErrorResponseException.new(
1346
+ 'The resource specified cannot be found or does not belong to you.',
1347
+ _response
1348
+ )
1349
+ elsif _response.status_code == 415
1350
+ raise ApiErrorResponseException.new(
1351
+ 'We don\'t support that media type. If a request body is required,' \
1352
+ ' please send it to us as `application/json`.',
1353
+ _response
1354
+ )
1355
+ elsif _response.status_code == 429
1356
+ raise ApiErrorResponseException.new(
1357
+ 'You\'re sending requests to this endpoint too frequently. Please' \
1358
+ ' slow your request rate down and try again.',
1359
+ _response
1360
+ )
1361
+ elsif _response.status_code == 500
1362
+ raise ApiErrorResponseException.new(
1363
+ 'Something unexpected happened. Please try again.',
1364
+ _response
1365
+ )
1366
+ end
1367
+ validate_response(_response)
1368
+
1369
+ # Return appropriate response type.
1370
+ decoded = APIHelper.json_deserialize(_response.raw_body)
1371
+ ApiResponse.new(
1372
+ _response, data: ConferenceMemberDetail.from_hash(decoded)
1373
+ )
1374
+ end
1375
+
1376
+ # Returns a (potentially empty) list of metadata for the recordings that
1377
+ # took place during the specified conference
1378
+ # @param [String] account_id Required parameter: Example:
1379
+ # @param [String] conference_id Required parameter: Example:
1380
+ # @return [List of ConferenceRecordingMetadataResponse] response from the API call
1381
+ def get_query_metadata_for_account_and_conference(account_id,
1382
+ conference_id)
1383
+ # Prepare query url.
1384
+ _query_builder = config.get_base_uri(Server::VOICEDEFAULT)
1385
+ _query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}/recordings'
1386
+ _query_builder = APIHelper.append_url_with_template_parameters(
1387
+ _query_builder,
1388
+ 'accountId' => { 'value' => account_id, 'encode' => true },
1389
+ 'conferenceId' => { 'value' => conference_id, 'encode' => true }
1390
+ )
1391
+ _query_url = APIHelper.clean_url _query_builder
1392
+
1393
+ # Prepare headers.
1394
+ _headers = {
1395
+ 'accept' => 'application/json'
1396
+ }
1397
+
1398
+ # Prepare and execute HttpRequest.
1399
+ _request = config.http_client.get(
1400
+ _query_url,
1401
+ headers: _headers
1402
+ )
1403
+ VoiceBasicAuth.apply(config, _request)
1404
+ _response = execute_request(_request)
1405
+
1406
+ # Validate response against endpoint and global error codes.
1407
+ if _response.status_code == 400
1408
+ raise ApiErrorResponseException.new(
1409
+ 'Something\'s not quite right... Your request is invalid. Please' \
1410
+ ' fix it before trying again.',
1411
+ _response
1412
+ )
1413
+ elsif _response.status_code == 401
1414
+ raise APIException.new(
1415
+ 'Your credentials are invalid. Please use your Bandwidth dashboard' \
1416
+ ' credentials to authenticate to the API.',
1417
+ _response
1418
+ )
1419
+ elsif _response.status_code == 403
1420
+ raise ApiErrorResponseException.new(
1421
+ 'User unauthorized to perform this action.',
1422
+ _response
1423
+ )
1424
+ elsif _response.status_code == 404
1425
+ raise ApiErrorResponseException.new(
1426
+ 'The resource specified cannot be found or does not belong to you.',
1427
+ _response
1428
+ )
1429
+ elsif _response.status_code == 415
1430
+ raise ApiErrorResponseException.new(
1431
+ 'We don\'t support that media type. If a request body is required,' \
1432
+ ' please send it to us as `application/json`.',
1433
+ _response
1434
+ )
1435
+ elsif _response.status_code == 429
1436
+ raise ApiErrorResponseException.new(
1437
+ 'You\'re sending requests to this endpoint too frequently. Please' \
1438
+ ' slow your request rate down and try again.',
1439
+ _response
1440
+ )
1441
+ elsif _response.status_code == 500
1442
+ raise ApiErrorResponseException.new(
1443
+ 'Something unexpected happened. Please try again.',
1444
+ _response
1445
+ )
1446
+ end
1447
+ validate_response(_response)
1448
+
1449
+ # Return appropriate response type.
1450
+ decoded = APIHelper.json_deserialize(_response.raw_body)
1451
+ ApiResponse.new(
1452
+ _response,
1453
+ data: decoded.map { |element| ConferenceRecordingMetadataResponse.from_hash(element) }
1454
+ )
1455
+ end
1456
+
1457
+ # Returns metadata for the specified recording
1458
+ # @param [String] account_id Required parameter: Example:
1459
+ # @param [String] conference_id Required parameter: Example:
1460
+ # @param [String] recording_id Required parameter: Example:
1461
+ # @return [RecordingMetadataResponse] response from the API call
1462
+ def get_metadata_for_conference_recording(account_id,
1463
+ conference_id,
1464
+ recording_id)
1465
+ # Prepare query url.
1466
+ _query_builder = config.get_base_uri(Server::VOICEDEFAULT)
1467
+ _query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}'
1468
+ _query_builder = APIHelper.append_url_with_template_parameters(
1469
+ _query_builder,
1470
+ 'accountId' => { 'value' => account_id, 'encode' => true },
1471
+ 'conferenceId' => { 'value' => conference_id, 'encode' => true },
1472
+ 'recordingId' => { 'value' => recording_id, 'encode' => true }
1473
+ )
1474
+ _query_url = APIHelper.clean_url _query_builder
1475
+
1476
+ # Prepare headers.
1477
+ _headers = {
1478
+ 'accept' => 'application/json'
1479
+ }
1480
+
1481
+ # Prepare and execute HttpRequest.
1482
+ _request = config.http_client.get(
1483
+ _query_url,
1484
+ headers: _headers
1485
+ )
1486
+ VoiceBasicAuth.apply(config, _request)
1487
+ _response = execute_request(_request)
1488
+
1489
+ # Validate response against endpoint and global error codes.
1490
+ if _response.status_code == 400
1491
+ raise ApiErrorResponseException.new(
1492
+ 'Something\'s not quite right... Your request is invalid. Please' \
1493
+ ' fix it before trying again.',
1494
+ _response
1495
+ )
1496
+ elsif _response.status_code == 401
1497
+ raise APIException.new(
1498
+ 'Your credentials are invalid. Please use your Bandwidth dashboard' \
1499
+ ' credentials to authenticate to the API.',
1500
+ _response
1501
+ )
1502
+ elsif _response.status_code == 403
1503
+ raise ApiErrorResponseException.new(
1504
+ 'User unauthorized to perform this action.',
1505
+ _response
1506
+ )
1507
+ elsif _response.status_code == 404
1508
+ raise ApiErrorResponseException.new(
1509
+ 'The resource specified cannot be found or does not belong to you.',
1510
+ _response
1511
+ )
1512
+ elsif _response.status_code == 415
1513
+ raise ApiErrorResponseException.new(
1514
+ 'We don\'t support that media type. If a request body is required,' \
1515
+ ' please send it to us as `application/json`.',
1516
+ _response
1517
+ )
1518
+ elsif _response.status_code == 429
1519
+ raise ApiErrorResponseException.new(
1520
+ 'You\'re sending requests to this endpoint too frequently. Please' \
1521
+ ' slow your request rate down and try again.',
1522
+ _response
1523
+ )
1524
+ elsif _response.status_code == 500
1525
+ raise ApiErrorResponseException.new(
1526
+ 'Something unexpected happened. Please try again.',
1527
+ _response
1528
+ )
1529
+ end
1530
+ validate_response(_response)
1531
+
1532
+ # Return appropriate response type.
1533
+ decoded = APIHelper.json_deserialize(_response.raw_body)
1534
+ ApiResponse.new(
1535
+ _response, data: RecordingMetadataResponse.from_hash(decoded)
1536
+ )
1537
+ end
1538
+
1539
+ # Downloads the specified recording
1540
+ # @param [String] account_id Required parameter: Example:
1541
+ # @param [String] conference_id Required parameter: Example:
1542
+ # @param [String] recording_id Required parameter: Example:
1543
+ # @return [Binary] response from the API call
1544
+ def get_stream_conference_recording_media(account_id,
1545
+ conference_id,
1546
+ recording_id)
1547
+ # Prepare query url.
1548
+ _query_builder = config.get_base_uri(Server::VOICEDEFAULT)
1549
+ _query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}/media'
1550
+ _query_builder = APIHelper.append_url_with_template_parameters(
1551
+ _query_builder,
1552
+ 'accountId' => { 'value' => account_id, 'encode' => true },
1553
+ 'conferenceId' => { 'value' => conference_id, 'encode' => true },
1554
+ 'recordingId' => { 'value' => recording_id, 'encode' => true }
1555
+ )
1556
+ _query_url = APIHelper.clean_url _query_builder
1557
+
1558
+ # Prepare and execute HttpRequest.
1559
+ _request = config.http_client.get(
1560
+ _query_url
1561
+ )
1562
+ VoiceBasicAuth.apply(config, _request)
1563
+ _response = execute_request(_request, binary: true)
1564
+
1565
+ # Validate response against endpoint and global error codes.
1566
+ if _response.status_code == 400
1567
+ raise ApiErrorResponseException.new(
1568
+ 'Something\'s not quite right... Your request is invalid. Please' \
1569
+ ' fix it before trying again.',
1570
+ _response
1571
+ )
1572
+ elsif _response.status_code == 401
1573
+ raise APIException.new(
1574
+ 'Your credentials are invalid. Please use your Bandwidth dashboard' \
1575
+ ' credentials to authenticate to the API.',
1576
+ _response
1577
+ )
1578
+ elsif _response.status_code == 403
1579
+ raise ApiErrorResponseException.new(
1580
+ 'User unauthorized to perform this action.',
1581
+ _response
1582
+ )
1583
+ elsif _response.status_code == 404
1584
+ raise ApiErrorResponseException.new(
1585
+ 'The resource specified cannot be found or does not belong to you.',
1586
+ _response
1587
+ )
1588
+ elsif _response.status_code == 415
1589
+ raise ApiErrorResponseException.new(
1590
+ 'We don\'t support that media type. If a request body is required,' \
1591
+ ' please send it to us as `application/json`.',
1592
+ _response
1593
+ )
1594
+ elsif _response.status_code == 429
1595
+ raise ApiErrorResponseException.new(
1596
+ 'You\'re sending requests to this endpoint too frequently. Please' \
1597
+ ' slow your request rate down and try again.',
1598
+ _response
1599
+ )
1600
+ elsif _response.status_code == 500
1601
+ raise ApiErrorResponseException.new(
1602
+ 'Something unexpected happened. Please try again.',
1603
+ _response
1604
+ )
1605
+ end
1606
+ validate_response(_response)
1607
+
1608
+ # Return appropriate response type.
1609
+ ApiResponse.new(
1610
+ _response, data: _response.raw_body
1611
+ )
1612
+ end
1613
+
1044
1614
  # Returns a list of metadata for the recordings associated with the
1045
1615
  # specified account. The list can be filtered by the optional from, to,
1046
1616
  # minStartTime, and maxStartTime arguments. The list is capped at 1000
@@ -1061,7 +1631,7 @@ module Voice
1061
1631
  _query_builder << '/api/v2/accounts/{accountId}/recordings'
1062
1632
  _query_builder = APIHelper.append_url_with_template_parameters(
1063
1633
  _query_builder,
1064
- 'accountId' => account_id
1634
+ 'accountId' => { 'value' => account_id, 'encode' => true }
1065
1635
  )
1066
1636
  _query_builder = APIHelper.append_url_with_query_parameters(
1067
1637
  _query_builder,