bandwidth-sdk 2.1.1 → 3.1.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 (39) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +85 -70
  3. data/lib/bandwidth.rb +3 -1
  4. data/lib/bandwidth/configuration.rb +4 -4
  5. data/lib/bandwidth/http/faraday_client.rb +2 -6
  6. data/lib/bandwidth/messaging_lib/messaging.rb +1 -3
  7. data/lib/bandwidth/messaging_lib/messaging/controllers/api_controller.rb +45 -88
  8. data/lib/bandwidth/messaging_lib/messaging/controllers/base_controller.rb +1 -1
  9. data/lib/bandwidth/messaging_lib/messaging/exceptions/{generic_client_exception.rb → messaging_exception.rb} +2 -14
  10. data/lib/bandwidth/utilities/file_wrapper.rb +17 -0
  11. data/lib/bandwidth/voice_lib/bxml/verbs/phone_number.rb +2 -0
  12. data/lib/bandwidth/voice_lib/bxml/verbs/record.rb +5 -1
  13. data/lib/bandwidth/voice_lib/bxml/verbs/send_dtmf.rb +4 -1
  14. data/lib/bandwidth/voice_lib/bxml/verbs/start_recording.rb +4 -1
  15. data/lib/bandwidth/voice_lib/voice.rb +11 -4
  16. data/lib/bandwidth/voice_lib/voice/controllers/api_controller.rb +540 -90
  17. data/lib/bandwidth/voice_lib/voice/controllers/base_controller.rb +1 -1
  18. data/lib/bandwidth/voice_lib/voice/exceptions/{error_response_exception.rb → api_error_response_exception.rb} +3 -3
  19. data/lib/bandwidth/voice_lib/voice/models/api_call_response.rb +11 -2
  20. data/lib/bandwidth/voice_lib/voice/models/api_call_state_response.rb +164 -0
  21. data/lib/bandwidth/voice_lib/voice/models/api_modify_call_request.rb +1 -1
  22. data/lib/bandwidth/voice_lib/voice/models/api_transcribe_recording_request.rb +71 -0
  23. data/lib/bandwidth/voice_lib/voice/models/callback_method_enum.rb +35 -0
  24. data/lib/bandwidth/voice_lib/voice/models/disconnect_cause_enum.rb +44 -0
  25. data/lib/bandwidth/voice_lib/voice/models/modify_call_recording_state.rb +1 -1
  26. data/lib/bandwidth/voice_lib/voice/models/recording_metadata_response.rb +35 -25
  27. data/lib/bandwidth/voice_lib/voice/models/state1_enum.rb +4 -7
  28. data/lib/bandwidth/voice_lib/voice/models/state2_enum.rb +20 -0
  29. data/lib/bandwidth/voice_lib/voice/models/state_enum.rb +7 -4
  30. data/lib/bandwidth/voice_lib/voice/models/status1_enum.rb +32 -0
  31. data/lib/bandwidth/voice_lib/voice/models/status_enum.rb +26 -0
  32. data/lib/bandwidth/{messaging_lib/messaging/models/field_error.rb → voice_lib/voice/models/transcript.rb} +15 -15
  33. data/lib/bandwidth/voice_lib/voice/models/transcription.rb +62 -0
  34. data/lib/bandwidth/voice_lib/voice/models/transcription_response.rb +42 -0
  35. metadata +31 -11
  36. data/lib/bandwidth/messaging_lib/messaging/exceptions/path_client_exception.rb +0 -49
  37. data/lib/bandwidth/voice_lib/voice/models/api_get_account_recordings_metadata_request.rb +0 -65
  38. data/lib/bandwidth/voice_lib/voice/models/transcription_status_enum.rb +0 -20
  39. data/lib/bandwidth/voice_lib/voice/models/type_enum.rb +0 -32
@@ -13,7 +13,7 @@ module Bandwidth
13
13
  @http_call_back = http_call_back
14
14
 
