Class: TelestreamCloud::Tts::Job

Inherits:
Object
  • Object
show all
Defined in:
lib/telestream_cloud_tts/models/job.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Job

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# File 'lib/telestream_cloud_tts/models/job.rb', line 134

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}

  if attributes.has_key?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.has_key?(:'name')
    self.name = attributes[:'name']
  end

  if attributes.has_key?(:'original_filename')
    self.original_filename = attributes[:'original_filename']
  end

  if attributes.has_key?(:'project_id')
    self.project_id = attributes[:'project_id']
  end

  if attributes.has_key?(:'source_url')
    self.source_url = attributes[:'source_url']
  end

  if attributes.has_key?(:'status')
    self.status = attributes[:'status']
  end

  if attributes.has_key?(:'error')
    self.error = attributes[:'error']
  end

  if attributes.has_key?(:'progress')
    self.progress = attributes[:'progress']
  end

  if attributes.has_key?(:'confidence')
    self.confidence = attributes[:'confidence']
  end

  if attributes.has_key?(:'duration')
    self.duration = attributes[:'duration']
  end

  if attributes.has_key?(:'bitrate')
    self.bitrate = attributes[:'bitrate']
  end

  if attributes.has_key?(:'sample_rate')
    self.sample_rate = attributes[:'sample_rate']
  end

  if attributes.has_key?(:'format')
    self.format = attributes[:'format']
  end

  if attributes.has_key?(:'file_size')
    self.file_size = attributes[:'file_size']
  end

  if attributes.has_key?(:'created_at')
    self.created_at = attributes[:'created_at']
  end

  if attributes.has_key?(:'updated_at')
    self.updated_at = attributes[:'updated_at']
  end

end

Instance Attribute Details

#bitrateObject

The bitrate of the input audio.



49
50
51
# File 'lib/telestream_cloud_tts/models/job.rb', line 49

def bitrate
  @bitrate
end

#confidenceObject

The confidence score of the job in the range of 0 to 100.



43
44
45
# File 'lib/telestream_cloud_tts/models/job.rb', line 43

def confidence
  @confidence
end

#created_atObject

A date and time when the job was created



61
62
63
# File 'lib/telestream_cloud_tts/models/job.rb', line 61

def created_at
  @created_at
end

#durationObject

The duration of the input audio in milliseconds.



46
47
48
# File 'lib/telestream_cloud_tts/models/job.rb', line 46

def duration
  @duration
end

#errorObject

If the status of the job is ‘error’, returns the state of job.



37
38
39
# File 'lib/telestream_cloud_tts/models/job.rb', line 37

def error
  @error
end

#file_sizeObject

The file size of the input file.



58
59
60
# File 'lib/telestream_cloud_tts/models/job.rb', line 58

def file_size
  @file_size
end

#formatObject

The format of the input audio.



55
56
57
# File 'lib/telestream_cloud_tts/models/job.rb', line 55

def format
  @format
end

#idObject

The ID of the job.



19
20
21
# File 'lib/telestream_cloud_tts/models/job.rb', line 19

def id
  @id
end

#nameObject

The name of the job.



22
23
24
# File 'lib/telestream_cloud_tts/models/job.rb', line 22

def name
  @name
end

#original_filenameObject

The name of the input file



25
26
27
# File 'lib/telestream_cloud_tts/models/job.rb', line 25

def original_filename
  @original_filename
end

#progressObject

A percentage that indicates the progress of the job.



40
41
42
# File 'lib/telestream_cloud_tts/models/job.rb', line 40

def progress
  @progress
end

#project_idObject

The ID of the project.



28
29
30
# File 'lib/telestream_cloud_tts/models/job.rb', line 28

def project_id
  @project_id
end

#sample_rateObject

The sample rate of the input audio.



52
53
54
# File 'lib/telestream_cloud_tts/models/job.rb', line 52

def sample_rate
  @sample_rate
