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.6.1"
".": "2.7.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-422330754281be38d7919f08a9d1e7862cbdc6921602473cb07a8f2022635832.yml
openapi_spec_hash: 7e6fa61ced995dc03e0ccd3e11fb121c
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/moderation-api%2Fmoderation-api-67a3fe4439c3aa74fb2c18b207b43c790d42bab7bfd7e5e16f3e1046765ec959.yml
openapi_spec_hash: c87b33c2c72a172da02ed75d4e79eb70
config_hash: 6a52f6ae7d55cf3b4e91538cc7752aeb
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 2.7.0 (2026-02-20)

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

### Features

* **api:** api update ([4779766](https://github.com/moderation-api/sdk-ruby/commit/477976687b0d43cf7cfc3fd1c69d2327d9ddd1e4))


### Chores

* **internal:** remove mock server code ([6fff870](https://github.com/moderation-api/sdk-ruby/commit/6fff870033a043b5d08560715a1a4bd9c7b3d9ce))

## 2.6.1 (2026-02-07)

Full Changelog: [v2.6.0...v2.6.1](https://github.com/moderation-api/sdk-ruby/compare/v2.6.0...v2.6.1)
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.6.1)
moderation_api (2.7.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.6.1"
gem "moderation_api", "~> 2.7.0"
```

<!-- x-release-please-end -->
Expand Down
28 changes: 22 additions & 6 deletions lib/moderation_api/models/content_submit_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,23 @@ class Image < ModerationAPI::Internal::Type::BaseModel
# @return [Symbol, :image]
required :type, const: :image

# @!attribute data
# Base64-encoded image data
#
# @return [String, nil]
optional :data, String

# @!attribute url
# A public URL of the image content
#
# @return [String]
required :url, String
# @return [String, nil]
optional :url, String

# @!method initialize(url:, type: :image)
# @!method initialize(data: nil, url: nil, type: :image)
# Image
#
# @param data [String] Base64-encoded image data
#
# @param url [String] A public URL of the image content
#
# @param type [Symbol, :image]
Expand Down Expand Up @@ -257,15 +265,23 @@ class Image < ModerationAPI::Internal::Type::BaseModel
# @return [Symbol, :image]
required :type, const: :image

# @!attribute data
# Base64-encoded image data
#
# @return [String, nil]
optional :data, String

# @!attribute url
# A public URL of the image content
#
# @return [String]
required :url, String
# @return [String, nil]
optional :url, String

# @!method initialize(url:, type: :image)
# @!method initialize(data: nil, url: nil, type: :image)
# Image
#
# @param data [String] Base64-encoded image data
#
# @param url [String] A public URL of the image content
#
# @param type [Symbol, :image]
Expand Down
14 changes: 11 additions & 3 deletions lib/moderation_api/models/content_submit_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -267,15 +267,23 @@ class Image < ModerationAPI::Internal::Type::BaseModel
# @return [Symbol, :image]
required :type, const: :image

# @!attribute data
# Base64-encoded image data
#
# @return [String, nil]
optional :data, String

# @!attribute url
# A public URL of the image content
#
# @return [String]
required :url, String
# @return [String, nil]
optional :url, String

# @!method initialize(url:, type: :image)
# @!method initialize(data: nil, url: nil, type: :image)
# Image
#
# @param data [String] Base64-encoded image data
#
# @param url [String] A public URL of the image content
#
# @param type [Symbol, :image]
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.6.1"
VERSION = "2.7.0"
end
52 changes: 42 additions & 10 deletions rbi/moderation_api/models/content_submit_params.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -363,20 +363,36 @@ module ModerationAPI
sig { returns(Symbol) }
attr_accessor :type

# Base64-encoded image data
sig { returns(T.nilable(String)) }
attr_reader :data

sig { params(data: String).void }
attr_writer :data

# A public URL of the image content
sig { returns(String) }
attr_accessor :url
sig { returns(T.nilable(String)) }
attr_reader :url

sig { params(url: String).void }
attr_writer :url

# Image
sig { params(url: String, type: Symbol).returns(T.attached_class) }
sig do
params(data: String, url: String, type: Symbol).returns(
T.attached_class
)
end
def self.new(
# Base64-encoded image data
data: nil,
# A public URL of the image content
url:,
url: nil,
type: :image
)
end

sig { override.returns({ type: Symbol, url: String }) }
sig { override.returns({ type: Symbol, data: String, url: String }) }
def to_hash
end
end
Expand Down Expand Up @@ -570,22 +586,38 @@ module ModerationAPI
sig { returns(Symbol) }
attr_accessor :type

# Base64-encoded image data
sig { returns(T.nilable(String)) }
attr_reader :data

sig { params(data: String).void }
attr_writer :data

# A public URL of the image content
sig { returns(String) }
attr_accessor :url
sig { returns(T.nilable(String)) }
attr_reader :url

sig { params(url: String).void }
attr_writer :url

# Image
sig do
params(url: String, type: Symbol).returns(T.attached_class)
params(data: String, url: String, type: Symbol).returns(
T.attached_class
)
end
def self.new(
# Base64-encoded image data
data: nil,
# A public URL of the image content
url:,
url: nil,
type: :image
)
end

sig { override.returns({ type: Symbol, url: String }) }
sig do
override.returns({ type: Symbol, data: String, url: String })
end
def to_hash
end
end
Expand Down
26 changes: 21 additions & 5 deletions rbi/moderation_api/models/content_submit_response.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -558,22 +558,38 @@ module ModerationAPI
sig { returns(Symbol) }
attr_accessor :type

# Base64-encoded image data
sig { returns(T.nilable(String)) }
attr_reader :data

sig { params(data: String).void }
attr_writer :data

# A public URL of the image content
sig { returns(String) }
attr_accessor :url
sig { returns(T.nilable(String)) }
attr_reader :url

sig { params(url: String).void }
attr_writer :url

# Image
sig do
params(url: String, type: Symbol).returns(T.attached_class)
params(data: String, url: String, type: Symbol).returns(
T.attached_class
)
end
def self.new(
# Base64-encoded image data
data: nil,
# A public URL of the image content
url:,
url: nil,
type: :image
)
end

sig { override.returns({ type: Symbol, url: String }) }
sig do
override.returns({ type: Symbol, data: String, url: String })
end
def to_hash
end
end
Expand Down
41 changes: 0 additions & 41 deletions scripts/mock

This file was deleted.

46 changes: 0 additions & 46 deletions scripts/test
Original file line number Diff line number Diff line change
Expand Up @@ -4,53 +4,7 @@ set -e

cd -- "$(dirname -- "$0")/.."

RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
NC='\033[0m' # No Color

function prism_is_running() {
curl --silent "http://localhost:4010" >/dev/null 2>&1
}

kill_server_on_port() {
pids=$(lsof -t -i tcp:"$1" || echo "")
if [ "$pids" != "" ]; then
kill "$pids"
echo "Stopped $pids."
fi
}

function is_overriding_api_base_url() {
[ -n "$TEST_API_BASE_URL" ]
}

if ! is_overriding_api_base_url && ! prism_is_running ; then
# When we exit this script, make sure to kill the background mock server process
trap 'kill_server_on_port 4010' EXIT

# Start the dev server
./scripts/mock --daemon
fi

if is_overriding_api_base_url ; then
echo -e "${GREEN}✔ Running tests against ${TEST_API_BASE_URL}${NC}"
echo
elif ! prism_is_running ; then
echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Prism server"
echo -e "running against your OpenAPI spec."
echo
echo -e "To run the server, pass in the path or url of your OpenAPI"
echo -e "spec to the prism command:"
echo
echo -e " \$ ${YELLOW}npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock path/to/your.openapi.yml${NC}"
echo

exit 1
else
echo -e "${GREEN}✔ Mock prism server is running with your OpenAPI spec${NC}"
echo
fi

echo "==> Running tests"
bundle exec rake test "$@"
Loading