15
15
  @global_headers = {
16
- 'user-agent' => 'APIMATIC 2.0'
16
+ 'user-agent' => 'ruby-sdk-refs/tags/ruby3.1.0'
17
17
  }
18
18
  end
19
19
 
@@ -4,10 +4,10 @@
4
4
  # ( https://apimatic.io ).
5
5
 
6
6
  module Bandwidth
7
- # ErrorResponse class.
8
- class ErrorResponseException < APIException
7
+ # ApiErrorResponse class.
8
+ class ApiErrorResponseException < APIException
9
9
  # TODO: Write general description for this method
10
- # @return [TypeEnum]
10
+ # @return [String]
11
11
  attr_accessor :type
12
12
 
13
13
  # TODO: Write general description for this method
@@ -7,6 +7,10 @@ require 'date'
7
7
  module Bandwidth
8
8
  # ApiCallResponse Model.
9
9
  class ApiCallResponse < BaseModel
10
+ # TODO: Write general description for this method
11
+ # @return [String]
12
+ attr_accessor :account_id
13
+
10
14
  # TODO: Write general description for this method
11
15
  # @return [String]
12
16
  attr_accessor :call_id
@@ -66,6 +70,7 @@ module Bandwidth
66
70
  # A mapping from model property names to API property names.
67
71
  def self.names
68
72
  @_hash = {} if @_hash.nil?
73
+ @_hash['account_id'] = 'accountId'
69
74
  @_hash['call_id'] = 'callId'
70
75
  @_hash['application_id'] = 'applicationId'
71
76
  @_hash['to'] = 'to'
@@ -83,7 +88,8 @@ module Bandwidth
83
88
  @_hash
84
89
  end
85
90
 
