bandwidth-sdk 2.2.2 → 3.12.1

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 (69) hide show
  1. checksums.yaml +4 -4
  2. data/lib/bandwidth.rb +28 -2
  3. data/lib/bandwidth/api_helper.rb +14 -9
  4. data/lib/bandwidth/client.rb +22 -2
  5. data/lib/bandwidth/configuration.rb +67 -12
  6. data/lib/bandwidth/http/auth/two_factor_auth_basic_auth.rb +22 -0
  7. data/lib/bandwidth/http/auth/web_rtc_basic_auth.rb +22 -0
  8. data/lib/bandwidth/messaging_lib/messaging.rb +1 -3
  9. data/lib/bandwidth/messaging_lib/messaging/client.rb +13 -2
  10. data/lib/bandwidth/messaging_lib/messaging/controllers/api_controller.rb +48 -95
  11. data/lib/bandwidth/messaging_lib/messaging/controllers/base_controller.rb +1 -1
  12. data/lib/bandwidth/messaging_lib/messaging/exceptions/{generic_client_exception.rb → messaging_exception.rb} +2 -14
  13. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth.rb +20 -0
  14. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/client.rb +51 -0
  15. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/controllers/api_controller.rb +158 -0
  16. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/controllers/base_controller.rb +49 -0
  17. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/exceptions/invalid_request_exception.rb +29 -0
  18. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_code_request_schema.rb +88 -0
  19. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_messaging_response.rb +35 -0
  20. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_verify_code_response.rb +35 -0
  21. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_verify_request_schema.rb +94 -0
  22. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_voice_response.rb +35 -0
  23. data/lib/bandwidth/voice_lib/bxml/verbs/bridge.rb +28 -0
  24. data/lib/bandwidth/voice_lib/bxml/verbs/conference.rb +32 -0
  25. data/lib/bandwidth/voice_lib/bxml/verbs/gather.rb +13 -1
  26. data/lib/bandwidth/voice_lib/bxml/verbs/phone_number.rb +5 -1
  27. data/lib/bandwidth/voice_lib/bxml/verbs/record.rb +6 -1
  28. data/lib/bandwidth/voice_lib/bxml/verbs/redirect.rb +5 -1
  29. data/lib/bandwidth/voice_lib/bxml/verbs/ring.rb +15 -0
  30. data/lib/bandwidth/voice_lib/bxml/verbs/send_dtmf.rb +4 -1
  31. data/lib/bandwidth/voice_lib/bxml/verbs/start_gather.rb +20 -0
  32. data/lib/bandwidth/voice_lib/bxml/verbs/stop_gather.rb +14 -0
  33. data/lib/bandwidth/voice_lib/bxml/verbs/transfer.rb +5 -1
  34. data/lib/bandwidth/voice_lib/voice.rb +8 -0
  35. data/lib/bandwidth/voice_lib/voice/client.rb +13 -2
  36. data/lib/bandwidth/voice_lib/voice/controllers/api_controller.rb +768 -131
  37. data/lib/bandwidth/voice_lib/voice/controllers/base_controller.rb +1 -1
  38. data/lib/bandwidth/voice_lib/voice/models/answer_fallback_method_enum.rb +17 -0
  39. data/lib/bandwidth/voice_lib/voice/models/api_call_response.rb +45 -0
  40. data/lib/bandwidth/voice_lib/voice/models/api_create_call_request.rb +65 -2
  41. data/lib/bandwidth/voice_lib/voice/models/api_modify_call_request.rb +36 -0
  42. data/lib/bandwidth/voice_lib/voice/models/api_transcribe_recording_request.rb +11 -2
  43. data/lib/bandwidth/voice_lib/voice/models/call_engine_modify_conference_request.rb +107 -0
  44. data/lib/bandwidth/voice_lib/voice/models/conference_detail.rb +108 -0
  45. data/lib/bandwidth/voice_lib/voice/models/conference_event_method_enum.rb +35 -0
  46. data/lib/bandwidth/voice_lib/voice/models/conference_member_detail.rb +80 -0
  47. data/lib/bandwidth/voice_lib/voice/models/conference_recording_metadata_response.rb +126 -0
  48. data/lib/bandwidth/voice_lib/voice/models/disconnect_cause_enum.rb +4 -1
  49. data/lib/bandwidth/voice_lib/voice/models/recording_metadata_response.rb +33 -5
  50. data/lib/bandwidth/voice_lib/voice/models/redirect_fallback_method_enum.rb +17 -0
  51. data/lib/bandwidth/voice_lib/voice/models/state_enum.rb +3 -3
  52. data/lib/bandwidth/voice_lib/voice/models/status1_enum.rb +10 -13
  53. data/lib/bandwidth/voice_lib/voice/models/status3_enum.rb +32 -0
  54. data/lib/bandwidth/voice_lib/voice/models/status_enum.rb +4 -13
  55. data/lib/bandwidth/voice_lib/voice/models/transcription.rb +1 -1
  56. data/lib/bandwidth/web_rtc_lib/utils/web_rtc_transfer.rb +13 -0
  57. data/lib/bandwidth/web_rtc_lib/web_rtc.rb +21 -0
  58. data/lib/bandwidth/web_rtc_lib/web_rtc/client.rb +51 -0
  59. data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/api_controller.rb +692 -0
  60. data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/base_controller.rb +49 -0
  61. data/lib/bandwidth/{messaging_lib/messaging/exceptions/path_client_exception.rb → web_rtc_lib/web_rtc/exceptions/error_exception.rb} +4 -19
  62. data/lib/bandwidth/web_rtc_lib/web_rtc/models/accounts_participants_response.rb +47 -0
  63. data/lib/bandwidth/web_rtc_lib/web_rtc/models/participant.rb +83 -0
  64. data/lib/bandwidth/web_rtc_lib/web_rtc/models/participant_subscription.rb +35 -0
  65. data/lib/bandwidth/web_rtc_lib/web_rtc/models/publish_permission_enum.rb +17 -0
  66. data/lib/bandwidth/web_rtc_lib/web_rtc/models/session.rb +44 -0
  67. data/lib/bandwidth/web_rtc_lib/web_rtc/models/subscriptions.rb +54 -0
  68. metadata +60 -13
  69. data/lib/bandwidth/messaging_lib/messaging/models/field_error.rb +0 -44
