bandwidth-sdk 2.1.1 → 3.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +85 -70
  3. data/lib/bandwidth.rb +7 -1
  4. data/lib/bandwidth/client.rb +20 -2
  5. data/lib/bandwidth/configuration.rb +45 -9
  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/http/faraday_client.rb +2 -6
  9. data/lib/bandwidth/messaging_lib/messaging.rb +1 -3
  10. data/lib/bandwidth/messaging_lib/messaging/client.rb +11 -2
  11. data/lib/bandwidth/messaging_lib/messaging/controllers/api_controller.rb +45 -88
  12. data/lib/bandwidth/messaging_lib/messaging/controllers/base_controller.rb +1 -1
  13. data/lib/bandwidth/messaging_lib/messaging/exceptions/{generic_client_exception.rb → messaging_exception.rb} +2 -14
  14. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth.rb +20 -0
  15. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/client.rb +49 -0
  16. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/controllers/api_controller.rb +153 -0
  17. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/controllers/base_controller.rb +49 -0
  18. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/exceptions/invalid_request_exception.rb +29 -0
  19. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_code_request_schema.rb +88 -0
  20. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_messaging_response.rb +35 -0
  21. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_verify_code_response.rb +35 -0
  22. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_verify_request_schema.rb +94 -0
  23. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_voice_response.rb +35 -0
  24. data/lib/bandwidth/utilities/file_wrapper.rb +17 -0
  25. data/lib/bandwidth/voice_lib/bxml/verbs/bridge.rb +22 -0
  26. data/lib/bandwidth/voice_lib/bxml/verbs/conference.rb +28 -0
  27. data/lib/bandwidth/voice_lib/bxml/verbs/gather.rb +8 -0
  28. data/lib/bandwidth/voice_lib/bxml/verbs/phone_number.rb +2 -0
  29. data/lib/bandwidth/voice_lib/bxml/verbs/record.rb +5 -1
  30. data/lib/bandwidth/voice_lib/bxml/verbs/send_dtmf.rb +4 -1
  31. data/lib/bandwidth/voice_lib/bxml/verbs/start_recording.rb +4 -1
  32. data/lib/bandwidth/voice_lib/voice.rb +13 -4
  33. data/lib/bandwidth/voice_lib/voice/client.rb +11 -2
  34. data/lib/bandwidth/voice_lib/voice/controllers/api_controller.rb +629 -112
  35. data/lib/bandwidth/voice_lib/voice/controllers/base_controller.rb +1 -1
  36. data/lib/bandwidth/voice_lib/voice/exceptions/{error_response_exception.rb → api_error_response_exception.rb} +3 -3
  37. data/lib/bandwidth/voice_lib/voice/models/api_call_response.rb +11 -2
  38. data/lib/bandwidth/voice_lib/voice/models/api_call_state_response.rb +164 -0
  39. data/lib/bandwidth/voice_lib/voice/models/api_create_call_request.rb +20 -2
  40. data/lib/bandwidth/voice_lib/voice/models/api_modify_call_request.rb +1 -1
  41. data/lib/bandwidth/voice_lib/voice/models/api_transcribe_recording_request.rb +71 -0
  42. data/lib/bandwidth/voice_lib/voice/models/call_engine_modify_conference_request.rb +35 -0
  43. data/lib/bandwidth/voice_lib/voice/models/callback_method_enum.rb +35 -0
  44. data/lib/bandwidth/voice_lib/voice/models/disconnect_cause_enum.rb +47 -0
  45. data/lib/bandwidth/voice_lib/voice/models/modify_call_recording_state.rb +1 -1
  46. data/lib/bandwidth/voice_lib/voice/models/recording_metadata_response.rb +35 -25
  47. data/lib/bandwidth/voice_lib/voice/models/state1_enum.rb +4 -7
  48. data/lib/bandwidth/voice_lib/voice/models/state2_enum.rb +20 -0
  49. data/lib/bandwidth/voice_lib/voice/models/state_enum.rb +7 -4
  50. data/lib/bandwidth/voice_lib/voice/models/status1_enum.rb +26 -0
  51. data/lib/bandwidth/voice_lib/voice/models/status2_enum.rb +32 -0
  52. data/lib/bandwidth/voice_lib/voice/models/status_enum.rb +17 -0
  53. data/lib/bandwidth/{messaging_lib/messaging/models/field_error.rb → voice_lib/voice/models/transcript.rb} +15 -15
  54. data/lib/bandwidth/voice_lib/voice/models/transcription.rb +62 -0
  55. data/lib/bandwidth/voice_lib/voice/models/transcription_response.rb +42 -0
  56. data/lib/bandwidth/web_rtc_lib/web_rtc.rb +21 -0
  57. data/lib/bandwidth/web_rtc_lib/web_rtc/client.rb +49 -0
  58. data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/api_controller.rb +682 -0
  59. data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/base_controller.rb +49 -0
  60. data/lib/bandwidth/{messaging_lib/messaging/exceptions/path_client_exception.rb → web_rtc_lib/web_rtc/exceptions/error_exception.rb} +4 -19
  61. data/lib/bandwidth/web_rtc_lib/web_rtc/models/accounts_participants_response.rb +47 -0
  62. data/lib/bandwidth/web_rtc_lib/web_rtc/models/participant.rb +83 -0
  63. data/lib/bandwidth/web_rtc_lib/web_rtc/models/participant_subscription.rb +35 -0
  64. data/lib/bandwidth/web_rtc_lib/web_rtc/models/publish_permission_enum.rb +17 -0
  65. data/lib/bandwidth/web_rtc_lib/web_rtc/models/session.rb +44 -0
  66. data/lib/bandwidth/web_rtc_lib/web_rtc/models/subscriptions.rb +54 -0
  67. metadata +58 -11
  68. data/lib/bandwidth/voice_lib/voice/models/api_get_account_recordings_metadata_request.rb +0 -65
  69. data/lib/bandwidth/voice_lib/voice/models/transcription_status_enum.rb +0 -20
  70. data/lib/bandwidth/voice_lib/voice/models/type_enum.rb +0 -32
