diff --git a/.release-please-manifest.json b/.release-please-manifest.json index bc4724b..ca3496a 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.17.1" + ".": "2.18.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 7fc4abc..ec34a10 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 27 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/moderation-api/moderation-api-e864d762f50e49c0584bbf35eacc43cdb1397f805cca52cb8d4c07781739d0a3.yml -openapi_spec_hash: f511fefb34946e5878ac17f2b3056b1f +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/moderation-api/moderation-api-3bb06bde0f76baa35ecc698b0c60371c9eadfd7b58c00b77cbc124d5be5dcb8b.yml +openapi_spec_hash: b4339d93d43fb725be0e98bd3bbf4f0b config_hash: 9d144cc6c49d3fd53e5b4472c1e22165 diff --git a/CHANGELOG.md b/CHANGELOG.md index 4098098..6aced00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 2.18.0 (2026-05-19) + +Full Changelog: [v2.17.1...v2.18.0](https://github.com/moderation-api/sdk-ruby/compare/v2.17.1...v2.18.0) + +### Features + +* **api:** api update ([0b267b1](https://github.com/moderation-api/sdk-ruby/commit/0b267b13d3574e2c3b9d88114502d81541f595c1)) + ## 2.17.1 (2026-05-14) Full Changelog: [v2.17.0...v2.17.1](https://github.com/moderation-api/sdk-ruby/compare/v2.17.0...v2.17.1) diff --git a/Gemfile.lock b/Gemfile.lock index 3e4c4c7..83860cd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GIT PATH remote: . specs: - moderation_api (2.17.1) + moderation_api (2.18.0) cgi connection_pool diff --git a/README.md b/README.md index d9080b7..0ea1e80 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application ```ruby -gem "moderation_api", "~> 2.17.1" +gem "moderation_api", "~> 2.18.0" ``` @@ -30,7 +30,7 @@ moderation_api = ModerationAPI::Client.new( secret_key: ENV["MODAPI_SECRET_KEY"] # This is the default and can be omitted ) -response = moderation_api.content.submit(content: {text: "x", type: "text"}) +response = moderation_api.content.submit(content: {text: "text", type: "text"}) puts(response.recommendation) ``` @@ -41,7 +41,7 @@ When the library is unable to connect to the API, or if the API returns a non-su ```ruby begin - content = moderation_api.content.submit(content: {text: "x", type: "text"}) + content = moderation_api.content.submit(content: {text: "text", type: "text"}) rescue ModerationAPI::Errors::APIConnectionError => e puts("The server could not be reached") puts(e.cause) # an underlying Exception, likely raised within `net/http` @@ -84,7 +84,7 @@ moderation_api = ModerationAPI::Client.new( ) # Or, configure per-request: -moderation_api.content.submit(content: {text: "x", type: "text"}, request_options: {max_retries: 5}) +moderation_api.content.submit(content: {text: "text", type: "text"}, request_options: {max_retries: 5}) ``` ### Timeouts @@ -98,7 +98,7 @@ moderation_api = ModerationAPI::Client.new( ) # Or, configure per-request: -moderation_api.content.submit(content: {text: "x", type: "text"}, request_options: {timeout: 5}) +moderation_api.content.submit(content: {text: "text", type: "text"}, request_options: {timeout: 5}) ``` On timeout, `ModerationAPI::Errors::APITimeoutError` is raised. @@ -130,7 +130,7 @@ Note: the `extra_` parameters of the same name overrides the documented paramete ```ruby response = moderation_api.content.submit( - content: {text: "x", type: "text"}, + content: {text: "text", type: "text"}, request_options: { extra_query: {my_query_parameter: value}, extra_body: {my_body_parameter: value}, @@ -176,18 +176,20 @@ This library provides comprehensive [RBI](https://sorbet.org/docs/rbi) definitio You can provide typesafe request parameters like so: ```ruby -moderation_api.content.submit(content: ModerationAPI::ContentSubmitParams::Content::Text.new(text: "x")) +moderation_api.content.submit( + content: ModerationAPI::ContentSubmitParams::Content::Text.new(text: "text") +) ``` Or, equivalently: ```ruby # Hashes work, but are not typesafe: -moderation_api.content.submit(content: {text: "x", type: "text"}) +moderation_api.content.submit(content: {text: "text", type: "text"}) # You can also splat a full Params class: params = ModerationAPI::ContentSubmitParams.new( - content: ModerationAPI::ContentSubmitParams::Content::Text.new(text: "x") + content: ModerationAPI::ContentSubmitParams::Content::Text.new(text: "text") ) moderation_api.content.submit(**params) ``` diff --git a/lib/moderation_api/version.rb b/lib/moderation_api/version.rb index 846b8d8..4746e1c 100644 --- a/lib/moderation_api/version.rb +++ b/lib/moderation_api/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module ModerationAPI - VERSION = "2.17.1" + VERSION = "2.18.0" end diff --git a/test/moderation_api/client_test.rb b/test/moderation_api/client_test.rb index 23b5dcc..536ef90 100644 --- a/test/moderation_api/client_test.rb +++ b/test/moderation_api/client_test.rb @@ -40,7 +40,7 @@ def test_client_default_request_default_retry_attempts moderation_api = ModerationAPI::Client.new(base_url: "http://localhost", secret_key: "My Secret Key") assert_raises(ModerationAPI::Errors::InternalServerError) do - moderation_api.content.submit(content: {text: "x", type: :text}) + moderation_api.content.submit(content: {text: "text", type: :text}) end assert_requested(:any, /./, times: 3) @@ -53,7 +53,7 @@ def test_client_given_request_default_retry_attempts ModerationAPI::Client.new(base_url: "http://localhost", secret_key: "My Secret Key", max_retries: 3) assert_raises(ModerationAPI::Errors::InternalServerError) do - moderation_api.content.submit(content: {text: "x", type: :text}) + moderation_api.content.submit(content: {text: "text", type: :text}) end assert_requested(:any, /./, times: 4) @@ -65,7 +65,7 @@ def test_client_default_request_given_retry_attempts moderation_api = ModerationAPI::Client.new(base_url: "http://localhost", secret_key: "My Secret Key") assert_raises(ModerationAPI::Errors::InternalServerError) do - moderation_api.content.submit(content: {text: "x", type: :text}, request_options: {max_retries: 3}) + moderation_api.content.submit(content: {text: "text", type: :text}, request_options: {max_retries: 3}) end assert_requested(:any, /./, times: 4) @@ -78,7 +78,7 @@ def test_client_given_request_given_retry_attempts ModerationAPI::Client.new(base_url: "http://localhost", secret_key: "My Secret Key", max_retries: 3) assert_raises(ModerationAPI::Errors::InternalServerError) do - moderation_api.content.submit(content: {text: "x", type: :text}, request_options: {max_retries: 4}) + moderation_api.content.submit(content: {text: "text", type: :text}, request_options: {max_retries: 4}) end assert_requested(:any, /./, times: 5) @@ -95,7 +95,7 @@ def test_client_retry_after_seconds ModerationAPI::Client.new(base_url: "http://localhost", secret_key: "My Secret Key", max_retries: 1) assert_raises(ModerationAPI::Errors::InternalServerError) do - moderation_api.content.submit(content: {text: "x", type: :text}) + moderation_api.content.submit(content: {text: "text", type: :text}) end assert_requested(:any, /./, times: 2) @@ -116,7 +116,7 @@ def test_client_retry_after_date Thread.current.thread_variable_set(:time_now, time_now) assert_raises(ModerationAPI::Errors::InternalServerError) do - moderation_api.content.submit(content: {text: "x", type: :text}) + moderation_api.content.submit(content: {text: "text", type: :text}) end Thread.current.thread_variable_set(:time_now, nil) @@ -135,7 +135,7 @@ def test_client_retry_after_ms ModerationAPI::Client.new(base_url: "http://localhost", secret_key: "My Secret Key", max_retries: 1) assert_raises(ModerationAPI::Errors::InternalServerError) do - moderation_api.content.submit(content: {text: "x", type: :text}) + moderation_api.content.submit(content: {text: "text", type: :text}) end assert_requested(:any, /./, times: 2) @@ -148,7 +148,7 @@ def test_retry_count_header moderation_api = ModerationAPI::Client.new(base_url: "http://localhost", secret_key: "My Secret Key") assert_raises(ModerationAPI::Errors::InternalServerError) do - moderation_api.content.submit(content: {text: "x", type: :text}) + moderation_api.content.submit(content: {text: "text", type: :text}) end 3.times do @@ -163,7 +163,7 @@ def test_omit_retry_count_header assert_raises(ModerationAPI::Errors::InternalServerError) do moderation_api.content.submit( - content: {text: "x", type: :text}, + content: {text: "text", type: :text}, request_options: {extra_headers: {"x-stainless-retry-count" => nil}} ) end @@ -180,7 +180,7 @@ def test_overwrite_retry_count_header assert_raises(ModerationAPI::Errors::InternalServerError) do moderation_api.content.submit( - content: {text: "x", type: :text}, + content: {text: "text", type: :text}, request_options: {extra_headers: {"x-stainless-retry-count" => "42"}} ) end @@ -202,7 +202,10 @@ def test_client_redirect_307 moderation_api = ModerationAPI::Client.new(base_url: "http://localhost", secret_key: "My Secret Key") assert_raises(ModerationAPI::Errors::APIConnectionError) do - moderation_api.content.submit(content: {text: "x", type: :text}, request_options: {extra_headers: {}}) + moderation_api.content.submit( + content: {text: "text", type: :text}, + request_options: {extra_headers: {}} + ) end recorded, = WebMock::RequestRegistry.instance.requested_signatures.hash.first @@ -231,7 +234,10 @@ def test_client_redirect_303 moderation_api = ModerationAPI::Client.new(base_url: "http://localhost", secret_key: "My Secret Key") assert_raises(ModerationAPI::Errors::APIConnectionError) do - moderation_api.content.submit(content: {text: "x", type: :text}, request_options: {extra_headers: {}}) + moderation_api.content.submit( + content: {text: "text", type: :text}, + request_options: {extra_headers: {}} + ) end assert_requested(:get, "http://localhost/redirected", times: ModerationAPI::Client::MAX_REDIRECTS) do @@ -256,7 +262,7 @@ def test_client_redirect_auth_keep_same_origin assert_raises(ModerationAPI::Errors::APIConnectionError) do moderation_api.content.submit( - content: {text: "x", type: :text}, + content: {text: "text", type: :text}, request_options: {extra_headers: {"authorization" => "Bearer xyz"}} ) end @@ -286,7 +292,7 @@ def test_client_redirect_auth_strip_cross_origin assert_raises(ModerationAPI::Errors::APIConnectionError) do moderation_api.content.submit( - content: {text: "x", type: :text}, + content: {text: "text", type: :text}, request_options: {extra_headers: {"authorization" => "Bearer xyz"}} ) end @@ -302,7 +308,7 @@ def test_default_headers moderation_api = ModerationAPI::Client.new(base_url: "http://localhost", secret_key: "My Secret Key") - moderation_api.content.submit(content: {text: "x", type: :text}) + moderation_api.content.submit(content: {text: "text", type: :text}) assert_requested(:any, /./) do |req| headers = req.headers.transform_keys(&:downcase) diff --git a/test/moderation_api/resources/content_test.rb b/test/moderation_api/resources/content_test.rb index dfda731..9724978 100644 --- a/test/moderation_api/resources/content_test.rb +++ b/test/moderation_api/resources/content_test.rb @@ -6,7 +6,7 @@ class ModerationAPI::Test::Resources::ContentTest < ModerationAPI::Test::Resourc def test_submit_required_params skip("Mock server tests are disabled") - response = @moderation_api.content.submit(content: {text: "x", type: :text}) + response = @moderation_api.content.submit(content: {text: "text", type: :text}) assert_pattern do response => ModerationAPI::Models::ContentSubmitResponse