@@ -0,0 +1,35 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Bandwidth
7
+ # TwoFactorMessagingResponse Model.
8
+ class TwoFactorMessagingResponse < BaseModel
9
+ # TODO: Write general description for this method
10
+ # @return [String]
11
+ attr_accessor :message_id
12
+
13
+ # A mapping from model property names to API property names.
14
+ def self.names
15
+ @_hash = {} if @_hash.nil?
16
+ @_hash['message_id'] = 'messageId'
17
+ @_hash
18
+ end
19
+
20
+ def initialize(message_id = nil)
21
+ @message_id = message_id
22
+ end
23
+
24
+ # Creates an instance of the object from a hash.
25
+ def self.from_hash(hash)
26
+ return nil unless hash
27
+
28
+ # Extract variables from the hash.
29
+ message_id = hash['messageId']
30
+
31
+ # Create object from extracted values.
32
+ TwoFactorMessagingResponse.new(message_id)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,35 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Bandwidth
7
+ # TwoFactorVerifyCodeResponse Model.
8
+ class TwoFactorVerifyCodeResponse < BaseModel
9
+ # TODO: Write general description for this method
10
+ # @return [Boolean]
11
+ attr_accessor :valid
12
+
13
+ # A mapping from model property names to API property names.
14
+ def self.names
15
+ @_hash = {} if @_hash.nil?
16
+ @_hash['valid'] = 'valid'
17
+ @_hash
18
+ end
19
+
20
+ def initialize(valid = nil)
21
+ @valid = valid
22
+ end
23
+
24
+ # Creates an instance of the object from a hash.
25
+ def self.from_hash(hash)
26
+ return nil unless hash
27
+
28
+ # Extract variables from the hash.
29
+ valid = hash['valid']
30
+
31
+ # Create object from extracted values.
32
+ TwoFactorVerifyCodeResponse.new(valid)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,94 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Bandwidth
7
+ # TwoFactorVerifyRequestSchema Model.
8
+ class TwoFactorVerifyRequestSchema < BaseModel
9
+ # The phone number to send the 2fa code to.
10
+ # @return [String]
11
+ attr_accessor :to
12
+
13
+ # The application phone number, the sender of the 2fa code.
14
+ # @return [String]
15
+ attr_accessor :from
16
+
17
+ # The application unique ID, obtained from Bandwidth.
18
+ # @return [String]
19
+ attr_accessor :application_id
20
+
21
+ # An optional field to denote what scope or action the 2fa code is
22
+ # addressing. If not supplied, defaults to "2FA".
23
+ # @return [String]
24
+ attr_accessor :scope
25
+
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
39
+ # @return [String]
40
+ attr_accessor :code
41
+
42
+ # A mapping from model property names to API property names.
43
+ def self.names
44
+ @_hash = {} if @_hash.nil?
45
+ @_hash['to'] = 'to'
46
+ @_hash['from'] = 'from'
47
+ @_hash['application_id'] = 'applicationId'
48
+ @_hash['scope'] = 'scope'
49
+ @_hash['digits'] = 'digits'
50
+ @_hash['expiration_time_in_minutes'] = 'expirationTimeInMinutes'
51
+ @_hash['code'] = 'code'
52
+ @_hash
53
+ end
54
+
55
+ def initialize(to = nil,
56
+ from = nil,
57
+ application_id = nil,
58
+ digits = nil,
59
+ expiration_time_in_minutes = nil,
60
+ code = nil,
61
+ scope = nil)
62
+ @to = to
63
+ @from = from
64
+ @application_id = application_id
65
+ @scope = scope
66
+ @digits = digits
67
+ @expiration_time_in_minutes = expiration_time_in_minutes
68
+ @code = code
69
+ end
70
+
71
+ # Creates an instance of the object from a hash.
72
+ def self.from_hash(hash)
73
+ return nil unless hash
74
+
75
+ # Extract variables from the hash.
76
+ to = hash['to']
77
+ from = hash['from']
78
+ application_id = hash['applicationId']
79
+ digits = hash['digits']
80
+ expiration_time_in_minutes = hash['expirationTimeInMinutes']
81
+ code = hash['code']
82
+ scope = hash['scope']
83
+
84
+ # Create object from extracted values.
85
+ TwoFactorVerifyRequestSchema.new(to,
86
+ from,
87
+ application_id,
88
+ digits,
89
+ expiration_time_in_minutes,
90
+ code,
91
+ scope)
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,35 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Bandwidth
7
+ # TwoFactorVoiceResponse Model.
8
+ class TwoFactorVoiceResponse < BaseModel
9
+ # TODO: Write general description for this method
10
+ # @return [String]
11
+ attr_accessor :call_id
12
+
13
+ # A mapping from model property names to API property names.
14
+ def self.names
15
+ @_hash = {} if @_hash.nil?
16
+ @_hash['call_id'] = 'callId'
17
+ @_hash
18
+ end
19
+
20
+ def initialize(call_id = nil)
21
+ @call_id = call_id
22
+ end
23
+
24
+ # Creates an instance of the object from a hash.
25
+ def self.from_hash(hash)
26
+ return nil unless hash
27
+
28
+ # Extract variables from the hash.
29
+ call_id = hash['callId']
30
+
31
+ # Create object from extracted values.
32
+ TwoFactorVoiceResponse.new(call_id)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,28 @@
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
+ 'bridgeCompleteFallbackUrl' => bridge_complete_fallback_url,
19
+ 'bridgeCompleteFallbackMethod' => bridge_complete_fallback_method,
20
+ 'bridgeTargetCompleteFallbackUrl' => bridge_target_complete_fallback_url,
21
+ 'bridgeTargetCompleteFallbackMethod' => bridge_target_complete_fallback_method,
22
+ 'fallbackUsername' => fallback_username,
23
+ 'fallbackPassword' => fallback_password
24
+ }))
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,32 @@
1
+ require_relative 'xml_verb'
2
+
3
+ module Bandwidth
4
+ module Voice
5
+ # The Conference verb is used to add callees to conferences
6
+ class Conference
7
+ include XmlVerb
8
+
9
+ def to_bxml(xml)
10
+ if not call_ids_to_coach.nil?
11
+ coach_ids = call_ids_to_coach.instance_of?(String) ? call_ids_to_coach : call_ids_to_coach.join(",")
12
+ else
13
+ coach_ids = nil
14
+ end
15
+ xml.Conference(conference_name, compact_hash({
16
+ 'mute' => mute,
17
+ 'hold' => hold,
18
+ 'callIdsToCoach' => coach_ids,
19
+ 'conferenceEventUrl' => conference_event_url,
20
+ 'conferenceEventMethod' => conference_event_method,
21
+ 'username' => username,
22
+ 'password' => password,
23
+ 'tag' => tag,
24
+ 'conferenceEventFallbackUrl' => conference_event_fallback_url,
25
+ 'conferenceEventFallbackMethod' => conference_event_fallback_method,
26
+ 'fallbackUsername' => fallback_username,
27
+ 'fallbackPassword' => fallback_password
28
+ }))
29
+ end
30
+ end
31
+ end
32
+ end
@@ -17,7 +17,11 @@ module Bandwidth
17
17
  'username' => username,