end

#source_urlObject

The URL of source file.



31
32
33
# File 'lib/telestream_cloud_tts/models/job.rb', line 31

def source_url
  @source_url
end

#statusObject

Determines the state of transcription job.



34
35
36
# File 'lib/telestream_cloud_tts/models/job.rb', line 34

def status
  @status
end

#updated_atObject

A date and time when the job was updated



64
65
66
# File 'lib/telestream_cloud_tts/models/job.rb', line 64

def updated_at
  @updated_at
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/telestream_cloud_tts/models/job.rb', line 89

def self.attribute_map
  {
    :'id' => :'id',
    :'name' => :'name',
    :'original_filename' => :'original_filename',
    :'project_id' => :'project_id',
    :'source_url' => :'source_url',
    :'status' => :'status',
    :'error' => :'error',
    :'progress' => :'progress',
    :'confidence' => :'confidence',
    :'duration' => :'duration',
    :'bitrate' => :'bitrate',
    :'sample_rate' => :'sample_rate',
    :'format' => :'format',
    :'file_size' => :'file_size',
    :'created_at' => :'created_at',
    :'updated_at' => :'updated_at'
  }
end

.swagger_typesObject

Attribute type mapping.



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/telestream_cloud_tts/models/job.rb', line 111

def self.swagger_types
  {
    :'id' => :'String',
    :'name' => :'String',
    :'original_filename' => :'String',
    :'project_id' => :'String',
    :'source_url' => :'String',
    :'status' => :'String',
    :'error' => :'String',
    :'progress' => :'Integer',
    :'confidence' => :'Integer',
    :'duration' => :'Integer',
    :'bitrate' => :'Integer',
    :'sample_rate' => :'Integer',
    :'format' => :'String',
    :'file_size' => :'String',
    :'created_at' => :'String',
    :'updated_at' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
# File 'lib/telestream_cloud_tts/models/job.rb', line 233

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      name == o.name &&
      original_filename == o.original_filename &&
      project_id == o.project_id &&
      source_url == o.source_url &&
      status == o.status &&
      error == o.error &&
      progress == o.progress &&
      confidence == o.confidence &&
      duration == o.duration &&
      bitrate == o.bitrate &&
      sample_rate == o.sample_rate &&
      format == o.format &&
      file_size == o.file_size &&
      created_at == o.created_at &&
      updated_at == o.updated_at
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
# File 'lib/telestream_cloud_tts/models/job.rb', line 290

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :BOOLEAN
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    temp_model = TelestreamCloud::Tts.const_get(type).new
    temp_model.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



356
357
358
359
360
361
362
363
364
365
366
367
368
# File 'lib/telestream_cloud_tts/models/job.rb', line 356

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map{ |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
# File 'lib/telestream_cloud_tts/models/job.rb', line 269

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


256
257
258
# File 'lib/telestream_cloud_tts/models/job.rb', line 256

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



262
263
264
# File 'lib/telestream_cloud_tts/models/job.rb', line 262

def hash
  [id, name, original_filename, project_id, source_url, status, error, progress, confidence, duration, bitrate, sample_rate, format, file_size, created_at, updated_at].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



208
209
210
211
# File 'lib/telestream_cloud_tts/models/job.rb', line 208

def list_invalid_properties
  invalid_properties = Array.new
  return invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



336
337
338
# File 'lib/telestream_cloud_tts/models/job.rb', line 336

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



342
343
344
345
346
347
348
349
350
# File 'lib/telestream_cloud_tts/models/job.rb', line 342

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



330
331
332
# File 'lib/telestream_cloud_tts/models/job.rb', line 330

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



215
216
217
218
219
# File 'lib/telestream_cloud_tts/models/job.rb', line 215

def valid?
  status_validator = EnumAttributeValidator.new('String', ["pending", "preparing", "processing", "success", "error"])
  return false unless status_validator.valid?(@status)
  return true
end