bandwidth-sdk 13.1.4 → 14.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,244 +0,0 @@
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 TranscriptionMetadata
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::TranscriptionMetadata` 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::TranscriptionMetadata`. 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