18
18
  'password' => password,
19
19
  'firstDigitTimeout' => first_digit_timeout,
20
- 'repeatCount' => repeat_count
20
+ 'repeatCount' => repeat_count,
21
+ 'gatherFallbackUrl' => gather_fallback_url,
22
+ 'gatherFallbackMethod' => gather_fallback_method,
23
+ 'fallbackUsername' => fallback_username,
24
+ 'fallbackPassword' => fallback_password
21
25
  })) do
22
26
  def embedded_xml(xml, property, type)
23
27
  if property
@@ -28,8 +32,16 @@ module Bandwidth
28
32
  s.to_bxml(xml)
29
33
  end
30
34
  end
35
+ def nest_verbs_list(xml, property)
36
+ if property
37
+ property.each do |verb|
38
+ verb.to_bxml(xml)
39
+ end
40
+ end
41
+ end
31
42
  embedded_xml(xml, speak_sentence, SpeakSentence)
32
43
  embedded_xml(xml, play_audio, PlayAudio)
44
+ nest_verbs_list(xml, nested_verbs)
33
45
  end
34
46
  end
35
47
  end
@@ -12,7 +12,11 @@ module Bandwidth
12
12
  'transferDisconnectMethod' => transfer_disconnect_method,
13
13
  'username' => username,
