Class: Dandelionapi::Analysis::Request
- Inherits:
-
Base::Request
- Object
- Base::Request
- Dandelionapi::Analysis::Request
- Defined in:
- lib/dandelionapi/analysis.rb
Direct Known Subclasses
EntityExtraction::Request, LanguageDetection::Request, SentimentAnalysis::Request
Instance Method Summary collapse
Instance Method Details
#analyze(options) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/dandelionapi/analysis.rb', line 12 def analyze() params = filter_permitted_params if required_params_missing? params raise MissingParameter.new "Please provide one of the following parameters: #{self.class::MANDATORY_FIELDS.join(", ")} as input" end if too_many_mandatory_parameters? params, 1 raise TooManyParameters.new "Please provide only one of the following parameters: #{self.class::MANDATORY_FIELDS.join(", ")} as input" end verify_format params do |wrong_param| raise WrongParameterFormat.new "Wrong format: #{self.class::FIELDS_FORMAT[wrong_param][:error_message]}" end call(self.class::ENDPOINT, params) end |