@@ -0,0 +1,47 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Bandwidth
7
+ # DisconnectCause.
8
+ class DisconnectCauseEnum
9
+ DISCONNECT_CAUSE_ENUM = [
10
+ # TODO: Write general description for BUSY
11
+ BUSY = 'busy'.freeze,
12
+
13
+ # TODO: Write general description for CALLBACKERROR
14
+ CALLBACKERROR = 'callback-error'.freeze,
15
+
16
+ # TODO: Write general description for CANCEL
17
+ CANCEL = 'cancel'.freeze,
18
+
19
+ # TODO: Write general description for ERROR
20
+ ERROR = 'error'.freeze,
21
+
22
+ # TODO: Write general description for HANGUP
23
+ HANGUP = 'hangup'.freeze,
24
+
25
+ # TODO: Write general description for INVALIDBXML
26
+ INVALIDBXML = 'invalid-bxml'.freeze,
27
+
28
+ # TODO: Write general description for REJECTED
29
+ REJECTED = 'rejected'.freeze,
30
+
31
+ # TODO: Write general description for TIMEOUT
32
+ TIMEOUT = 'timeout'.freeze,
33
+
34
+ # TODO: Write general description for ACCOUNTLIMIT
35
+ ACCOUNTLIMIT = 'account-limit'.freeze,
36
+
37
+ # TODO: Write general description for NODECAPACITYEXCEEDED
38
+ NODECAPACITYEXCEEDED = 'node-capacity-exceeded'.freeze,
39
+
40
+ # TODO: Write general description for UNKNOWN
41
+ UNKNOWN = 'unknown'.freeze,
42
+
43
+ # TODO: Write general description for APPLICATIONERROR
44
+ APPLICATIONERROR = 'application-error'.freeze
45
+ ].freeze
46
+ end
47
+ end
@@ -7,7 +7,7 @@ module Bandwidth
7
7
  # ModifyCallRecordingState Model.
8
8
  class ModifyCallRecordingState < BaseModel
9
9
  # TODO: Write general description for this method
10
- # @return [State1Enum]
10
+ # @return [State2Enum]
11
11
  attr_accessor :state
12
12
 
13
13
  # A mapping from model property names to API property names.
@@ -6,6 +6,10 @@
6
6
  module Bandwidth
7
7
  # RecordingMetadataResponse Model.
8
8
  class RecordingMetadataResponse < BaseModel
9
+ # TODO: Write general description for this method
10
+ # @return [String]
11
+ attr_accessor :application_id
12
+
9
13
  # TODO: Write general description for this method
10
14
  # @return [String]
11
15
  attr_accessor :account_id
@@ -26,45 +30,46 @@ module Bandwidth
26
30
  # @return [String]
