Class: Bandwidth::Transcription

Inherits:
BaseModel show all
Defined in:
lib/bandwidth/voice_lib/voice/models/transcription.rb

Overview

Transcription Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(id = nil, url = nil, status = nil, completed_time = nil) ⇒ Transcription

Returns a new instance of Transcription.



53
54
55
56
57
58
59
60
61
# File 'lib/bandwidth/voice_lib/voice/models/transcription.rb', line 53

def initialize(id = nil,
               url = nil,
               status = nil,
               completed_time = nil)
  @id = id unless id == SKIP
  @url = url unless url == SKIP
  @status = status unless status == SKIP
  @completed_time = completed_time unless completed_time == SKIP
end

Instance Attribute Details

#completed_timeString

TODO: Write general description for this method

Returns:

  • (String)


26
27
28
# File 'lib/bandwidth/voice_lib/voice/models/transcription.rb', line 26

def completed_time
  @completed_time
end

#idString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/bandwidth/voice_lib/voice/models/transcription.rb', line 14

def id
  @id
end

#statusString

TODO: Write general description for this method

Returns:

  • (String)


22
23
24
# File 'lib/bandwidth/voice_lib/voice/models/transcription.rb', line 22

def status
  @status
end

#urlString

TODO: Write general description for this method

Returns:

  • (String)


18
19
20
# File 'lib/bandwidth/voice_lib/voice/models/transcription.rb', line 18

def url
  @url
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/bandwidth/voice_lib/voice/models/transcription.rb', line 64

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : SKIP
  url = hash.key?('url') ? hash['url'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP
  completed_time = hash.key?('completedTime') ? hash['completedTime'] : SKIP

  # Create object from extracted values.
  Transcription.new(id,
                    url,
                    status,
                    completed_time)
end

.namesObject

A mapping from model property names to API property names.



29
30
31
32
33
34
35
36
# File 'lib/bandwidth/voice_lib/voice/models/transcription.rb', line 29

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['url'] = 'url'
  @_hash['status'] = 'status'
  @_hash['completed_time'] = 'completedTime'
  @_hash
end

Instance Method Details

#nullablesObject

An array for nullable fields



49
50
51
# File 'lib/bandwidth/voice_lib/voice/models/transcription.rb', line 49

def nullables
  []
end

#optionalsObject

An array for optional fields



39
40
41
42
43
44
45
46
# File 'lib/bandwidth/voice_lib/voice/models/transcription.rb', line 39

def optionals
  %w[
    id
    url
    status
    completed_time
  ]
end