Class: LanguageTools::DetectLanguageDotCom

Inherits:
Object
  • Object
show all
Includes:
APISmith::Client
Defined in:
lib/esendex4soap.rb

Instance Method Summary collapse

Constructor Details

#initialize(api_key) ⇒ DetectLanguageDotCom

Returns a new instance of DetectLanguageDotCom.



13
14
15
16
# File 'lib/esendex4soap.rb', line 13

def initialize(api_key)
  @api_key = api_key
  add_query_options! :key => @api_key
end

Instance Method Details

#detect(text) ⇒ Object



18
19
20
# File 'lib/esendex4soap.rb', line 18

def detect(text)
  (post "detect", :extra_query => {:q => text})["data"]["detections"].first["language"]
end