lib/dandelionapi/language_detection.rb in dandelionapi-0.0.1 vs lib/dandelionapi/language_detection.rb in dandelionapi-0.0.2

- old
+ new

@@ -1,5 +1,7 @@ +# encoding: UTF-8 + require "faraday" require "faraday_middleware" require "json" module Dandelionapi @@ -9,9 +11,12 @@ ENDPOINT = "/datatxt/li/v1" attr_accessor :text, :url, :html, :html_fragment, :clean 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 end \ No newline at end of file