14
14
  'password' => password,
15
- 'tag' => tag
15
+ 'tag' => tag,
16
+ 'transferAnswerFallbackUrl' => transfer_answer_fallback_url,
17
+ 'transferAnswerFallbackMethod' => transfer_answer_fallback_method,
18
+ 'fallbackUsername' => fallback_username,
19
+ 'fallbackPassword' => fallback_password
16
20
  }))
17
21
  end
18
22
  end
@@ -20,7 +20,12 @@ module Bandwidth
20
20
  'fileFormat' => file_format,
21
21
  'transcribe' => transcribe,
22
22
  'transcriptionAvailableUrl' => transcription_available_url,
23
- 'transcriptionAvailableMethod' => transcription_available_method
23
+ 'transcriptionAvailableMethod' => transcription_available_method,
24
+ 'silenceTimeout' => silence_timeout,
25
+ 'recordCompleteFallbackUrl' => record_complete_fallback_url,
26
+ 'recordCompleteFallbackMethod' => record_complete_fallback_method,
27
+ 'fallbackUsername' => fallback_username,
28
+ 'fallbackPassword' => fallback_password
24
29
  }))
25
30
  end
26
31
  end
@@ -12,7 +12,11 @@ module Bandwidth
12
12
  'redirectMethod' => redirect_method,
13
13
  'tag' => tag,
14
14
  'username' => username,
15
- 'password' => password
15
+ 'password' => password,
16
+ 'redirectFallbackUrl' => redirect_fallback_url,
17
+ 'redirectFallbackMethod' => redirect_fallback_method,
18
+ 'fallbackUsername' => fallback_username,
19
+ 'fallbackPassword' => fallback_password
16
20
  }))