27
31
  attr_accessor :from
28
32
 
29
- # TODO: Write general description for this method
33
+ # Format is ISO-8601
30
34
  # @return [String]
31
35
  attr_accessor :duration
32
36
 
33
- # TODO: Write general description for this method
37
+ # Format is ISO-8601
34
38
  # @return [DirectionEnum]
35
39
  attr_accessor :direction
36
40
 
37
- # TODO: Write general description for this method
41
+ # Format is ISO-8601
38
42
  # @return [Integer]
39
43
  attr_accessor :channels
40
44
 
41
- # TODO: Write general description for this method
45
+ # Format is ISO-8601
42
46
  # @return [Long]
43
47
  attr_accessor :start_time
44
48
 
45
- # TODO: Write general description for this method
49
+ # Format is ISO-8601
46
50
  # @return [Long]
47
51
  attr_accessor :end_time
48
52
 
49
- # TODO: Write general description for this method
53
+ # Format is ISO-8601
50
54
  # @return [FileFormatEnum]
51
55
  attr_accessor :file_format
52
56
 
53
- # TODO: Write general description for this method
54
- # @return [TranscriptionStatusEnum]
55
- attr_accessor :transcription_status
57
+ # Format is ISO-8601
58
+ # @return [Status1Enum]
59
+ attr_accessor :status
56
60
 
57
- # TODO: Write general description for this method
61
+ # Format is ISO-8601
58
62
  # @return [String]
59
63
  attr_accessor :media_url
60
64
 
61
- # TODO: Write general description for this method
62
- # @return [String]
63
- attr_accessor :transcription_url
65
+ # Format is ISO-8601
66
+ # @return [Transcription]
67
+ attr_accessor :transcription
64
68
 
65
69
  # A mapping from model property names to API property names.
66
70
  def self.names
67
71
  @_hash = {} if @_hash.nil?
72
+ @_hash['application_id'] = 'applicationId'
68
73
  @_hash['account_id'] = 'accountId'
69
74
  @_hash['call_id'] = 'callId'
70
75
  @_hash['recording_id'] = 'recordingId'
@@ -76,13 +81,14 @@ module Bandwidth
76
81
  @_hash['start_time'] = 'startTime'
77
82
  @_hash['end_time'] = 'endTime'
78
83
  @_hash['file_format'] = 'fileFormat'
79
- @_hash['transcription_status'] = 'transcriptionStatus'
84
+ @_hash['status'] = 'status'
80
85
  @_hash['media_url'] = 'mediaUrl'
81
- @_hash['transcription_url'] = 'transcriptionUrl'
86
+ @_hash['transcription'] = 'transcription'
82
87
  @_hash
83
88
  end
84
89
 
85
- def initialize(account_id = nil,
90
+ def initialize(application_id = nil,
91
+ account_id = nil,
86
92
  call_id = nil,
87
93
  recording_id = nil,
88
94
  to = nil,
@@ -93,9 +99,10 @@ module Bandwidth
93
99
  start_time = nil,
94
100
  end_time = nil,
95
101
  file_format = nil,
96
- transcription_status = nil,
102
+ status = nil,
97
103
  media_url = nil,
98
- transcription_url = nil)
104
+ transcription = nil)
105
+ @application_id = application_id
99
106
  @account_id = account_id
100
107
  @call_id = call_id
101
108
  @recording_id = recording_id
@@ -107,9 +114,9 @@ module Bandwidth
107
114
  @start_time = start_time
108
115
  @end_time = end_time
109
116
  @file_format = file_format
110
- @transcription_status = transcription_status
117
+ @status = status
111
118
  @media_url = media_url
112
- @transcription_url = transcription_url
119
+ @transcription = transcription
113
120
  end
114
121
 
115
122
  # Creates an instance of the object from a hash.
@@ -117,6 +124,7 @@ module Bandwidth
117
124
  return nil unless hash
118
125
 
119
126
  # Extract variables from the hash.
127
+ application_id = hash['applicationId']
120
128
  account_id = hash['accountId']
121
129
  call_id = hash['callId']
122
130
  recording_id = hash['recordingId']
@@ -128,12 +136,14 @@ module Bandwidth
128
136
  start_time = hash['startTime']
129
137
  end_time = hash['endTime']
130
138
  file_format = hash['fileFormat']
