lib/dandelionapi/entity_extraction.rb in dandelionapi-0.0.1 vs lib/dandelionapi/entity_extraction.rb in dandelionapi-0.0.2
- old
+ new
@@ -1,19 +1,24 @@
+# encoding: UTF-8
+
require "faraday"
require "faraday_middleware"
require "json"
module Dandelionapi
class EntityExtraction < Base
ENDPOINT = "/datatxt/nex/v1"
- attr_accessor :text, :url, :html, :html_fragment, :lang, :min_confidence, :min_length, :social_hashtag, :social_mention, :include, :extra_types, :country, :custom_spots
+ attr_accessor :text, :url, :html, :html_fragment,
+ :lang, :min_confidence, :min_length, :social_hashtag,
+ :social_mention, :include, :extra_types, :country,
+ :custom_spots
def analyze(options)
- raise BadParameters.new("Please provide one of the following parameters: text, url, html or html_fragment") if ([:text, :url, :html, :html_fragment] & options.keys).empty?
+ 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
\ No newline at end of file