17
21
  end
18
22
  end
@@ -0,0 +1,15 @@
1
+ require_relative 'xml_verb'
2
+
3
+ module Bandwidth
4
+ module Voice
5
+ class Ring
6
+ include XmlVerb
7
+
8
+ def to_bxml(xml)
9
+ xml.Ring(compact_hash({
10
+ 'duration' => duration
11
+ }))
12
+ end
13
+ end
14
+ end
15
+ end
@@ -6,7 +6,10 @@ module Bandwidth
6
6
  include XmlVerb
7
7
 
8
8
  def to_bxml(xml)
9
- xml.SendDtmf(dtmf)
9
+ xml.SendDtmf(dtmf, compact_hash({
10
+ 'toneDuration' => tone_duration,
11
+ 'toneInterval' => tone_interval
12
+ }))
10
13
  end
11
14
  end
12
15
  end
@@ -0,0 +1,20 @@
1
+ require_relative 'xml_verb'
2
+
3
+ module Bandwidth
4
+ module Voice
5
+ # The StartGather verb is used to start a gather
6
+ class StartGather
7
+ include XmlVerb
8
+
9
+ def to_bxml(xml)
10
+ xml.StartGather(compact_hash({
11
+ 'username' => username,
12
+ 'password' => password,
13
+ 'tag' => tag,
14
+ 'dtmfUrl' => dtmf_url,
15
+ 'dtmfMethod' => dtmf_method,
16
+ }))
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,14 @@
1
+ require_relative 'xml_verb'
2
+
3
+ module Bandwidth
4
+ module Voice
5
+ # The StopGather verb is used to complete a gather
6
+ class StopGather
7
+ include XmlVerb
8
+
9
+ def to_bxml(xml)
10
+ xml.StopGather()
11
+ end
12
+ end
13
+ end
14
+ end
@@ -16,7 +16,11 @@ module Bandwidth
16
16
  'username' => username,
17
17
  'password' => password,
18
18
  'diversionTreatment' => diversion_treatment,
19
- 'diversionReason' => diversion_reason
19
+ 'diversionReason' => diversion_reason,
20
+ 'transferCompleteFallbackUrl' => transfer_complete_fallback_url,
21
+ 'transferCompleteFallbackMethod' => transfer_complete_fallback_method,
22
+ 'fallbackUsername' => fallback_username,
23
+ 'fallbackPassword' => fallback_password
20
24
  })) do
21
25
  def embedded_xml(xml, property, type)
22
26
  if property
@@ -11,24 +11,32 @@ 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/call_engine_modify_conference_request.rb'
14
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'
15
19
  require_relative 'voice/models/modify_call_recording_state.rb'
16
20
  require_relative 'voice/models/recording_metadata_response.rb'
17
21
  require_relative 'voice/models/transcript.rb'
18
22
  require_relative 'voice/models/transcription.rb'
19
23
  require_relative 'voice/models/transcription_response.rb'
24
+ require_relative 'voice/models/answer_fallback_method_enum.rb'
20
25
  require_relative 'voice/models/answer_method_enum.rb'
21
26
  require_relative 'voice/models/callback_method_enum.rb'
27
+ require_relative 'voice/models/conference_event_method_enum.rb'
22
28
  require_relative 'voice/models/direction_enum.rb'
23
29
  require_relative 'voice/models/disconnect_cause_enum.rb'
24
30
  require_relative 'voice/models/disconnect_method_enum.rb'
25
31
  require_relative 'voice/models/file_format_enum.rb'
32
+ require_relative 'voice/models/redirect_fallback_method_enum.rb'
26
33
  require_relative 'voice/models/redirect_method_enum.rb'
27
34
  require_relative 'voice/models/state_enum.rb'
28
35
  require_relative 'voice/models/state1_enum.rb'
29
36
  require_relative 'voice/models/state2_enum.rb'
30
37
  require_relative 'voice/models/status_enum.rb'
31
38
  require_relative 'voice/models/status1_enum.rb'
39
+ require_relative 'voice/models/status3_enum.rb'
32
40
 
33
41
  # Exceptions
34
42
  require_relative 'voice/exceptions/api_error_response_exception.rb'