mux_ruby 3.5.2 → 3.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +4 -4
- data/docs/CreateLiveStreamRequest.md +2 -0
- data/docs/CreateTranscriptionVocabularyRequest.md +22 -0
- data/docs/ListTranscriptionVocabulariesResponse.md +18 -0
- data/docs/LiveStream.md +3 -1
- data/docs/LiveStreamGeneratedSubtitleSettings.md +24 -0
- data/docs/LiveStreamsApi.md +73 -0
- data/docs/MetricsApi.md +2 -2
- data/docs/SpacesApi.md +1 -1
- data/docs/Track.md +2 -0
- data/docs/TranscriptionVocabulariesApi.md +367 -0
- data/docs/TranscriptionVocabulary.md +28 -0
- data/docs/TranscriptionVocabularyResponse.md +18 -0
- data/docs/UpdateLiveStreamGeneratedSubtitlesRequest.md +18 -0
- data/docs/UpdateTranscriptionVocabularyRequest.md +22 -0
- data/docs/VideoView.md +11 -1
- data/gen/generator-config.json +1 -1
- data/gen/templates/partial_model_generic.mustache +2 -2
- data/lib/mux_ruby/api/live_streams_api.rb +71 -0
- data/lib/mux_ruby/api/metrics_api.rb +2 -2
- data/lib/mux_ruby/api/spaces_api.rb +2 -2
- data/lib/mux_ruby/api/transcription_vocabularies_api.rb +349 -0
- data/lib/mux_ruby/models/create_live_stream_request.rb +18 -6
- data/lib/mux_ruby/models/create_transcription_vocabulary_request.rb +265 -0
- data/lib/mux_ruby/models/list_transcription_vocabularies_response.rb +220 -0
- data/lib/mux_ruby/models/live_stream.rb +14 -2
- data/lib/mux_ruby/models/live_stream_generated_subtitle_settings.rb +287 -0
- data/lib/mux_ruby/models/track.rb +23 -1
- data/lib/mux_ruby/models/transcription_vocabulary.rb +286 -0
- data/lib/mux_ruby/models/transcription_vocabulary_response.rb +218 -0
- data/lib/mux_ruby/models/update_live_stream_generated_subtitles_request.rb +221 -0
- data/lib/mux_ruby/models/update_live_stream_request.rb +5 -5
- data/lib/mux_ruby/models/update_transcription_vocabulary_request.rb +265 -0
- data/lib/mux_ruby/models/video_view.rb +55 -5
- data/lib/mux_ruby/version.rb +1 -1
- data/lib/mux_ruby.rb +8 -0
- data/spec/api/transcription_vocabularies_api_spec.rb +97 -0
- data/spec/models/create_transcription_vocabulary_request_spec.rb +46 -0
- data/spec/models/list_transcription_vocabularies_response_spec.rb +34 -0
- data/spec/models/live_stream_generated_subtitle_settings_spec.rb +56 -0
- data/spec/models/transcription_vocabulary_response_spec.rb +34 -0
- data/spec/models/transcription_vocabulary_spec.rb +64 -0
- data/spec/models/update_live_stream_generated_subtitles_request_spec.rb +34 -0
- data/spec/models/update_transcription_vocabulary_request_spec.rb +46 -0
- metadata +151 -119
@@ -0,0 +1,287 @@
|
|
1
|
+
=begin
|
2
|
+
#Mux API
|
3
|
+
|
4
|
+
#Mux is how developers build online video. This API encompasses both Mux Video and Mux Data functionality to help you build your video-related projects better and faster than ever before.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: v1
|
7
|
+
Contact: devex@mux.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.0.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module MuxRuby
|
17
|
+
class LiveStreamGeneratedSubtitleSettings
|
18
|
+
# A name for this live stream subtitle track.
|
19
|
+
attr_accessor :name
|
20
|
+
|
21
|
+
# Arbitrary metadata set for the live stream subtitle track. Max 255 characters.
|
22
|
+
attr_accessor :passthrough
|
23
|
+
|
24
|
+
# The language to generate subtitles in.
|
25
|
+
attr_accessor :language_code
|
26
|
+
|
27
|
+
# Unique identifiers for existing Transcription Vocabularies to use while generating subtitles for the live stream. If the Transcription Vocabularies provided collectively have more than 1000 phrases, only the first 1000 phrases will be included.
|
28
|
+
attr_accessor :transcription_vocabulary_ids
|
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
|
+
:'name' => :'name',
|
56
|
+
:'passthrough' => :'passthrough',
|
57
|
+
:'language_code' => :'language_code',
|
58
|
+
:'transcription_vocabulary_ids' => :'transcription_vocabulary_ids'
|
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
|
+
:'name' => :'String',
|
71
|
+
:'passthrough' => :'String',
|
72
|
+
:'language_code' => :'String',
|
73
|
+
:'transcription_vocabulary_ids' => :'Array<String>'
|
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 `MuxRuby::LiveStreamGeneratedSubtitleSettings` 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 `MuxRuby::LiveStreamGeneratedSubtitleSettings`. 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?(:'name')
|
99
|
+
self.name = attributes[:'name']
|
100
|
+
end
|
101
|
+
|
102
|
+
if attributes.key?(:'passthrough')
|
103
|
+
self.passthrough = attributes[:'passthrough']
|
104
|
+
end
|
105
|
+
|
106
|
+
if attributes.key?(:'language_code')
|
107
|
+
self.language_code = attributes[:'language_code']
|
108
|
+
else
|
109
|
+
self.language_code = 'en'
|
110
|
+
end
|
111
|
+
|
112
|
+
if attributes.key?(:'transcription_vocabulary_ids')
|
113
|
+
if (value = attributes[:'transcription_vocabulary_ids']).is_a?(Array)
|
114
|
+
self.transcription_vocabulary_ids = value
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
120
|
+
# @return Array for valid properties with the reasons
|
121
|
+
def list_invalid_properties
|
122
|
+
invalid_properties = Array.new
|
123
|
+
invalid_properties
|
124
|
+
end
|
125
|
+
|
126
|
+
# Check to see if the all the properties in the model are valid
|
127
|
+
# @return true if the model is valid
|
128
|
+
def valid?
|
129
|
+
language_code_validator = EnumAttributeValidator.new('String', ["en", "en-US"])
|
130
|
+
return false unless language_code_validator.valid?(@language_code)
|
131
|
+
true
|
132
|
+
end
|
133
|
+
|
134
|
+
# Custom attribute writer method checking allowed values (enum).
|
135
|
+
# @param [Object] language_code Object to be assigned
|
136
|
+
def language_code=(language_code)
|
137
|
+
validator = EnumAttributeValidator.new('String', ["en", "en-US"])
|
138
|
+
unless validator.valid?(language_code)
|
139
|
+
fail ArgumentError, "invalid value for \"language_code\", must be one of #{validator.allowable_values}."
|
140
|
+
end
|
141
|
+
@language_code = language_code
|
142
|
+
end
|
143
|
+
|
144
|
+
# Checks equality by comparing each attribute.
|
145
|
+
# @param [Object] Object to be compared
|
146
|
+
def ==(o)
|
147
|
+
return true if self.equal?(o)
|
148
|
+
self.class == o.class &&
|
149
|
+
name == o.name &&
|
150
|
+
passthrough == o.passthrough &&
|
151
|
+
language_code == o.language_code &&
|
152
|
+
transcription_vocabulary_ids == o.transcription_vocabulary_ids
|
153
|
+
end
|
154
|
+
|
155
|
+
# @see the `==` method
|
156
|
+
# @param [Object] Object to be compared
|
157
|
+
def eql?(o)
|
158
|
+
self == o
|
159
|
+
end
|
160
|
+
|
161
|
+
# Calculates hash code according to all attributes.
|
162
|
+
# @return [Integer] Hash code
|
163
|
+
def hash
|
164
|
+
[name, passthrough, language_code, transcription_vocabulary_ids].hash
|
165
|
+
end
|
166
|
+
|
167
|
+
# Builds the object from hash
|
168
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
169
|
+
# @return [Object] Returns the model itself
|
170
|
+
def self.build_from_hash(attributes)
|
171
|
+
new.build_from_hash(attributes)
|
172
|
+
end
|
173
|
+
|
174
|
+
# Builds the object from hash
|
175
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
176
|
+
# @return [Object] Returns the model itself
|
177
|
+
def build_from_hash(attributes)
|
178
|
+
return nil unless attributes.is_a?(Hash)
|
179
|
+
self.class.openapi_types.each_pair do |key, type|
|
180
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
181
|
+
self.send("#{key}=", nil)
|
182
|
+
elsif type =~ /\AArray<(.*)>/i
|
183
|
+
# check to ensure the input is an array given that the attribute
|
184
|
+
# is documented as an array but the input is not
|
185
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
186
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
187
|
+
end
|
188
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
189
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
self
|
194
|
+
end
|
195
|
+
|
196
|
+
# Deserializes the data based on type
|
197
|
+
# @param string type Data type
|
198
|
+
# @param string value Value to be deserialized
|
199
|
+
# @return [Object] Deserialized data
|
200
|
+
def _deserialize(type, value)
|
201
|
+
case type.to_sym
|
202
|
+
when :Time
|
203
|
+
Time.parse(value)
|
204
|
+
when :Date
|
205
|
+
Date.parse(value)
|
206
|
+
when :String
|
207
|
+
value.to_s
|
208
|
+
when :Integer
|
209
|
+
value.to_i
|
210
|
+
when :Float
|
211
|
+
value.to_f
|
212
|
+
when :Boolean
|
213
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
214
|
+
true
|
215
|
+
else
|
216
|
+
false
|
217
|
+
end
|
218
|
+
when :Object
|
219
|
+
# generic object (usually a Hash), return directly
|
220
|
+
value
|
221
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
222
|
+
inner_type = Regexp.last_match[:inner_type]
|
223
|
+
value.map { |v| _deserialize(inner_type, v) }
|
224
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
225
|
+
k_type = Regexp.last_match[:k_type]
|
226
|
+
v_type = Regexp.last_match[:v_type]
|
227
|
+
{}.tap do |hash|
|
228
|
+
value.each do |k, v|
|
229
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
230
|
+
end
|
231
|
+
end
|
232
|
+
else # model
|
233
|
+
# models (e.g. Pet) or oneOf
|
234
|
+
klass = MuxRuby.const_get(type)
|
235
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
# Returns the string representation of the object
|
240
|
+
# @return [String] String presentation of the object
|
241
|
+
def to_s
|
242
|
+
to_hash.to_s
|
243
|
+
end
|
244
|
+
|
245
|
+
# to_body is an alias to to_hash (backward compatibility)
|
246
|
+
# @return [Hash] Returns the object in the form of hash
|
247
|
+
def to_body
|
248
|
+
to_hash
|
249
|
+
end
|
250
|
+
|
251
|
+
# Returns the object in the form of hash
|
252
|
+
# @return [Hash] Returns the object in the form of hash
|
253
|
+
def to_hash
|
254
|
+
hash = {}
|
255
|
+
self.class.attribute_map.each_pair do |attr, param|
|
256
|
+
value = self.send(attr)
|
257
|
+
if value.nil?
|
258
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
259
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
260
|
+
end
|
261
|
+
|
262
|
+
hash[param] = _to_hash(value)
|
263
|
+
end
|
264
|
+
hash
|
265
|
+
end
|
266
|
+
|
267
|
+
# Outputs non-array value in the form of hash
|
268
|
+
# For object, use to_hash. Otherwise, just return the value
|
269
|
+
# @param [Object] value Any valid value
|
270
|
+
# @return [Hash] Returns the value in the form of hash
|
271
|
+
def _to_hash(value)
|
272
|
+
if value.is_a?(Array)
|
273
|
+
value.compact.map { |v| _to_hash(v) }
|
274
|
+
elsif value.is_a?(Hash)
|
275
|
+
{}.tap do |hash|
|
276
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
277
|
+
end
|
278
|
+
elsif value.respond_to? :to_hash
|
279
|
+
value.to_hash
|
280
|
+
else
|
281
|
+
value
|
282
|
+
end
|
283
|
+
end
|
284
|
+
|
285
|
+
end
|
286
|
+
|
287
|
+
end
|
@@ -42,6 +42,9 @@ module MuxRuby
|
|
42
42
|
# This parameter is only set for `text` type tracks.
|
43
43
|
attr_accessor :text_type
|
44
44
|
|
45
|
+
# The source of the text contained in a Track of type `text`. Valid `text_source` values are listed below. * `uploaded`: Tracks uploaded to Mux as caption or subtitle files using the Create Asset Track API. * `embedded`: Tracks extracted from an embedded stream of CEA-608 closed captions. * `generated_live`: Tracks generated by automatic speech recognition on a live stream configured with `generated_subtitles`. If an Asset has both `generated_live` and `generated_live_final` tracks that are `ready`, then only the `generated_live_final` track will be included during playback. * `generated_live_final`: Tracks generated by automatic speech recognition on a live stream using `generated_subtitles`. The accuracy, timing, and formatting of these subtitles is improved compared to the corresponding `generated_live` tracks. However, `generated_live_final` tracks will not be available in `ready` status until the live stream ends. If an Asset has both `generated_live` and `generated_live_final` tracks that are `ready`, then only the `generated_live_final` track will be included during playback.
|
46
|
+
attr_accessor :text_source
|
47
|
+
|
45
48
|
# The language code value represents [BCP 47](https://tools.ietf.org/html/bcp47) specification compliant value. For example, `en` for English or `en-US` for the US version of English. This parameter is only set for `text` type and `subtitles` text type tracks.
|
46
49
|
attr_accessor :language_code
|
47
50
|
|
@@ -91,6 +94,7 @@ module MuxRuby
|
|
91
94
|
:'max_channels' => :'max_channels',
|
92
95
|
:'max_channel_layout' => :'max_channel_layout',
|
93
96
|
:'text_type' => :'text_type',
|
97
|
+
:'text_source' => :'text_source',
|
94
98
|
:'language_code' => :'language_code',
|
95
99
|
:'name' => :'name',
|
96
100
|
:'closed_captions' => :'closed_captions',
|
@@ -116,6 +120,7 @@ module MuxRuby
|
|
116
120
|
:'max_channels' => :'Integer',
|
117
121
|
:'max_channel_layout' => :'String',
|
118
122
|
:'text_type' => :'String',
|
123
|
+
:'text_source' => :'String',
|
119
124
|
:'language_code' => :'String',
|
120
125
|
:'name' => :'String',
|
121
126
|
:'closed_captions' => :'Boolean',
|
@@ -181,6 +186,10 @@ module MuxRuby
|
|
181
186
|
self.text_type = attributes[:'text_type']
|
182
187
|
end
|
183
188
|
|
189
|
+
if attributes.key?(:'text_source')
|
190
|
+
self.text_source = attributes[:'text_source']
|
191
|
+
end
|
192
|
+
|
184
193
|
if attributes.key?(:'language_code')
|
185
194
|
self.language_code = attributes[:'language_code']
|
186
195
|
end
|
@@ -216,6 +225,8 @@ module MuxRuby
|
|
216
225
|
return false unless type_validator.valid?(@type)
|
217
226
|
text_type_validator = EnumAttributeValidator.new('String', ["subtitles"])
|
218
227
|
return false unless text_type_validator.valid?(@text_type)
|
228
|
+
text_source_validator = EnumAttributeValidator.new('String', ["uploaded", "embedded", "generated_live", "generated_live_final"])
|
229
|
+
return false unless text_source_validator.valid?(@text_source)
|
219
230
|
status_validator = EnumAttributeValidator.new('String', ["preparing", "ready", "errored"])
|
220
231
|
return false unless status_validator.valid?(@status)
|
221
232
|
true
|
@@ -241,6 +252,16 @@ module MuxRuby
|
|
241
252
|
@text_type = text_type
|
242
253
|
end
|
243
254
|
|
255
|
+
# Custom attribute writer method checking allowed values (enum).
|
256
|
+
# @param [Object] text_source Object to be assigned
|
257
|
+
def text_source=(text_source)
|
258
|
+
validator = EnumAttributeValidator.new('String', ["uploaded", "embedded", "generated_live", "generated_live_final"])
|
259
|
+
unless validator.valid?(text_source)
|
260
|
+
fail ArgumentError, "invalid value for \"text_source\", must be one of #{validator.allowable_values}."
|
261
|
+
end
|
262
|
+
@text_source = text_source
|
263
|
+
end
|
264
|
+
|
244
265
|
# Custom attribute writer method checking allowed values (enum).
|
245
266
|
# @param [Object] status Object to be assigned
|
246
267
|
def status=(status)
|
@@ -265,6 +286,7 @@ module MuxRuby
|
|
265
286
|
max_channels == o.max_channels &&
|
266
287
|
max_channel_layout == o.max_channel_layout &&
|
267
288
|
text_type == o.text_type &&
|
289
|
+
text_source == o.text_source &&
|
268
290
|
language_code == o.language_code &&
|
269
291
|
name == o.name &&
|
270
292
|
closed_captions == o.closed_captions &&
|
@@ -281,7 +303,7 @@ module MuxRuby
|
|
281
303
|
# Calculates hash code according to all attributes.
|
282
304
|
# @return [Integer] Hash code
|
283
305
|
def hash
|
284
|
-
[id, type, duration, max_width, max_height, max_frame_rate, max_channels, max_channel_layout, text_type, language_code, name, closed_captions, passthrough, status].hash
|
306
|
+
[id, type, duration, max_width, max_height, max_frame_rate, max_channels, max_channel_layout, text_type, text_source, language_code, name, closed_captions, passthrough, status].hash
|
285
307
|
end
|
286
308
|
|
287
309
|
# Builds the object from hash
|
@@ -0,0 +1,286 @@
|
|
1
|
+
=begin
|
2
|
+
#Mux API
|
3
|
+
|
4
|
+
#Mux is how developers build online video. This API encompasses both Mux Video and Mux Data functionality to help you build your video-related projects better and faster than ever before.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: v1
|
7
|
+
Contact: devex@mux.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.0.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module MuxRuby
|
17
|
+
class TranscriptionVocabulary
|
18
|
+
# Unique identifier for the Transcription Vocabulary
|
19
|
+
attr_accessor :id
|
20
|
+
|
21
|
+
# The user-supplied name of the Transcription Vocabulary.
|
22
|
+
attr_accessor :name
|
23
|
+
|
24
|
+
# Phrases, individual words, or proper names to include in the Transcription Vocabulary. When the Transcription Vocabulary is attached to a live stream's `generated_subtitles` configuration, the probability of successful speech recognition for these words or phrases is boosted.
|
25
|
+
attr_accessor :phrases
|
26
|
+
|
27
|
+
# Arbitrary user-supplied metadata set for the Transcription Vocabulary. Max 255 characters.
|
28
|
+
attr_accessor :passthrough
|
29
|
+
|
30
|
+
# Time the Transcription Vocabulary was created, defined as a Unix timestamp (seconds since epoch).
|
31
|
+
attr_accessor :created_at
|
32
|
+
|
33
|
+
# Time the Transcription Vocabulary was updated, defined as a Unix timestamp (seconds since epoch).
|
34
|
+
attr_accessor :updated_at
|
35
|
+
|
36
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
37
|
+
def self.attribute_map
|
38
|
+
{
|
39
|
+
:'id' => :'id',
|
40
|
+
:'name' => :'name',
|
41
|
+
:'phrases' => :'phrases',
|
42
|
+
:'passthrough' => :'passthrough',
|
43
|
+
:'created_at' => :'created_at',
|
44
|
+
:'updated_at' => :'updated_at'
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
# Returns all the JSON keys this model knows about
|
49
|
+
def self.acceptable_attributes
|
50
|
+
attribute_map.values
|
51
|
+
end
|
52
|
+
|
53
|
+
# Attribute type mapping.
|
54
|
+
def self.openapi_types
|
55
|
+
{
|
56
|
+
:'id' => :'String',
|
57
|
+
:'name' => :'String',
|
58
|
+
:'phrases' => :'Array<String>',
|
59
|
+
:'passthrough' => :'String',
|
60
|
+
:'created_at' => :'String',
|
61
|
+
:'updated_at' => :'String'
|
62
|
+
}
|
63
|
+
end
|
64
|
+
|
65
|
+
# List of attributes with nullable: true
|
66
|
+
def self.openapi_nullable
|
67
|
+
Set.new([
|
68
|
+
])
|
69
|
+
end
|
70
|
+
|
71
|
+
# Initializes the object
|
72
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
73
|
+
def initialize(attributes = {})
|
74
|
+
if (!attributes.is_a?(Hash))
|
75
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `MuxRuby::TranscriptionVocabulary` initialize method"
|
76
|
+
end
|
77
|
+
|
78
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
79
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
80
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
81
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `MuxRuby::TranscriptionVocabulary`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
82
|
+
end
|
83
|
+
h[k.to_sym] = v
|
84
|
+
}
|
85
|
+
|
86
|
+
if attributes.key?(:'id')
|
87
|
+
self.id = attributes[:'id']
|
88
|
+
end
|
89
|
+
|
90
|
+
if attributes.key?(:'name')
|
91
|
+
self.name = attributes[:'name']
|
92
|
+
end
|
93
|
+
|
94
|
+
if attributes.key?(:'phrases')
|
95
|
+
if (value = attributes[:'phrases']).is_a?(Array)
|
96
|
+
self.phrases = value
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
if attributes.key?(:'passthrough')
|
101
|
+
self.passthrough = attributes[:'passthrough']
|
102
|
+
end
|
103
|
+
|
104
|
+
if attributes.key?(:'created_at')
|
105
|
+
self.created_at = attributes[:'created_at']
|
106
|
+
end
|
107
|
+
|
108
|
+
if attributes.key?(:'updated_at')
|
109
|
+
self.updated_at = attributes[:'updated_at']
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
114
|
+
# @return Array for valid properties with the reasons
|
115
|
+
def list_invalid_properties
|
116
|
+
invalid_properties = Array.new
|
117
|
+
if !@phrases.nil? && @phrases.length > 1000
|
118
|
+
invalid_properties.push('invalid value for "phrases", number of items must be less than or equal to 1000.')
|
119
|
+
end
|
120
|
+
|
121
|
+
invalid_properties
|
122
|
+
end
|
123
|
+
|
124
|
+
# Check to see if the all the properties in the model are valid
|
125
|
+
# @return true if the model is valid
|
126
|
+
def valid?
|
127
|
+
return false if !@phrases.nil? && @phrases.length > 1000
|
128
|
+
true
|
129
|
+
end
|
130
|
+
|
131
|
+
# Custom attribute writer method with validation
|
132
|
+
# @param [Object] phrases Value to be assigned
|
133
|
+
def phrases=(phrases)
|
134
|
+
if !phrases.nil? && phrases.length > 1000
|
135
|
+
fail ArgumentError, 'invalid value for "phrases", number of items must be less than or equal to 1000.'
|
136
|
+
end
|
137
|
+
|
138
|
+
@phrases = phrases
|
139
|
+
end
|
140
|
+
|
141
|
+
# Checks equality by comparing each attribute.
|
142
|
+
# @param [Object] Object to be compared
|
143
|
+
def ==(o)
|
144
|
+
return true if self.equal?(o)
|
145
|
+
self.class == o.class &&
|
146
|
+
id == o.id &&
|
147
|
+
name == o.name &&
|
148
|
+
phrases == o.phrases &&
|
149
|
+
passthrough == o.passthrough &&
|
150
|
+
created_at == o.created_at &&
|
151
|
+
updated_at == o.updated_at
|
152
|
+
end
|
153
|
+
|
154
|
+
# @see the `==` method
|
155
|
+
# @param [Object] Object to be compared
|
156
|
+
def eql?(o)
|
157
|
+
self == o
|
158
|
+
end
|
159
|
+
|
160
|
+
# Calculates hash code according to all attributes.
|
161
|
+
# @return [Integer] Hash code
|
162
|
+
def hash
|
163
|
+
[id, name, phrases, passthrough, created_at, updated_at].hash
|
164
|
+
end
|
165
|
+
|
166
|
+
# Builds the object from hash
|
167
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
168
|
+
# @return [Object] Returns the model itself
|
169
|
+
def self.build_from_hash(attributes)
|
170
|
+
new.build_from_hash(attributes)
|
171
|
+
end
|
172
|
+
|
173
|
+
# Builds the object from hash
|
174
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
175
|
+
# @return [Object] Returns the model itself
|
176
|
+
def build_from_hash(attributes)
|
177
|
+
return nil unless attributes.is_a?(Hash)
|
178
|
+
self.class.openapi_types.each_pair do |key, type|
|
179
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
180
|
+
self.send("#{key}=", nil)
|
181
|
+
elsif type =~ /\AArray<(.*)>/i
|
182
|
+
# check to ensure the input is an array given that the attribute
|
183
|
+
# is documented as an array but the input is not
|
184
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
185
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
186
|
+
end
|
187
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
188
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
self
|
193
|
+
end
|
194
|
+
|
195
|
+
# Deserializes the data based on type
|
196
|
+
# @param string type Data type
|
197
|
+
# @param string value Value to be deserialized
|
198
|
+
# @return [Object] Deserialized data
|
199
|
+
def _deserialize(type, value)
|
200
|
+
case type.to_sym
|
201
|
+
when :Time
|
202
|
+
Time.parse(value)
|
203
|
+
when :Date
|
204
|
+
Date.parse(value)
|
205
|
+
when :String
|
206
|
+
value.to_s
|
207
|
+
when :Integer
|
208
|
+
value.to_i
|
209
|
+
when :Float
|
210
|
+
value.to_f
|
211
|
+
when :Boolean
|
212
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
213
|
+
true
|
214
|
+
else
|
215
|
+
false
|
216
|
+
end
|
217
|
+
when :Object
|
218
|
+
# generic object (usually a Hash), return directly
|
219
|
+
value
|
220
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
221
|
+
inner_type = Regexp.last_match[:inner_type]
|
222
|
+
value.map { |v| _deserialize(inner_type, v) }
|
223
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
224
|
+
k_type = Regexp.last_match[:k_type]
|
225
|
+
v_type = Regexp.last_match[:v_type]
|
226
|
+
{}.tap do |hash|
|
227
|
+
value.each do |k, v|
|
228
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
229
|
+
end
|
230
|
+
end
|
231
|
+
else # model
|
232
|
+
# models (e.g. Pet) or oneOf
|
233
|
+
klass = MuxRuby.const_get(type)
|
234
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
# Returns the string representation of the object
|
239
|
+
# @return [String] String presentation of the object
|
240
|
+
def to_s
|
241
|
+
to_hash.to_s
|
242
|
+
end
|
243
|
+
|
244
|
+
# to_body is an alias to to_hash (backward compatibility)
|
245
|
+
# @return [Hash] Returns the object in the form of hash
|
246
|
+
def to_body
|
247
|
+
to_hash
|
248
|
+
end
|
249
|
+
|
250
|
+
# Returns the object in the form of hash
|
251
|
+
# @return [Hash] Returns the object in the form of hash
|
252
|
+
def to_hash
|
253
|
+
hash = {}
|
254
|
+
self.class.attribute_map.each_pair do |attr, param|
|
255
|
+
value = self.send(attr)
|
256
|
+
if value.nil?
|
257
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
258
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
259
|
+
end
|
260
|
+
|
261
|
+
hash[param] = _to_hash(value)
|
262
|
+
end
|
263
|
+
hash
|
264
|
+
end
|
265
|
+
|
266
|
+
# Outputs non-array value in the form of hash
|
267
|
+
# For object, use to_hash. Otherwise, just return the value
|
268
|
+
# @param [Object] value Any valid value
|
269
|
+
# @return [Hash] Returns the value in the form of hash
|
270
|
+
def _to_hash(value)
|
271
|
+
if value.is_a?(Array)
|
272
|
+
value.compact.map { |v| _to_hash(v) }
|
273
|
+
elsif value.is_a?(Hash)
|
274
|
+
{}.tap do |hash|
|
275
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
276
|
+
end
|
277
|
+
elsif value.respond_to? :to_hash
|
278
|
+
value.to_hash
|
279
|
+
else
|
280
|
+
value
|
281
|
+
end
|
282
|
+
end
|
283
|
+
|
284
|
+
end
|
285
|
+
|
286
|
+
end
|