Class: Typecast::Models::TTSRequest

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

Direct Known Subclasses

TTSRequestStream

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(voice_id:, text:, model:, language: nil, prompt: nil, output: nil, seed: nil) ⇒ TTSRequest

Browse available API voices at typecast.ai/developers/api/voices.



100
101
102
103
104
105
106
107
108
# File 'lib/typecast/models.rb', line 100

def initialize(voice_id:, text:, model:, language: nil, prompt: nil, output: nil, seed: nil)
  @voice_id = voice_id
  @text = text
  @model = model
  @language = language
  @prompt = prompt
  @output = output
  @seed = seed
end

Instance Attribute Details

#languageObject (readonly)

Returns the value of attribute language.



97
98
99
# File 'lib/typecast/models.rb', line 97

def language
  @language
end

#modelObject (readonly)

Returns the value of attribute model.



97
98
99
# File 'lib/typecast/models.rb', line 97

def model
  @model
end

#outputObject (readonly)

Returns the value of attribute output.



97
98
99
# File 'lib/typecast/models.rb', line 97

def output
  @output
end

#promptObject (readonly)

Returns the value of attribute prompt.



97
98
99
# File 'lib/typecast/models.rb', line 97

def prompt
  @prompt
end

#seedObject (readonly)

Returns the value of attribute seed.



97
98
99
# File 'lib/typecast/models.rb', line 97

def seed
  @seed
end

#textObject (readonly)

Returns the value of attribute text.



97
98
99
# File 'lib/typecast/models.rb', line 97

def text
  @text
end

#voice_idObject (readonly)

Returns the value of attribute voice_id.



97
98
99
# File 'lib/typecast/models.rb', line 97

def voice_id
  @voice_id
end

Instance Method Details

#to_hObject



110
111
112
113
114
115
116
117
118
119
120
# File 'lib/typecast/models.rb', line 110

def to_h
  Models.compact(
    voice_id: voice_id,
    text: text,
    model: model,
    language: language,
    prompt: Models.value_to_h(prompt),
    output: Models.value_to_h(output),
    seed: seed
  )
end