131
- transcription_status = hash['transcriptionStatus']
139
+ status = hash['status']
132
140
  media_url = hash['mediaUrl']
133
- transcription_url = hash['transcriptionUrl']
141
+ transcription = Transcription.from_hash(hash['transcription']) if
142
+ hash['transcription']
134
143
 
135
144
  # Create object from extracted values.
136
- RecordingMetadataResponse.new(account_id,
145
+ RecordingMetadataResponse.new(application_id,
146
+ account_id,
137
147
  call_id,
138
148
  recording_id,
139
149
  to,
@@ -144,9 +154,9 @@ module Bandwidth
144
154
  start_time,
145
155
  end_time,
146
156
  file_format,
147
- transcription_status,
157
+ status,
148
158
  media_url,
149
- transcription_url)
159
+ transcription)
150
160
  end
151
161
  end
152
162
  end
@@ -7,14 +7,11 @@ module Bandwidth
7
7
  # State1.
8
8
  class State1Enum
9
9
  STATE1_ENUM = [
10
- # TODO: Write general description for NOT_RECORDING
11
- NOT_RECORDING = 'NOT_RECORDING'.freeze,
10
+ # TODO: Write general description for ACTIVE
11
+ ACTIVE = 'active'.freeze,
12
12
 
13
- # TODO: Write general description for PAUSED
14
- PAUSED = 'PAUSED'.freeze,
15
-
16
- # TODO: Write general description for RECORDING
17
- RECORDING = 'RECORDING'.freeze
13
+ # TODO: Write general description for COMPLETED
14
+ COMPLETED = 'completed'.freeze
18
15
  ].freeze
19
16
  end
20
17
  end
@@ -0,0 +1,20 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Bandwidth
7
+ # State2.
8
+ class State2Enum
9
+ STATE2_ENUM = [
10
+ # TODO: Write general description for NOT_RECORDING
11
+ NOT_RECORDING = 'NOT_RECORDING'.freeze,
12
+
13
+ # TODO: Write general description for PAUSED
14
+ PAUSED = 'PAUSED'.freeze,
15
+
16
+ # TODO: Write general description for RECORDING
17
+ RECORDING = 'RECORDING'.freeze
18
+ ].freeze
19
+ end
20
+ end
@@ -7,11 +7,14 @@ module Bandwidth
7
7
  # State.
8
8
  class StateEnum
9
9
  STATE_ENUM = [
10
- # TODO: Write general description for ACTIVE
11
- ACTIVE = 'active'.freeze,
10
+ # TODO: Write general description for DISCONNECTED
11
+ DISCONNECTED = 'DISCONNECTED'.freeze,
12
12
 
13
- # TODO: Write general description for COMPLETED
14
- COMPLETED = 'completed'.freeze
13
+ # TODO: Write general description for ANSWERED
14
+ ANSWERED = 'ANSWERED'.freeze,
15
+
16
+ # TODO: Write general description for INITIATED
17
+ INITIATED = 'INITIATED'.freeze
15
18
  ].freeze
16
19
  end
17
20
  end
@@ -0,0 +1,26 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Bandwidth
7
+ # Status1.
8
+ class Status1Enum
9
+ STATUS1_ENUM = [
10
+ # TODO: Write general description for PROCESSING
11
+ PROCESSING = 'processing'.freeze,
12
+
13
+ # TODO: Write general description for PARTIAL
14
+ PARTIAL = 'partial'.freeze,
15
+
16
+ # TODO: Write general description for COMPLETE
17
+ COMPLETE = 'complete'.freeze,
18
+
19
+ # TODO: Write general description for DELETED
20
+ DELETED = 'deleted'.freeze,
21
+
22
+ # TODO: Write general description for ERROR
23
+ ERROR = 'error'.freeze
24
+ ].freeze
25
+ end
26
+ end
@@ -0,0 +1,32 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Bandwidth
7
+ # Status2.
8
+ class Status2Enum
9
+ STATUS2_ENUM = [
10
+ # TODO: Write general description for NONE
11
+ NONE = 'none'.freeze,
12
+
13
+ # TODO: Write general description for PROCESSING
14
+ PROCESSING = 'processing'.freeze,
15
+
16
+ # TODO: Write general description for AVAILABLE
17
+ AVAILABLE = 'available'.freeze,
18
+
19
+ # TODO: Write general description for ERROR
20
+ ERROR = 'error'.freeze,
21
+
22
+ # TODO: Write general description for TIMEOUT
23
+ TIMEOUT = 'timeout'.freeze,
24
+
25
+ # TODO: Write general description for FILESIZETOOBIG
26
+ FILESIZETOOBIG = 'file-size-too-big'.freeze,
27
+
28
+ # TODO: Write general description for FILESIZETOOSMALL
29
+ FILESIZETOOSMALL = 'file-size-too-small'.freeze
30
+ ].freeze
31
+ end
32
+ end
@@ -0,0 +1,17 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Bandwidth
7
+ # Status.
8
+ class StatusEnum
9
+ STATUS_ENUM = [
10
+ # TODO: Write general description for ACTIVE
11
+ ACTIVE = 'active'.freeze,
12
+
13
+ # TODO: Write general description for COMPLETED
14
+ COMPLETED = 'completed'.freeze
15
+ ].freeze
16
+ end
17
+ end
@@ -4,28 +4,28 @@
4
4
  # ( https://apimatic.io ).
