Class: Asimov::ApiV1::Moderations

Inherits:
Base
  • Object
show all
Defined in:
lib/asimov/api_v1/moderations.rb

Overview

Class interface for API methods in the “/moderations” URI subspace.

Instance Method Summary collapse

Methods inherited from Base

#initialize, #rest_create_w_json_params, #rest_create_w_multipart_params, #rest_delete, #rest_get, #rest_get_streamed_download, #rest_index

Constructor Details

This class inherits a constructor from Asimov::ApiV1::Base

Instance Method Details

#create(input:, parameters: {}) ⇒ Object

Calls the /moderations POST endpoint with the specified parameters.

Parameters:

  • input (String)

    the text being evaluated by the API

  • parameters (Hash) (defaults to: {})

    the set of parameters being passed to the API

Raises:



13
14
15
16
17
18
# File 'lib/asimov/api_v1/moderations.rb', line 13

def create(input:, parameters: {})
  raise MissingRequiredParameterError.new(:input) unless input

  rest_create_w_json_params(resource: "moderations",
                            parameters: parameters.merge({ input: input }))
end