bandwidth-sdk 11.2.0 → 12.0.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 (52) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +29 -25
  3. data/README.md +14 -8
  4. data/bandwidth.yml +223 -17
  5. data/coverage/.last_run.json +1 -1
  6. data/coverage/.resultset.json +612 -209
  7. data/coverage/index.html +14875 -10424
  8. data/custom_templates/README.mustache +4 -4
  9. data/docs/CallRecordingMetadata.md +1 -1
  10. data/docs/CallTranscription.md +24 -0
  11. data/docs/CallTranscriptionMetadata.md +20 -0
  12. data/docs/CallTranscriptionResponse.md +24 -0
  13. data/docs/RecordingAvailableCallback.md +2 -2
  14. data/docs/RecordingTranscriptionMetadata.md +24 -0
  15. data/docs/RecordingTranscriptions.md +18 -0
  16. data/docs/RecordingsApi.md +49 -49
  17. data/docs/TranscriptionsApi.md +229 -0
  18. data/lib/bandwidth-sdk/api/recordings_api.rb +56 -56
  19. data/lib/bandwidth-sdk/api/transcriptions_api.rb +241 -0
  20. data/lib/bandwidth-sdk/configuration.rb +22 -4
  21. data/lib/bandwidth-sdk/models/bxml/verbs/transfer.rb +2 -1
  22. data/lib/bandwidth-sdk/models/call_recording_metadata.rb +1 -1
  23. data/lib/bandwidth-sdk/models/call_transcription.rb +317 -0
  24. data/lib/bandwidth-sdk/models/call_transcription_metadata.rb +223 -0
  25. data/lib/bandwidth-sdk/models/call_transcription_response.rb +244 -0
  26. data/lib/bandwidth-sdk/models/recording_available_callback.rb +2 -2
  27. data/lib/bandwidth-sdk/models/recording_transcription_metadata.rb +244 -0
  28. data/lib/bandwidth-sdk/models/recording_transcriptions.rb +214 -0
  29. data/lib/bandwidth-sdk/version.rb +1 -1
  30. data/lib/bandwidth-sdk.rb +6 -2
  31. data/spec/api/calls_api_spec.rb +4 -4
  32. data/spec/api/conferences_api_spec.rb +12 -12
  33. data/spec/api/media_api_spec.rb +6 -6
  34. data/spec/api/messages_api_spec.rb +2 -2
  35. data/spec/api/mfa_api_spec.rb +6 -6
  36. data/spec/api/phone_number_lookup_api_spec.rb +2 -2
  37. data/spec/api/recordings_api_spec.rb +30 -30
  38. data/spec/api/statistics_api_spec.rb +1 -1
  39. data/spec/api/transcriptions_api_spec.rb +130 -0
  40. data/spec/api_client_spec.rb +2 -2
  41. data/spec/integration/calls_api_integration_spec.rb +7 -7
  42. data/spec/integration/conferences_api_integration_spec.rb +9 -9
  43. data/spec/integration/media_api_integration_spec.rb +7 -7
  44. data/spec/integration/messages_api_integration_spec.rb +3 -3
  45. data/spec/integration/mfa_api_integration_spec.rb +3 -3
  46. data/spec/integration/phone_number_lookup_api_integration_spec.rb +2 -2
  47. data/spec/integration/recordings_api_integration_spec.rb +14 -14
  48. data/spec/integration/statistics_api_integration_spec.rb +1 -1
  49. data/spec/integration/transcriptions_api_integration_spec.rb +84 -0
  50. data/spec/models/bxml/verbs/transfer_spec.rb +7 -5
  51. data/spec/spec_helper.rb +1 -1
  52. metadata +50 -34