5
5
 
6
6
  module Bandwidth
7
- # FieldError Model.
8
- class FieldError < BaseModel
7
+ # Transcript Model.
8
+ class Transcript < BaseModel
9
9
  # TODO: Write general description for this method
10
10
  # @return [String]
11
- attr_accessor :field_name
11
+ attr_accessor :text
12
12
 
13
13
  # TODO: Write general description for this method
14
- # @return [String]
15
- attr_accessor :description
14
+ # @return [Float]
15
+ attr_accessor :confidence
16
16
 
17
17
  # A mapping from model property names to API property names.
18
18
  def self.names
19
19
  @_hash = {} if @_hash.nil?
20
- @_hash['field_name'] = 'fieldName'
21
- @_hash['description'] = 'description'
20
+ @_hash['text'] = 'text'
21
+ @_hash['confidence'] = 'confidence'
22
22
  @_hash
23
23
  end
24
24
 
25
- def initialize(field_name = nil,
26
- description = nil)
27
- @field_name = field_name
28
- @description = description
25
+ def initialize(text = nil,
26
+ confidence = nil)
27
+ @text = text
28
+ @confidence = confidence
29
29
  end
30
30
 
31
31
  # Creates an instance of the object from a hash.
@@ -33,12 +33,12 @@ module Bandwidth
33
33
  return nil unless hash
34
34
 
35
35
  # Extract variables from the hash.
36
- field_name = hash['fieldName']
37
- description = hash['description']
36
+ text = hash['text']
37
+ confidence = hash['confidence']
38
38
 
39
39
  # Create object from extracted values.
40
- FieldError.new(field_name,
41
- description)
40
+ Transcript.new(text,
41
+ confidence)
42
42
  end
43
43
  end
44
44
  end
@@ -0,0 +1,62 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Bandwidth
7
+ # Transcription Model.
8
+ class Transcription < BaseModel
9
+ # TODO: Write general description for this method
10
+ # @return [String]
11
+ attr_accessor :id
12
+
13
+ # TODO: Write general description for this method
14
+ # @return [Status2Enum]
15
+ attr_accessor :status
16
+
17
+ # TODO: Write general description for this method
18
+ # @return [String]
19
+ attr_accessor :completed_time
20
+
21
+ # TODO: Write general description for this method
22
+ # @return [String]
23
+ attr_accessor :url
24
+
25
+ # A mapping from model property names to API property names.
26
+ def self.names
27
+ @_hash = {} if @_hash.nil?
28
+ @_hash['id'] = 'id'
29
+ @_hash['status'] = 'status'
30
+ @_hash['completed_time'] = 'completedTime'
31
+ @_hash['url'] = 'url'
32
+ @_hash
33
+ end
34
+
35
+ def initialize(id = nil,
36
+ status = nil,
37
+ completed_time = nil,
38
+ url = nil)
39
+ @id = id
40
+ @status = status
41
+ @completed_time = completed_time
42
+ @url = url
43
+ end
44
+
45
+ # Creates an instance of the object from a hash.
46
+ def self.from_hash(hash)
47
+ return nil unless hash
48
+
49
+ # Extract variables from the hash.
50
+ id = hash['id']
51
+ status = hash['status']
52
+ completed_time = hash['completedTime']
53
+ url = hash['url']
54
+
55
+ # Create object from extracted values.
56
+ Transcription.new(id,
57
+ status,
58
+ completed_time,
59
+ url)
60
+ end
61
+ end
62
+ end