Class: YoudaoFanyiAPI::Client
- Inherits:
-
Object
- Object
- YoudaoFanyiAPI::Client
- Defined in:
- lib/youdao_fanyi_api/client.rb
Constant Summary
- PREFIX =
'http://fanyi.youdao.com/openapi.do?'
Instance Method Summary (collapse)
-
- (Client) initialize(user_options = {})
constructor
A new instance of Client.
- - (Object) translate(text, optional = {}) (also: #t)
Constructor Details
- (Client) initialize(user_options = {})
Returns a new instance of Client
8 9 10 |
# File 'lib/youdao_fanyi_api/client.rb', line 8 def initialize( = {}) @options = YoudaoFanyiAPI..merge() end |
Instance Method Details
- (Object) translate(text, optional = {}) Also known as: t
12 13 14 15 |
# File 'lib/youdao_fanyi_api/client.rb', line 12 def translate(text, optional = {}) http_response = get(text, optional) json_response = JSON.parse(http_response) end |