@@ -0,0 +1,244 @@
1
+ =begin
2
+ #Bandwidth
3
+
4
+ #Bandwidth's Communication APIs
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: letstalk@bandwidth.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.0.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Bandwidth
17
+ class CallTranscriptionResponse
18
+ # The user account associated with the call.
19
+ attr_accessor :account_id
20
+
21
+ # The call id associated with the event.
22
+ attr_accessor :call_id
23
+
24
+ # The programmable voice API transcription ID.
25
+ attr_accessor :transcription_id
26
+
27
+ attr_accessor :tracks
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'account_id' => :'accountId',
33
+ :'call_id' => :'callId',
34
+ :'transcription_id' => :'transcriptionId',
35
+ :'tracks' => :'tracks'
36
+ }
37
+ end
38
+
39
+ # Returns all the JSON keys this model knows about
40
+ def self.acceptable_attributes
41
+ attribute_map.values
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.openapi_types
46
+ {
47
+ :'account_id' => :'String',
48
+ :'call_id' => :'String',
49
+ :'transcription_id' => :'String',
50
+ :'tracks' => :'Array<CallTranscription>'
51
+ }
52
+ end
53
+
54
+ # List of attributes with nullable: true
55
+ def self.openapi_nullable
56
+ Set.new([
57
+ ])
58
+ end
59
+
60
+ # Initializes the object
61
+ # @param [Hash] attributes Model attributes in the form of hash
62
+ def initialize(attributes = {})
63
+ if (!attributes.is_a?(Hash))
64
+ fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::CallTranscriptionResponse` initialize method'
65
+ end
66
+
67
+ # check to see if the attribute exists and convert string to symbol for hash key
68
+ attributes = attributes.each_with_object({}) { |(k, v), h|
69
+ if (!self.class.attribute_map.key?(k.to_sym))
70
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CallTranscriptionResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
71
+ end
72
+ h[k.to_sym] = v
73
+ }
74
+
75
+ if attributes.key?(:'account_id')
76
+ self.account_id = attributes[:'account_id']
77
+ end
78
+
79
+ if attributes.key?(:'call_id')
80
+ self.call_id = attributes[:'call_id']
81
+ end
82
+
83
+ if attributes.key?(:'transcription_id')
84
+ self.transcription_id = attributes[:'transcription_id']
85
+ end
86
+
87
+ if attributes.key?(:'tracks')
88
+ if (value = attributes[:'tracks']).is_a?(Array)
89
+ self.tracks = value
90
+ end
91
+ end
92
+ end
93
+
94
+ # Show invalid properties with the reasons. Usually used together with valid?
95
+ # @return Array for valid properties with the reasons
96
+ def list_invalid_properties
97
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
98
+ invalid_properties = Array.new
99
+ invalid_properties
100
+ end
101
+
102
+ # Check to see if the all the properties in the model are valid
103
+ # @return true if the model is valid
104
+ def valid?
105
+ warn '[DEPRECATED] the `valid?` method is obsolete'
106
+ true
107
+ end
108
+
109
+ # Checks equality by comparing each attribute.
110
+ # @param [Object] Object to be compared
111
+ def ==(o)
112
+ return true if self.equal?(o)
113
+ self.class == o.class &&
114
+ account_id == o.account_id &&
115
+ call_id == o.call_id &&
116
+ transcription_id == o.transcription_id &&
117
+ tracks == o.tracks
118
+ end
119
+
120
+ # @see the `==` method
121
+ # @param [Object] Object to be compared
122
+ def eql?(o)
123
+ self == o
124
+ end
125
+
126
+ # Calculates hash code according to all attributes.
127
+ # @return [Integer] Hash code
128
+ def hash
129
+ [account_id, call_id, transcription_id, tracks].hash
130
+ end
131
+
132
+ # Builds the object from hash
133
+ # @param [Hash] attributes Model attributes in the form of hash
134
+ # @return [Object] Returns the model itself
135
+ def self.build_from_hash(attributes)
136
+ return nil unless attributes.is_a?(Hash)
137
+ attributes = attributes.transform_keys(&:to_sym)
138
+ transformed_hash = {}
139
+ openapi_types.each_pair do |key, type|
140
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
141
+ transformed_hash["#{key}"] = nil
142
+ elsif type =~ /\AArray<(.*)>/i
143
+ # check to ensure the input is an array given that the attribute
144
+ # is documented as an array but the input is not
145
+ if attributes[attribute_map[key]].is_a?(Array)
146
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
147
+ end
148
+ elsif !attributes[attribute_map[key]].nil?
149
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
150
+ end
151
+ end
152
+ new(transformed_hash)
153
+ end
154
+
155
+ # Deserializes the data based on type
156
+ # @param string type Data type
157
+ # @param string value Value to be deserialized
158
+ # @return [Object] Deserialized data
159
+ def self._deserialize(type, value)
160
+ case type.to_sym
161
+ when :Time
162
+ Time.parse(value)
163
+ when :Date
164
+ Date.parse(value)
165
+ when :String
166
+ value.to_s
167
+ when :Integer
168
+ value.to_i
169
+ when :Float
170
+ value.to_f
171
+ when :Boolean
172
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
173
+ true
174
+ else
175
+ false
176
+ end
177
+ when :Object
178
+ # generic object (usually a Hash), return directly
179
+ value
180
+ when /\AArray<(?<inner_type>.+)>\z/
181
+ inner_type = Regexp.last_match[:inner_type]
182
+ value.map { |v| _deserialize(inner_type, v) }
183
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
184
+ k_type = Regexp.last_match[:k_type]
185
+ v_type = Regexp.last_match[:v_type]
186
+ {}.tap do |hash|
187
+ value.each do |k, v|
188
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
189
+ end
190
+ end
191
+ else # model
192
+ # models (e.g. Pet) or oneOf
193
+ klass = Bandwidth.const_get(type)
194
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
195
+ end
196
+ end
197
+
198
+ # Returns the string representation of the object
199
+ # @return [String] String presentation of the object
200
+ def to_s
201
+ to_hash.to_s
202
+ end
203
+
204
+ # to_body is an alias to to_hash (backward compatibility)
205
+ # @return [Hash] Returns the object in the form of hash
206
+ def to_body
207
+ to_hash
208
+ end
209
+
210
+ # Returns the object in the form of hash
211
+ # @return [Hash] Returns the object in the form of hash
212
+ def to_hash
213
+ hash = {}
214
+ self.class.attribute_map.each_pair do |attr, param|
215
+ value = self.send(attr)
216
+ if value.nil?
217
+ is_nullable = self.class.openapi_nullable.include?(attr)
218
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
219
+ end
220
+
221
+ hash[param] = _to_hash(value)
222
+ end
223
+ hash
224
+ end
225
+
226
+ # Outputs non-array value in the form of hash
227
+ # For object, use to_hash. Otherwise, just return the value
228
+ # @param [Object] value Any valid value
229
+ # @return [Hash] Returns the value in the form of hash
230
+ def _to_hash(value)
231
+ if value.is_a?(Array)
232
+ value.compact.map { |v| _to_hash(v) }
233
+ elsif value.is_a?(Hash)
234
+ {}.tap do |hash|
235
+ value.each { |k, v| hash[k] = _to_hash(v) }
236
+ end
237
+ elsif value.respond_to? :to_hash
238
+ value.to_hash
239
+ else
240
+ value
241
+ end
242
+ end
243
+ end
244
+ end
@@ -65,7 +65,7 @@ module Bandwidth
65
65
 
66
66
  attr_accessor :file_format
67
67
 
68
- # The current status of the process. For recording, current possible values are 'processing', 'partial', 'complete', 'deleted', and 'error'. For transcriptions, current possible values are 'none', 'processing', 'available', 'error', 'timeout', 'file-size-too-big', and 'file-size-too-small'. Additional states may be added in the future, so your application must be tolerant of unknown values.
68
+ # Always `1` for conference recordings; multi-channel recordings are not supported on conferences.
69
69
  attr_accessor :channels
70
70
 
71
71
  # (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present.
@@ -155,7 +155,7 @@ module Bandwidth
155
155
  :'end_time' => :'Time',
156
156
  :'duration' => :'String',
157
157
  :'file_format' => :'FileFormatEnum',
158
- :'channels' => :'String',
158
+ :'channels' => :'Integer',
159
159
  :'tag' => :'String',
160
160
  :'status' => :'String',
161
161
  :'transfer_caller_id' => :'String',
@@ -0,0 +1,244 @@
1
+ =begin
2
+ #Bandwidth
3
+
4
+ #Bandwidth's Communication APIs
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: letstalk@bandwidth.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.0.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Bandwidth
17
+ # If the recording was transcribed, metadata about the transcription
18
+ class RecordingTranscriptionMetadata
19
+ # The unique transcription ID
20
+ attr_accessor :id
21
+
22
+ # The current status of the process. For recording, current possible values are 'processing', 'partial', 'complete', 'deleted', and 'error'. For transcriptions, current possible values are 'none', 'processing', 'available', 'error', 'timeout', 'file-size-too-big', and 'file-size-too-small'. Additional states may be added in the future, so your application must be tolerant of unknown values.
23
+ attr_accessor :status
24
+
25
+ # The time that the transcription was completed
26
+ attr_accessor :completed_time
27
+
28
+ # The URL of the [transcription](#operation/getCallTranscription)
29
+ attr_accessor :url
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'id' => :'id',
35
+ :'status' => :'status',
36
+ :'completed_time' => :'completedTime',
37
+ :'url' => :'url'
38
+ }
39
+ end
40
+
41
+ # Returns all the JSON keys this model knows about
42
+ def self.acceptable_attributes
43
+ attribute_map.values
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.openapi_types
48
+ {
49
+ :'id' => :'String',
50
+ :'status' => :'String',
51
+ :'completed_time' => :'String',
52
+ :'url' => :'String'
53
+ }
54
+ end
55
+
56
+ # List of attributes with nullable: true
57
+ def self.openapi_nullable
58
+ Set.new([
59
+ ])
60
+ end
61
+
62
+ # Initializes the object
63
+ # @param [Hash] attributes Model attributes in the form of hash
64
+ def initialize(attributes = {})
65
+ if (!attributes.is_a?(Hash))
66
+ fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::RecordingTranscriptionMetadata` initialize method'
67
+ end
68
+
69
+ # check to see if the attribute exists and convert string to symbol for hash key
70
+ attributes = attributes.each_with_object({}) { |(k, v), h|
71
+ if (!self.class.attribute_map.key?(k.to_sym))
72
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::RecordingTranscriptionMetadata`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
73
+ end
74
+ h[k.to_sym] = v
75
+ }
76
+
77
+ if attributes.key?(:'id')
78
+ self.id = attributes[:'id']
79
+ end
80
+
81
+ if attributes.key?(:'status')
82
+ self.status = attributes[:'status']
83
+ end
84
+
85
+ if attributes.key?(:'completed_time')
86
+ self.completed_time = attributes[:'completed_time']
87
+ end
88
+
89
+ if attributes.key?(:'url')
90
+ self.url = attributes[:'url']
91
+ end
92
+ end
93
+
94
+ # Show invalid properties with the reasons. Usually used together with valid?
95
+ # @return Array for valid properties with the reasons
96
+ def list_invalid_properties
97
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
98
+ invalid_properties = Array.new
99
+ invalid_properties
100
+ end
101
+
102
+ # Check to see if the all the properties in the model are valid
103
+ # @return true if the model is valid
104
+ def valid?
105
+ warn '[DEPRECATED] the `valid?` method is obsolete'
106
+ true
107
+ end
108
+
109
+ # Checks equality by comparing each attribute.
110
+ # @param [Object] Object to be compared
111
+ def ==(o)
112
+ return true if self.equal?(o)
113
+ self.class == o.class &&
114
+ id == o.id &&
115
+ status == o.status &&
116
+ completed_time == o.completed_time &&
117
+ url == o.url
118
+ end
119
+
120
+ # @see the `==` method
121
+ # @param [Object] Object to be compared
122
+ def eql?(o)
123
+ self == o
124
+ end
125
+
126
+ # Calculates hash code according to all attributes.
127
+ # @return [Integer] Hash code
128
+ def hash
129
+ [id, status, completed_time, url].hash
130
+ end
131
+
132
+ # Builds the object from hash
133
+ # @param [Hash] attributes Model attributes in the form of hash
134
+ # @return [Object] Returns the model itself
135
+ def self.build_from_hash(attributes)
136
+ return nil unless attributes.is_a?(Hash)
137
+ attributes = attributes.transform_keys(&:to_sym)
138
+ transformed_hash = {}
139
+ openapi_types.each_pair do |key, type|
140
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
141
+ transformed_hash["#{key}"] = nil
142
+ elsif type =~ /\AArray<(.*)>/i
143
+ # check to ensure the input is an array given that the attribute
144
+ # is documented as an array but the input is not
145
+ if attributes[attribute_map[key]].is_a?(Array)
146
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
147
+ end
148
+ elsif !attributes[attribute_map[key]].nil?
149
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
150
+ end
151
+ end
152
+ new(transformed_hash)
153
+ end
154
+
155
+ # Deserializes the data based on type
156
+ # @param string type Data type
157
+ # @param string value Value to be deserialized
158
+ # @return [Object] Deserialized data
159
+ def self._deserialize(type, value)
160
+ case type.to_sym
161
+ when :Time
162
+ Time.parse(value)
163
+ when :Date
164
+ Date.parse(value)
165
+ when :String
166
+ value.to_s
167
+ when :Integer
168
+ value.to_i
169
+ when :Float
170
+ value.to_f
171
+ when :Boolean
172
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
173
+ true
174
+ else
175
+ false
176
+ end
177
+ when :Object
178
+ # generic object (usually a Hash), return directly
179
+ value
180
+ when /\AArray<(?<inner_type>.+)>\z/
181
+ inner_type = Regexp.last_match[:inner_type]
182
+ value.map { |v| _deserialize(inner_type, v) }
183
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
184
+ k_type = Regexp.last_match[:k_type]
185
+ v_type = Regexp.last_match[:v_type]
186
+ {}.tap do |hash|
187
+ value.each do |k, v|
188
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
189
+ end
190
+ end
191
+ else # model
192
+ # models (e.g. Pet) or oneOf
193
+ klass = Bandwidth.const_get(type)
194
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
195
+ end
196
+ end
197
+
198
+ # Returns the string representation of the object
199
+ # @return [String] String presentation of the object
200
+ def to_s
201
+ to_hash.to_s
202
+ end
203
+
204
+ # to_body is an alias to to_hash (backward compatibility)
205
+ # @return [Hash] Returns the object in the form of hash
206
+ def to_body
207
+ to_hash
208
+ end
209
+
210
+ # Returns the object in the form of hash
211
+ # @return [Hash] Returns the object in the form of hash
212
+ def to_hash
213
+ hash = {}
214
+ self.class.attribute_map.each_pair do |attr, param|
215
+ value = self.send(attr)
216
+ if value.nil?
217
+ is_nullable = self.class.openapi_nullable.include?(attr)
218
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
219
+ end
220
+
221
+ hash[param] = _to_hash(value)
222
+ end
223
+ hash
224
+ end
225
+
226
+ # Outputs non-array value in the form of hash
227
+ # For object, use to_hash. Otherwise, just return the value
228
+ # @param [Object] value Any valid value
229
+ # @return [Hash] Returns the value in the form of hash
230
+ def _to_hash(value)
231
+ if value.is_a?(Array)
232
+ value.compact.map { |v| _to_hash(v) }
233
+ elsif value.is_a?(Hash)
234
+ {}.tap do |hash|
235
+ value.each { |k, v| hash[k] = _to_hash(v) }
236
+ end
237
+ elsif value.respond_to? :to_hash
238
+ value.to_hash
239
+ else
240
+ value
241
+ end
242
+ end
243
+ end
244
+ end