Class: Dandelionapi::LanguageDetection

Inherits:
Base
  • Object
show all
Defined in:
lib/dandelionapi/language_detection.rb

Constant Summary collapse

ENDPOINT =
"/datatxt/li/v1"

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cleanObject

Returns the value of attribute clean.



13
14
15
# File 'lib/dandelionapi/language_detection.rb', line 13

def clean
  @clean
end

#htmlObject

Returns the value of attribute html.



13
14
15
# File 'lib/dandelionapi/language_detection.rb', line 13

def html
  @html
end

#html_fragmentObject

Returns the value of attribute html_fragment.



13
14
15
# File 'lib/dandelionapi/language_detection.rb', line 13

def html_fragment
  @html_fragment
end

#textObject

Returns the value of attribute text.



13
14
15
# File 'lib/dandelionapi/language_detection.rb', line 13

def text
  @text
end

#urlObject

Returns the value of attribute url.



13
14
15
# File 'lib/dandelionapi/language_detection.rb', line 13

def url
  @url
end

Instance Method Details

#analyze(options) ⇒ Object

Raises:



15
16
17
18
19
20
21
# File 'lib/dandelionapi/language_detection.rb', line 15

def analyze(options)

  raise MissingParameters.new("Please provide one of the following parameters: text, url, html or html_fragment") if ([:text, :url, :html, :html_fragment] & options.keys).empty?

  params = options
  call(ENDPOINT, params)
end