Class: ModerationAPI::Resources::Wordlist::Words
- Inherits:
-
Object
- Object
- ModerationAPI::Resources::Wordlist::Words
- Defined in:
- lib/moderation_api/resources/wordlist/words.rb
Instance Method Summary collapse
-
#add(id, words:, request_options: {}) ⇒ ModerationAPI::Models::Wordlist::WordAddResponse
Add words to an existing wordlist.
-
#initialize(client:) ⇒ Words
constructor
private
A new instance of Words.
-
#remove(id, words:, request_options: {}) ⇒ ModerationAPI::Models::Wordlist::WordRemoveResponse
Remove words from an existing wordlist.
Constructor Details
#initialize(client:) ⇒ Words
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Words.
59 60 61 |
# File 'lib/moderation_api/resources/wordlist/words.rb', line 59 def initialize(client:) @client = client end |
Instance Method Details
#add(id, words:, request_options: {}) ⇒ ModerationAPI::Models::Wordlist::WordAddResponse
Add words to an existing wordlist
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/moderation_api/resources/wordlist/words.rb', line 20 def add(id, params) parsed, = ModerationAPI::Wordlist::WordAddParams.dump_request(params) @client.request( method: :post, path: ["wordlist/%1$s/words", id], body: parsed, model: ModerationAPI::Models::Wordlist::WordAddResponse, options: ) end |
#remove(id, words:, request_options: {}) ⇒ ModerationAPI::Models::Wordlist::WordRemoveResponse
Remove words from an existing wordlist
44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/moderation_api/resources/wordlist/words.rb', line 44 def remove(id, params) parsed, = ModerationAPI::Wordlist::WordRemoveParams.dump_request(params) query = ModerationAPI::Internal::Util.encode_query_params(parsed) @client.request( method: :delete, path: ["wordlist/%1$s/words", id], query: query, model: ModerationAPI::Models::Wordlist::WordRemoveResponse, options: ) end |