Class: Youdao::Translate
- Inherits:
-
Object
- Object
- Youdao::Translate
- Extended by:
- Forwardable
- Includes:
- Singleton
- Defined in:
- lib/youdao/translate.rb,
lib/youdao/translate/version.rb
Constant Summary collapse
- URL =
'https://aidemo.youdao.com/trans'
- VERSION =
'0.2.4'
Instance Method Summary collapse
-
#get(content, options = {}) ⇒ Object
Get a tranlsated string.
Instance Method Details
#get(content, options = {}) ⇒ Object
Get a tranlsated string
42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/youdao/translate.rb', line 42 def get(content, = {}) @content = content form = payload.merge() res = HTTP.post(URL, form: form) result = res.parse :json result['translation'].first rescue StandardError nil end |