Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "2.11.3"
".": "2.12.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 27
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/moderation-api%2Fmoderation-api-a4934bf1e7f1348c021b48224f7a7110a6e41838253dda4fbcc720dd2d2ed6b7.yml
openapi_spec_hash: 537542216811907b1d4ebf23a54dc669
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/moderation-api%2Fmoderation-api-c8e66e827fc2b1465b740a29e87da71c3b1ddca1a4bdb1023aa96c569b80e9be.yml
openapi_spec_hash: 35fdc3e34feb56cafaf4de2834201978
config_hash: 0a024bca1710e3a3194925edfedc513c
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 2.12.0 (2026-04-24)

Full Changelog: [v2.11.3...v2.12.0](https://github.com/moderation-api/sdk-ruby/compare/v2.11.3...v2.12.0)

### Features

* **api:** api update ([18b3b6d](https://github.com/moderation-api/sdk-ruby/commit/18b3b6dce2befe3c2b0051d0dc33b737d99308a9))


### Chores

* **internal:** more robust bootstrap script ([2217d9c](https://github.com/moderation-api/sdk-ruby/commit/2217d9c080e5fbc4276ec3fed81e91b51f9d653e))

## 2.11.3 (2026-04-09)

Full Changelog: [v2.11.2...v2.11.3](https://github.com/moderation-api/sdk-ruby/compare/v2.11.2...v2.11.3)
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ GIT
PATH
remote: .
specs:
moderation_api (2.11.3)
moderation_api (2.12.0)
cgi
connection_pool

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application
<!-- x-release-please-start-version -->

```ruby
gem "moderation_api", "~> 2.11.3"
gem "moderation_api", "~> 2.12.0"
```

<!-- x-release-please-end -->
Expand Down
30 changes: 29 additions & 1 deletion lib/moderation_api/models/content_submit_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1026,14 +1026,42 @@ class URLRisk < ModerationAPI::Internal::Type::BaseModel
# @return [Boolean]
required :flag, ModerationAPI::Internal::Type::Boolean

# @!attribute allowlist_wordlist_ids
# IDs of wordlists whose entries are treated as allowed URL domains. Matches
# short-circuit the risk model and are never flagged.
#
# @return [Array<String>, nil]
optional :allowlist_wordlist_ids,
ModerationAPI::Internal::Type::ArrayOf[String],
api_name: :allowlistWordlistIds

# @!attribute blocklist_wordlist_ids
# IDs of wordlists whose entries are treated as blocked URL domains. Matches
# short-circuit the risk model and are always flagged. Blocklists take precedence
# over allowlists.
#
# @return [Array<String>, nil]
optional :blocklist_wordlist_ids,
ModerationAPI::Internal::Type::ArrayOf[String],
api_name: :blocklistWordlistIds

# @!attribute threshold
#
# @return [Float, nil]
optional :threshold, Float

# @!method initialize(flag:, threshold: nil, id: :url_risk)
# @!method initialize(flag:, allowlist_wordlist_ids: nil, blocklist_wordlist_ids: nil, threshold: nil, id: :url_risk)
# Some parameter documentations has been truncated, see
# {ModerationAPI::Models::ContentSubmitParams::Policy::URLRisk} for more details.
#
# @param flag [Boolean]
#
# @param allowlist_wordlist_ids [Array<String>] IDs of wordlists whose entries are treated as allowed URL domains. Matches short
#
# @param blocklist_wordlist_ids [Array<String>] IDs of wordlists whose entries are treated as blocked URL domains. Matches short
#
# @param threshold [Float]
#
# @param id [Symbol, :url_risk]
end

Expand Down
130 changes: 129 additions & 1 deletion lib/moderation_api/models/content_submit_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -694,10 +694,138 @@ class Match < ModerationAPI::Internal::Type::BaseModel
# @return [Array<Integer>]
required :span, ModerationAPI::Internal::Type::ArrayOf[Integer]

# @!method initialize(match:, probability:, span:)
# @!attribute entity_type
# Sub-type of the entity match — e.g. the NER key (email, phone, name, …) for PII
# matches. Absent for URL Risk and wordlist matches where the type is already
# encoded in the parent label.
#
# @return [String, nil]
optional :entity_type, String

# @!attribute reasons
# Stable codes explaining why a URL was flagged (URL Risk only).
#
# @return [Array<String>, nil]
optional :reasons, ModerationAPI::Internal::Type::ArrayOf[String]

# @!attribute signals
# Observable properties of a URL (URL Risk only). Absent for allow/block list
# matches.
#
# @return [ModerationAPI::Models::ContentSubmitResponse::Policy::EntityMatcherOutput::Match::Signals, nil]
optional :signals,
-> { ModerationAPI::Models::ContentSubmitResponse::Policy::EntityMatcherOutput::Match::Signals }

# @!method initialize(match:, probability:, span:, entity_type: nil, reasons: nil, signals: nil)
# Some parameter documentations has been truncated, see
# {ModerationAPI::Models::ContentSubmitResponse::Policy::EntityMatcherOutput::Match}
# for more details.
#
# @param match [String]
#
# @param probability [Float]
#
# @param span [Array<Integer>]
#
# @param entity_type [String] Sub-type of the entity match — e.g. the NER key (email, phone, name, …) for PII
#
# @param reasons [Array<String>] Stable codes explaining why a URL was flagged (URL Risk only).
#
# @param signals [ModerationAPI::Models::ContentSubmitResponse::Policy::EntityMatcherOutput::Match::Signals] Observable properties of a URL (URL Risk only). Absent for allow/block list matc

# @see ModerationAPI::Models::ContentSubmitResponse::Policy::EntityMatcherOutput::Match#signals
class Signals < ModerationAPI::Internal::Type::BaseModel
# @!attribute bot_protection
#
# @return [Boolean, nil]
required :bot_protection, ModerationAPI::Internal::Type::Boolean, nil?: true

# @!attribute brand_impersonation
#
# @return [ModerationAPI::Models::ContentSubmitResponse::Policy::EntityMatcherOutput::Match::Signals::BrandImpersonation, nil]
required :brand_impersonation,
-> { ModerationAPI::Models::ContentSubmitResponse::Policy::EntityMatcherOutput::Match::Signals::BrandImpersonation },
nil?: true

# @!attribute domain_age_days
#
# @return [Integer, nil]
required :domain_age_days, Integer, nil?: true

# @!attribute final_url
#
# @return [String, nil]
required :final_url, String, nil?: true

# @!attribute has_email_setup
#
# @return [Boolean, nil]
required :has_email_setup, ModerationAPI::Internal::Type::Boolean, nil?: true

# @!attribute has_suspicious_characters
#
# @return [Boolean]
required :has_suspicious_characters, ModerationAPI::Internal::Type::Boolean

# @!attribute is_link_shortener
#
# @return [Boolean]
required :is_link_shortener, ModerationAPI::Internal::Type::Boolean

# @!attribute is_reported
#
# @return [Boolean]
required :is_reported, ModerationAPI::Internal::Type::Boolean

# @!attribute redirect_count
#
# @return [Integer, nil]
required :redirect_count, Integer, nil?: true

# @!method initialize(bot_protection:, brand_impersonation:, domain_age_days:, final_url:, has_email_setup:, has_suspicious_characters:, is_link_shortener:, is_reported:, redirect_count:)
# Observable properties of a URL (URL Risk only). Absent for allow/block list
# matches.
#
# @param bot_protection [Boolean, nil]
# @param brand_impersonation [ModerationAPI::Models::ContentSubmitResponse::Policy::EntityMatcherOutput::Match::Signals::BrandImpersonation, nil]
# @param domain_age_days [Integer, nil]
# @param final_url [String, nil]
# @param has_email_setup [Boolean, nil]
# @param has_suspicious_characters [Boolean]
# @param is_link_shortener [Boolean]
# @param is_reported [Boolean]
# @param redirect_count [Integer, nil]

# @see ModerationAPI::Models::ContentSubmitResponse::Policy::EntityMatcherOutput::Match::Signals#brand_impersonation
class BrandImpersonation < ModerationAPI::Internal::Type::BaseModel
# @!attribute brand
#
# @return [String]
required :brand, String

# @!attribute method_
#
# @return [Symbol, ModerationAPI::Models::ContentSubmitResponse::Policy::EntityMatcherOutput::Match::Signals::BrandImpersonation::Method]
required :method_,
enum: -> { ModerationAPI::Models::ContentSubmitResponse::Policy::EntityMatcherOutput::Match::Signals::BrandImpersonation::Method },
api_name: :method

# @!method initialize(brand:, method_:)
# @param brand [String]
# @param method_ [Symbol, ModerationAPI::Models::ContentSubmitResponse::Policy::EntityMatcherOutput::Match::Signals::BrandImpersonation::Method]

# @see ModerationAPI::Models::ContentSubmitResponse::Policy::EntityMatcherOutput::Match::Signals::BrandImpersonation#method_
module Method
extend ModerationAPI::Internal::Type::Enum

REGISTERED_DOMAIN_TOKEN = :registered_domain_token
SUBDOMAIN_TOKEN = :subdomain_token

# @!method self.values
# @return [Array<Symbol>]
end
end
end
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/moderation_api/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module ModerationAPI
VERSION = "2.11.3"
VERSION = "2.12.0"
end
50 changes: 45 additions & 5 deletions rbi/moderation_api/models/content_submit_params.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -1872,22 +1872,62 @@ module ModerationAPI
sig { returns(T::Boolean) }
attr_accessor :flag

# IDs of wordlists whose entries are treated as allowed URL domains. Matches
# short-circuit the risk model and are never flagged.
sig { returns(T.nilable(T::Array[String])) }
attr_reader :allowlist_wordlist_ids

sig { params(allowlist_wordlist_ids: T::Array[String]).void }
attr_writer :allowlist_wordlist_ids

# IDs of wordlists whose entries are treated as blocked URL domains. Matches
# short-circuit the risk model and are always flagged. Blocklists take precedence
# over allowlists.
sig { returns(T.nilable(T::Array[String])) }
attr_reader :blocklist_wordlist_ids

sig { params(blocklist_wordlist_ids: T::Array[String]).void }
attr_writer :blocklist_wordlist_ids

sig { returns(T.nilable(Float)) }
attr_reader :threshold

sig { params(threshold: Float).void }
attr_writer :threshold

sig do
params(flag: T::Boolean, threshold: Float, id: Symbol).returns(
T.attached_class
)
params(
flag: T::Boolean,
allowlist_wordlist_ids: T::Array[String],
blocklist_wordlist_ids: T::Array[String],
threshold: Float,
id: Symbol
).returns(T.attached_class)
end
def self.new(flag:, threshold: nil, id: :url_risk)
def self.new(
flag:,
# IDs of wordlists whose entries are treated as allowed URL domains. Matches
# short-circuit the risk model and are never flagged.
allowlist_wordlist_ids: nil,
# IDs of wordlists whose entries are treated as blocked URL domains. Matches
# short-circuit the risk model and are always flagged. Blocklists take precedence
# over allowlists.
blocklist_wordlist_ids: nil,
threshold: nil,
id: :url_risk
)
end

sig do
override.returns({ id: Symbol, flag: T::Boolean, threshold: Float })
override.returns(
{
id: Symbol,
flag: T::Boolean,
allowlist_wordlist_ids: T::Array[String],
blocklist_wordlist_ids: T::Array[String],
threshold: Float
}
)
end
def to_hash
end
Expand Down
Loading