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,317 @@
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 CallTranscription
18
+ # The detected language for this transcription.
19
+ attr_accessor :detected_language
20
+
21
+ # Which `track` this transcription is derived from.
22
+ attr_accessor :track
23
+
24
+ # The transcription itself.
25
+ attr_accessor :text
26
+
27
+ # How confident the transcription engine was in transcribing the associated audio (from `0` to `1`).
28
+ attr_accessor :confidence
29
+
30
+ class EnumAttributeValidator
31
+ attr_reader :datatype
32
+ attr_reader :allowable_values
33
+
34
+ def initialize(datatype, allowable_values)
35
+ @allowable_values = allowable_values.map do |value|
36
+ case datatype.to_s
37
+ when /Integer/i
38
+ value.to_i
39
+ when /Float/i
40
+ value.to_f
41
+ else
42
+ value
43
+ end
44
+ end
45
+ end
46
+
47
+ def valid?(value)
48
+ !value || allowable_values.include?(value)
49
+ end
50
+ end
51
+
52
+ # Attribute mapping from ruby-style variable name to JSON key.
53
+ def self.attribute_map
54
+ {
55
+ :'detected_language' => :'detectedLanguage',
56
+ :'track' => :'track',
57
+ :'text' => :'text',
58
+ :'confidence' => :'confidence'
59
+ }
60
+ end
61
+
62
+ # Returns all the JSON keys this model knows about
63
+ def self.acceptable_attributes
64
+ attribute_map.values
65
+ end
66
+
67
+ # Attribute type mapping.
68
+ def self.openapi_types
69
+ {
70
+ :'detected_language' => :'String',
71
+ :'track' => :'String',
72
+ :'text' => :'String',
73
+ :'confidence' => :'Float'
74
+ }
75
+ end
76
+
77
+ # List of attributes with nullable: true
78
+ def self.openapi_nullable
79
+ Set.new([
80
+ ])
81
+ end
82
+
83
+ # Initializes the object
84
+ # @param [Hash] attributes Model attributes in the form of hash
85
+ def initialize(attributes = {})
86
+ if (!attributes.is_a?(Hash))
87
+ fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::CallTranscription` initialize method'
88
+ end
89
+
90
+ # check to see if the attribute exists and convert string to symbol for hash key
91
+ attributes = attributes.each_with_object({}) { |(k, v), h|
92
+ if (!self.class.attribute_map.key?(k.to_sym))
93
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CallTranscription`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
94
+ end
95
+ h[k.to_sym] = v
96
+ }
97
+
98
+ if attributes.key?(:'detected_language')
99
+ self.detected_language = attributes[:'detected_language']
100
+ end
101
+
102
+ if attributes.key?(:'track')
103
+ self.track = attributes[:'track']
104
+ end
105
+
106
+ if attributes.key?(:'text')
107
+ self.text = attributes[:'text']
108
+ end
109
+
110
+ if attributes.key?(:'confidence')
111
+ self.confidence = attributes[:'confidence']
112
+ end
113
+ end
114
+
115
+ # Show invalid properties with the reasons. Usually used together with valid?
116
+ # @return Array for valid properties with the reasons
117
+ def list_invalid_properties
118
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
119
+ invalid_properties = Array.new
120
+ if !@confidence.nil? && @confidence > 1
121
+ invalid_properties.push('invalid value for "confidence", must be smaller than or equal to 1.')
122
+ end
123
+
124
+ if !@confidence.nil? && @confidence < 0
125
+ invalid_properties.push('invalid value for "confidence", must be greater than or equal to 0.')
126
+ end
127
+
128
+ invalid_properties
129
+ end
130
+
131
+ # Check to see if the all the properties in the model are valid
132
+ # @return true if the model is valid
133
+ def valid?
134
+ warn '[DEPRECATED] the `valid?` method is obsolete'
135
+ detected_language_validator = EnumAttributeValidator.new('String', ['en-US', 'es-US', 'fr-FR'])
136
+ return false unless detected_language_validator.valid?(@detected_language)
137
+ track_validator = EnumAttributeValidator.new('String', ['inbound', 'outbound'])
138
+ return false unless track_validator.valid?(@track)
139
+ return false if !@confidence.nil? && @confidence > 1
140
+ return false if !@confidence.nil? && @confidence < 0
141
+ true
142
+ end
143
+
144
+ # Custom attribute writer method checking allowed values (enum).
145
+ # @param [Object] detected_language Object to be assigned
146
+ def detected_language=(detected_language)
147
+ validator = EnumAttributeValidator.new('String', ['en-US', 'es-US', 'fr-FR'])
148
+ unless validator.valid?(detected_language)
149
+ fail ArgumentError, "invalid value for \"detected_language\", must be one of #{validator.allowable_values}."
150
+ end
151
+ @detected_language = detected_language
152
+ end
153
+
154
+ # Custom attribute writer method checking allowed values (enum).
155
+ # @param [Object] track Object to be assigned
156
+ def track=(track)
157
+ validator = EnumAttributeValidator.new('String', ['inbound', 'outbound'])
158
+ unless validator.valid?(track)
159
+ fail ArgumentError, "invalid value for \"track\", must be one of #{validator.allowable_values}."
160
+ end
161
+ @track = track
162
+ end
163
+
164
+ # Custom attribute writer method with validation
165
+ # @param [Object] confidence Value to be assigned
166
+ def confidence=(confidence)
167
+ if confidence.nil?
168
+ fail ArgumentError, 'confidence cannot be nil'
169
+ end
170
+
171
+ if confidence > 1
172
+ fail ArgumentError, 'invalid value for "confidence", must be smaller than or equal to 1.'
173
+ end
174
+
175
+ if confidence < 0
176
+ fail ArgumentError, 'invalid value for "confidence", must be greater than or equal to 0.'
177
+ end
178
+
179
+ @confidence = confidence
180
+ end
181
+
182
+ # Checks equality by comparing each attribute.
183
+ # @param [Object] Object to be compared
184
+ def ==(o)
185
+ return true if self.equal?(o)
186
+ self.class == o.class &&
187
+ detected_language == o.detected_language &&
188
+ track == o.track &&
189
+ text == o.text &&
190
+ confidence == o.confidence
191
+ end
192
+
193
+ # @see the `==` method
194
+ # @param [Object] Object to be compared
195
+ def eql?(o)
196
+ self == o
197
+ end
198
+
199
+ # Calculates hash code according to all attributes.
200
+ # @return [Integer] Hash code
201
+ def hash
202
+ [detected_language, track, text, confidence].hash
203
+ end
204
+
205
+ # Builds the object from hash
206
+ # @param [Hash] attributes Model attributes in the form of hash
207
+ # @return [Object] Returns the model itself
208
+ def self.build_from_hash(attributes)
209
+ return nil unless attributes.is_a?(Hash)
210
+ attributes = attributes.transform_keys(&:to_sym)
211
+ transformed_hash = {}
212
+ openapi_types.each_pair do |key, type|
213
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
214
+ transformed_hash["#{key}"] = nil
215
+ elsif type =~ /\AArray<(.*)>/i
216
+ # check to ensure the input is an array given that the attribute
217
+ # is documented as an array but the input is not
218
+ if attributes[attribute_map[key]].is_a?(Array)
219
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
220
+ end
221
+ elsif !attributes[attribute_map[key]].nil?
222
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
223
+ end
224
+ end
225
+ new(transformed_hash)
226
+ end
227
+
228
+ # Deserializes the data based on type
229
+ # @param string type Data type
230
+ # @param string value Value to be deserialized
231
+ # @return [Object] Deserialized data
232
+ def self._deserialize(type, value)
233
+ case type.to_sym
234
+ when :Time
235
+ Time.parse(value)
236
+ when :Date
237
+ Date.parse(value)
238
+ when :String
239
+ value.to_s
240
+ when :Integer
241
+ value.to_i
242
+ when :Float
243
+ value.to_f
244
+ when :Boolean
245
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
246
+ true
247
+ else
248
+ false
249
+ end
250
+ when :Object
251
+ # generic object (usually a Hash), return directly
252
+ value
253
+ when /\AArray<(?<inner_type>.+)>\z/
254
+ inner_type = Regexp.last_match[:inner_type]
255
+ value.map { |v| _deserialize(inner_type, v) }
256
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
257
+ k_type = Regexp.last_match[:k_type]
258
+ v_type = Regexp.last_match[:v_type]
259
+ {}.tap do |hash|
260
+ value.each do |k, v|
261
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
262
+ end
263
+ end
264
+ else # model
265
+ # models (e.g. Pet) or oneOf
266
+ klass = Bandwidth.const_get(type)
267
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
268
+ end
269
+ end
270
+
271
+ # Returns the string representation of the object
272
+ # @return [String] String presentation of the object
273
+ def to_s
274
+ to_hash.to_s
275
+ end
276
+
277
+ # to_body is an alias to to_hash (backward compatibility)
278
+ # @return [Hash] Returns the object in the form of hash
279
+ def to_body
280
+ to_hash
281
+ end
282
+
283
+ # Returns the object in the form of hash
284
+ # @return [Hash] Returns the object in the form of hash
285
+ def to_hash
286
+ hash = {}
287
+ self.class.attribute_map.each_pair do |attr, param|
288
+ value = self.send(attr)
289
+ if value.nil?
290
+ is_nullable = self.class.openapi_nullable.include?(attr)
291
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
292
+ end
293
+
294
+ hash[param] = _to_hash(value)
295
+ end
296
+ hash
297
+ end
298
+
299
+ # Outputs non-array value in the form of hash
300
+ # For object, use to_hash. Otherwise, just return the value
301
+ # @param [Object] value Any valid value
302
+ # @return [Hash] Returns the value in the form of hash
303
+ def _to_hash(value)
304
+ if value.is_a?(Array)
305
+ value.compact.map { |v| _to_hash(v) }
306
+ elsif value.is_a?(Hash)
307
+ {}.tap do |hash|
308
+ value.each { |k, v| hash[k] = _to_hash(v) }
309
+ end
310
+ elsif value.respond_to? :to_hash
311
+ value.to_hash
312
+ else
313
+ value
314
+ end
315
+ end
316
+ end
317
+ end
@@ -0,0 +1,223 @@
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 CallTranscriptionMetadata
18
+ # The programmable voice API transcription ID.
19
+ attr_accessor :transcription_id
20
+
21
+ # A URL that may be used to retrieve the transcription itself. This points to the [Get Call Transcription](/apis/voice/#operation/getCallTranscription) endpoint.
22
+ attr_accessor :transcription_url
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'transcription_id' => :'transcriptionId',
28
+ :'transcription_url' => :'transcriptionUrl'
29
+ }
30
+ end
31
+
32
+ # Returns all the JSON keys this model knows about
33
+ def self.acceptable_attributes
34
+ attribute_map.values
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'transcription_id' => :'String',
41
+ :'transcription_url' => :'String'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::CallTranscriptionMetadata` initialize method'
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!self.class.attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CallTranscriptionMetadata`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'transcription_id')
67
+ self.transcription_id = attributes[:'transcription_id']
68
+ end
69
+
70
+ if attributes.key?(:'transcription_url')
71
+ self.transcription_url = attributes[:'transcription_url']
72
+ end
73
+ end
74
+
75
+ # Show invalid properties with the reasons. Usually used together with valid?
76
+ # @return Array for valid properties with the reasons
77
+ def list_invalid_properties
78
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
79
+ invalid_properties = Array.new
80
+ invalid_properties
81
+ end
82
+
83
+ # Check to see if the all the properties in the model are valid
84
+ # @return true if the model is valid
85
+ def valid?
86
+ warn '[DEPRECATED] the `valid?` method is obsolete'
87
+ true
88
+ end
89
+
90
+ # Checks equality by comparing each attribute.
91
+ # @param [Object] Object to be compared
92
+ def ==(o)
93
+ return true if self.equal?(o)
94
+ self.class == o.class &&
95
+ transcription_id == o.transcription_id &&
96
+ transcription_url == o.transcription_url
97
+ end
98
+
99
+ # @see the `==` method
100
+ # @param [Object] Object to be compared
101
+ def eql?(o)
102
+ self == o
103
+ end
104
+
105
+ # Calculates hash code according to all attributes.
106
+ # @return [Integer] Hash code
107
+ def hash
108
+ [transcription_id, transcription_url].hash
109
+ end
110
+
111
+ # Builds the object from hash
112
+ # @param [Hash] attributes Model attributes in the form of hash
113
+ # @return [Object] Returns the model itself
114
+ def self.build_from_hash(attributes)
115
+ return nil unless attributes.is_a?(Hash)
116
+ attributes = attributes.transform_keys(&:to_sym)
117
+ transformed_hash = {}
118
+ openapi_types.each_pair do |key, type|
119
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
120
+ transformed_hash["#{key}"] = nil
121
+ elsif type =~ /\AArray<(.*)>/i
122
+ # check to ensure the input is an array given that the attribute
123
+ # is documented as an array but the input is not
124
+ if attributes[attribute_map[key]].is_a?(Array)
125
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
126
+ end
127
+ elsif !attributes[attribute_map[key]].nil?
128
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
129
+ end
130
+ end
131
+ new(transformed_hash)
132
+ end
133
+
134
+ # Deserializes the data based on type
135
+ # @param string type Data type
136
+ # @param string value Value to be deserialized
137
+ # @return [Object] Deserialized data
138
+ def self._deserialize(type, value)
139
+ case type.to_sym
140
+ when :Time
141
+ Time.parse(value)
142
+ when :Date
143
+ Date.parse(value)
144
+ when :String
145
+ value.to_s
146
+ when :Integer
147
+ value.to_i
148
+ when :Float
149
+ value.to_f
150
+ when :Boolean
151
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
152
+ true
153
+ else
154
+ false
155
+ end
156
+ when :Object
157
+ # generic object (usually a Hash), return directly
158
+ value
159
+ when /\AArray<(?<inner_type>.+)>\z/
160
+ inner_type = Regexp.last_match[:inner_type]
161
+ value.map { |v| _deserialize(inner_type, v) }
162
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
163
+ k_type = Regexp.last_match[:k_type]
164
+ v_type = Regexp.last_match[:v_type]
165
+ {}.tap do |hash|
166
+ value.each do |k, v|
167
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
168
+ end
169
+ end
170
+ else # model
171
+ # models (e.g. Pet) or oneOf
172
+ klass = Bandwidth.const_get(type)
173
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
174
+ end
175
+ end
176
+
177
+ # Returns the string representation of the object
178
+ # @return [String] String presentation of the object
179
+ def to_s
180
+ to_hash.to_s
181
+ end
182
+
183
+ # to_body is an alias to to_hash (backward compatibility)
184
+ # @return [Hash] Returns the object in the form of hash
185
+ def to_body
186
+ to_hash
187
+ end
188
+
189
+ # Returns the object in the form of hash
190
+ # @return [Hash] Returns the object in the form of hash
191
+ def to_hash
192
+ hash = {}
193
+ self.class.attribute_map.each_pair do |attr, param|
194
+ value = self.send(attr)
195
+ if value.nil?
196
+ is_nullable = self.class.openapi_nullable.include?(attr)
197
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
198
+ end
199
+
200
+ hash[param] = _to_hash(value)
201
+ end
202
+ hash
203
+ end
204
+
205
+ # Outputs non-array value in the form of hash
206
+ # For object, use to_hash. Otherwise, just return the value
207
+ # @param [Object] value Any valid value
208
+ # @return [Hash] Returns the value in the form of hash
209
+ def _to_hash(value)
210
+ if value.is_a?(Array)
211
+ value.compact.map { |v| _to_hash(v) }
212
+ elsif value.is_a?(Hash)
213
+ {}.tap do |hash|
214
+ value.each { |k, v| hash[k] = _to_hash(v) }
215
+ end
216
+ elsif value.respond_to? :to_hash
217
+ value.to_hash
218
+ else
219
+ value
220
+ end
221
+ end
222
+ end
223
+ end