Class: Rev::Input
- Inherits:
-
ApiSerializable
- Object
- ApiSerializable
- Rev::Input
- Defined in:
- lib/rev-api/models/order_request.rb
Overview
Input for order (aka source file)
Constant Summary collapse
- SUPPORTED_ACCENTS =
{ :american_neutral => 'AmericanNeutral', :american_southern => 'AmericanSouthern', :asian => 'Asian', :australian => 'Australian', :british => 'British', :indian => 'Indian', :other => 'Other', :unknown => 'Unknown' }
Instance Attribute Summary collapse
-
#accents ⇒ Object
readonly
Optional, list of accents.
-
#audio_length_seconds ⇒ Object
readonly
Length of audio in seconds (mandatory in case of inability to determine it automatically).
-
#external_link ⇒ Object
readonly
External URL, if sources wasn’t POSTed as input (YouTube, Vimeo, Dropbox, etc).
-
#glossary ⇒ Object
readonly
Optional, list of glossary entries.
-
#speakers ⇒ Object
readonly
Optional, list of speaker names.
-
#uri ⇒ Object
readonly
Mandatory, URI of the media, as returned from the call to POST /inputs.
-
#video_length_seconds ⇒ Object
readonly
Length of video in seconds (mandatory in case of inability to determine it automatically).
Instance Method Summary collapse
Methods inherited from ApiSerializable
#initialize, #to_hash, #to_json
Constructor Details
This class inherits a constructor from Rev::ApiSerializable
Instance Attribute Details
#accents ⇒ Object (readonly)
Optional, list of accents.
202 203 204 |
# File 'lib/rev-api/models/order_request.rb', line 202 def accents @accents end |
#audio_length_seconds ⇒ Object (readonly)
Length of audio in seconds (mandatory in case of inability to determine it automatically). Used within OrderRequest::TranscriptionInfo
182 183 184 |
# File 'lib/rev-api/models/order_request.rb', line 182 def audio_length_seconds @audio_length_seconds end |
#external_link ⇒ Object (readonly)
External URL, if sources wasn’t POSTed as input (YouTube, Vimeo, Dropbox, etc)
193 194 195 |
# File 'lib/rev-api/models/order_request.rb', line 193 def external_link @external_link end |
#glossary ⇒ Object (readonly)
Optional, list of glossary entries.
196 197 198 |
# File 'lib/rev-api/models/order_request.rb', line 196 def glossary @glossary end |
#speakers ⇒ Object (readonly)
Optional, list of speaker names.
199 200 201 |
# File 'lib/rev-api/models/order_request.rb', line 199 def speakers @speakers end |
#uri ⇒ Object (readonly)
Mandatory, URI of the media, as returned from the call to POST /inputs. :external_link might substitute :uri for Transcription or Caption.
190 191 192 |
# File 'lib/rev-api/models/order_request.rb', line 190 def uri @uri end |
#video_length_seconds ⇒ Object (readonly)
Length of video in seconds (mandatory in case of inability to determine it automatically). Used within OrderRequest::CaptionInfo
186 187 188 |
# File 'lib/rev-api/models/order_request.rb', line 186 def video_length_seconds @video_length_seconds end |
Instance Method Details
#validate_accents ⇒ Object
241 242 243 244 245 246 247 248 249 250 |
# File 'lib/rev-api/models/order_request.rb', line 241 def validate_accents if accents if accents.length > SUPPORTED_ACCENTS.length raise(ArgumentError, "Length of accents list cannot exceed number of supported accents.") end if accents.any?{ |accent| !Rev::Input::SUPPORTED_ACCENTS.has_value?(accent) } raise(ArgumentError, 'Unsupported accent provided') end end end |
#validate_glossary ⇒ Object
215 216 217 218 219 220 221 222 223 224 225 226 |
# File 'lib/rev-api/models/order_request.rb', line 215 def validate_glossary if glossary if glossary.length > GLOSSARY_ENTRIES_LIMIT raise(ArgumentError, "Glossary must not exceed #{GLOSSARY_ENTRIES_LIMIT} entries") end glossary.each { |term| if term.length > GLOSSARY_ENTRY_LENGTH_LIMIT raise(ArgumentError, "Glossary entries cannot exceed #{GLOSSARY_ENTRY_LENGTH_LIMIT} characters") end } end end |
#validate_speakers ⇒ Object
228 229 230 231 232 233 234 235 236 237 238 239 |
# File 'lib/rev-api/models/order_request.rb', line 228 def validate_speakers if speakers if speakers.length > SPEAKER_ENTRIES_LIMIT raise(ArgumentError, "Speaker list must not exceed #{SPEAKER_ENTRIES_LIMIT} entries") end speakers.each { |speaker| if speaker.length > SPEAKER_ENTRY_LENGTH_LIMIT raise(ArgumentError, "Speaker name cannot exceed #{SPEAKER_ENTRY_LENGTH_LIMIT} characters") end } end end |