86
- def initialize(call_id = nil,
91
+ def initialize(account_id = nil,
92
+ call_id = nil,
87
93
  application_id = nil,
88
94
  to = nil,
89
95
  from = nil,
@@ -97,6 +103,7 @@ module Bandwidth
97
103
  username = nil,
98
104
  password = nil,
99
105
  tag = nil)
106
+ @account_id = account_id
100
107
  @call_id = call_id
101
108
  @application_id = application_id
102
109
  @to = to
@@ -118,6 +125,7 @@ module Bandwidth
118
125
  return nil unless hash
119
126
 
120
127
  # Extract variables from the hash.
128
+ account_id = hash['accountId']
121
129
  call_id = hash['callId']
122
130
  application_id = hash['applicationId']
123
131
  to = hash['to']
@@ -134,7 +142,8 @@ module Bandwidth
134
142
  tag = hash['tag']
135
143
 
136
144
  # Create object from extracted values.
137
- ApiCallResponse.new(call_id,
145
+ ApiCallResponse.new(account_id,
146
+ call_id,
138
147
  application_id,
139
148
  to,
140
149
  from,
@@ -0,0 +1,164 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ require 'date'
7
+ module Bandwidth
8
+ # ApiCallStateResponse Model.
9
+ class ApiCallStateResponse < BaseModel
10
+ # TODO: Write general description for this method
11
+ # @return [String]
12
+ attr_accessor :call_id
13
+
14
+ # TODO: Write general description for this method
15
+ # @return [String]
16
+ attr_accessor :parent_call_id
17
+
18
+ # TODO: Write general description for this method
19
+ # @return [String]
20
+ attr_accessor :application_id
21
+
22
+ # TODO: Write general description for this method
23
+ # @return [String]
24
+ attr_accessor :account_id
25
+
26
+ # TODO: Write general description for this method
27
+ # @return [String]
28
+ attr_accessor :to
29
+
30
+ # TODO: Write general description for this method
31
+ # @return [String]
32
+ attr_accessor :from
33
+
34
+ # TODO: Write general description for this method
35
+ # @return [String]
36
+ attr_accessor :direction
37
+
38
+ # TODO: Write general description for this method
39
+ # @return [StateEnum]
40
+ attr_accessor :state
41
+
42
+ # TODO: Write general description for this method
43
+ # @return [DateTime]
44
+ attr_accessor :start_time
45
+
46
+ # TODO: Write general description for this method
47
+ # @return [DateTime]
48
+ attr_accessor :answer_time
49
+
50
+ # TODO: Write general description for this method
51
+ # @return [DateTime]
52
+ attr_accessor :end_time
53
+
54
+ # TODO: Write general description for this method
55
+ # @return [DisconnectCauseEnum]
56
+ attr_accessor :disconnect_cause
57
+
58
+ # TODO: Write general description for this method
59
+ # @return [String]
60
+ attr_accessor :error_message
61
+
62
+ # TODO: Write general description for this method
63
+ # @return [String]
64
+ attr_accessor :error_id
65
+
66
+ # TODO: Write general description for this method
67
+ # @return [DateTime]
68
+ attr_accessor :last_update
69
+
70
+ # A mapping from model property names to API property names.
71
+ def self.names
72
+ @_hash = {} if @_hash.nil?
73
+ @_hash['call_id'] = 'callId'
74
+ @_hash['parent_call_id'] = 'parentCallId'
75
+ @_hash['application_id'] = 'applicationId'
76
+ @_hash['account_id'] = 'accountId'
77
+ @_hash['to'] = 'to'
78
+ @_hash['from'] = 'from'
79
+ @_hash['direction'] = 'direction'
80
+ @_hash['state'] = 'state'
81
+ @_hash['start_time'] = 'startTime'
82
+ @_hash['answer_time'] = 'answerTime'
83
+ @_hash['end_time'] = 'endTime'
84
+ @_hash['disconnect_cause'] = 'disconnectCause'
85
+ @_hash['error_message'] = 'errorMessage'
86
+ @_hash['error_id'] = 'errorId'
87
+ @_hash['last_update'] = 'lastUpdate'
88
+ @_hash
89
+ end
90
+
91
+ def initialize(call_id = nil,
92
+ parent_call_id = nil,
93
+ application_id = nil,
94
+ account_id = nil,
95
+ to = nil,
96
+ from = nil,
97
+ direction = nil,
98
+ state = nil,
99
+ start_time = nil,
100
+ answer_time = nil,
101
+ end_time = nil,
102
+ disconnect_cause = nil,
103
+ error_message = nil,
104
+ error_id = nil,
105
+ last_update = nil)
106
+ @call_id = call_id
107
+ @parent_call_id = parent_call_id
108
+ @application_id = application_id
109
+ @account_id = account_id
110
+ @to = to
111
+ @from = from
112
+ @direction = direction
113
+ @state = state
114
+ @start_time = start_time
115
+ @answer_time = answer_time
116
+ @end_time = end_time
117
+ @disconnect_cause = disconnect_cause
118
+ @error_message = error_message
119
+ @error_id = error_id
120
+ @last_update = last_update
121
+ end
122
+
123
+ # Creates an instance of the object from a hash.
124
+ def self.from_hash(hash)
125
+ return nil unless hash
126
+
127
+ # Extract variables from the hash.
128
+ call_id = hash['callId']
129
+ parent_call_id = hash['parentCallId']
130
+ application_id = hash['applicationId']
131
+ account_id = hash['accountId']
132
+ to = hash['to']
133
+ from = hash['from']
134
+ direction = hash['direction']
135
+ state = hash['state']
136
+ start_time = APIHelper.rfc3339(hash['startTime']) if hash['startTime']
137
+ answer_time = APIHelper.rfc3339(hash['answerTime']) if
138
+ hash['answerTime']
139
+ end_time = APIHelper.rfc3339(hash['endTime']) if hash['endTime']
140
+ disconnect_cause = hash['disconnectCause']
141
+ error_message = hash['errorMessage']
142
+ error_id = hash['errorId']
143
+ last_update = APIHelper.rfc3339(hash['lastUpdate']) if
144
+ hash['lastUpdate']
145
+
146
+ # Create object from extracted values.
147
+ ApiCallStateResponse.new(call_id,
148
+ parent_call_id,
149
+ application_id,
150
+ account_id,
151
+ to,
152
+ from,
153
+ direction,
154
+ state,
155
+ start_time,
156
+ answer_time,
157
+ end_time,
158
+ disconnect_cause,
159
+ error_message,
160
+ error_id,
161
+ last_update)
162
+ end
163
+ end
164
+ end
@@ -7,7 +7,7 @@ module Bandwidth
7
7
  # ApiModifyCallRequest Model.
8
8
  class ApiModifyCallRequest < BaseModel
9
9
  # TODO: Write general description for this method
10
- # @return [StateEnum]
10
+ # @return [State1Enum]
11
11
  attr_accessor :state
12
12
 
13
13
  # TODO: Write general description for this method
@@ -0,0 +1,71 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Bandwidth
7
+ # ApiTranscribeRecordingRequest Model.
8
+ class ApiTranscribeRecordingRequest < BaseModel
9
+ # TODO: Write general description for this method
10
+ # @return [String]
11
+ attr_accessor :callback_url
12
+
13
+ # TODO: Write general description for this method
14
+ # @return [CallbackMethodEnum]
15
+ attr_accessor :callback_method
16
+
17
+ # TODO: Write general description for this method
18
+ # @return [String]
19
+ attr_accessor :username
20
+
21
+ # TODO: Write general description for this method
22
+ # @return [String]
23
+ attr_accessor :password
24
+
25
+ # TODO: Write general description for this method
26
+ # @return [String]
27
+ attr_accessor :tag
28
+
29
+ # A mapping from model property names to API property names.
30
+ def self.names
31
+ @_hash = {} if @_hash.nil?
32
+ @_hash['callback_url'] = 'callbackUrl'
33
+ @_hash['callback_method'] = 'callbackMethod'
34
+ @_hash['username'] = 'username'
35
+ @_hash['password'] = 'password'
36
+ @_hash['tag'] = 'tag'
37
+ @_hash
38
+ end
39
+
40
+ def initialize(callback_url = nil,
41
+ callback_method = nil,
42
+ username = nil,
43
+ password = nil,
44
+ tag = nil)
45
+ @callback_url = callback_url
46
+ @callback_method = callback_method
47
+ @username = username
48
+ @password = password
49
+ @tag = tag
50
+ end
51
+
52
+ # Creates an instance of the object from a hash.
53
+ def self.from_hash(hash)
54
+ return nil unless hash
55
+
56
+ # Extract variables from the hash.
57
+ callback_url = hash['callbackUrl']
58
+ callback_method = hash['callbackMethod']
59
+ username = hash['username']
60
+ password = hash['password']
61
+ tag = hash['tag']
62
+
63
+ # Create object from extracted values.
64
+ ApiTranscribeRecordingRequest.new(callback_url,
65
+ callback_method,
66
+ username,
67
+ password,
68
+ tag)
69
+ end
70
+ end
71
+ 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
+ # CallbackMethod.
8
+ class CallbackMethodEnum
9
+ CALLBACK_METHOD_ENUM = [
10
+ # TODO: Write general description for GET
11
+ GET = 'GET'.freeze,
12
+
13
+ # TODO: Write general description for HEAD
14
+ HEAD = 'HEAD'.freeze,
15
+
16
+ # TODO: Write general description for POST
17
+ POST = 'POST'.freeze,
18
+
19
+ # TODO: Write general description for PUT
20
+ PUT = 'PUT'.freeze,
21
+
22
+ # TODO: Write general description for PATCH
23
+ PATCH = 'PATCH'.freeze,
24
+
25
+ # TODO: Write general description for DELETE
26
+ DELETE = 'DELETE'.freeze,
27
+
28
+ # TODO: Write general description for OPTIONS
29
+ OPTIONS = 'OPTIONS'.freeze,
30
+
31
+ # TODO: Write general description for TRACE
32
+ TRACE = 'TRACE'.freeze
33
+ ].freeze
34
+ end
35
+ end
@@ -0,0 +1,44 @@
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
+ ].freeze
43
+ end
44
+ 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 [StatusEnum]
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