Class: Dilki::Client

Inherits:
Configuration show all
Defined in:
lib/dilki.rb

Instance Method Summary collapse

Methods inherited from Configuration

#initialize

Constructor Details

This class inherits a constructor from Dilki::Configuration

Instance Method Details

#detect(text) ⇒ Object



16
17
18
19
# File 'lib/dilki.rb', line 16

def detect(text)
 data = ::Methods::DetectLangs.run(api_key, text)
 data['lang']
end

#get_langsObject



11
12
13
14
# File 'lib/dilki.rb', line 11

def get_langs
 data = ::Methods::GetLangs.run(api_key)
 data['dirs']
end

#translate(text, from = "en", to = "ru") ⇒ Object



21
22
23
24
# File 'lib/dilki.rb', line 21

def translate(text, from="en", to = "ru")
 data = ::Methods::Translate.run(api_key, text, from, to)
 data['text'].first
end