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 https://typecast.ai/developers/api/voices.



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

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

#language ⇒ Object (readonly)

Returns the value of attribute language.



107
108
109
# File 'lib/typecast/models.rb', line 107

def language
  @language
end

#model ⇒ Object (readonly)

Returns the value of attribute model.



107
108
109
# File 'lib/typecast/models.rb', line 107

def model
  @model
end

#output ⇒ Object (readonly)

Returns the value of attribute output.



107
108
109
# File 'lib/typecast/models.rb', line 107

def output
  @output
end

#prompt ⇒ Object (readonly)

Returns the value of attribute prompt.



107
108
109
# File 'lib/typecast/models.rb', line 107

def prompt
  @prompt
end

#seed ⇒ Object (readonly)

Returns the value of attribute seed.



107
108
109
# File 'lib/typecast/models.rb', line 107

def seed
  @seed
end

#text ⇒ Object (readonly)

Returns the value of attribute text.



107
108
109
# File 'lib/typecast/models.rb', line 107

def text
  @text
end

#voice_id ⇒ Object (readonly)

Returns the value of attribute voice_id.



107
108
109
# File 'lib/typecast/models.rb', line 107

def voice_id
  @voice_id
end

Instance Method Details

#to_h ⇒ Object



120
121
122
123
124
125
126
127
128
129
130
# File 'lib/typecast/models.rb', line 120

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