Sha256: b91e2baea136db0e209c22bc1cff52a8e1929c07997916ffe9bcffb506e8af33
Contents?: true
Size: 765 Bytes
Versions: 1
Compression:
Stored size: 765 Bytes
Contents
# frozen_string_literal: true module FunTranslations # This class represents a response returned by FunTranslation API class Translation attr_reader :translated_text, :original_text, :translation, :audio, :speed, :tone # Initializes a new Translation object def initialize(raw_translation) if raw_translation['translated'].respond_to?(:key?) && raw_translation['translated'].key?('audio') @audio = raw_translation['translated']['audio'] else @translated_text = raw_translation['translated'] end @original_text = raw_translation['text'] @translation = raw_translation['translation'] @speed = raw_translation['speed'] @tone = raw_translation['tone'] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fun_translations-0.0.1.rc1 | lib/fun_translations/translation.rb |