moderation_api 2.17.1 → 2.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +11 -9
- data/lib/moderation_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fd3fb2fd9d633445682ed0d05bdd62523cdc249dc4ee4cb654acd71e015b82ce
|
|
4
|
+
data.tar.gz: ccdf354e04036e45e1093cc2da47a1a982ac0cdc745b2c02a9aee63b4454a05e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2653be73ea89474e440a010a88f05e687e8fb6251d7bbf9b2c3e31a40776dc2cd0328fa9beb07a6577b0301961082040ebcd8e37c20d2910eadfd53601f75ee0
|
|
7
|
+
data.tar.gz: 520bd569bca3586e00be483581d9ff5ffc417ed4e17e5e4be96b0a040c9afb86c0f52fc5ffbaa60d6f8f9ae69827feeb4a880e4c221f693258865f095d8f6893
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.18.0 (2026-05-19)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v2.17.1...v2.18.0](https://github.com/moderation-api/sdk-ruby/compare/v2.17.1...v2.18.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** api update ([0b267b1](https://github.com/moderation-api/sdk-ruby/commit/0b267b13d3574e2c3b9d88114502d81541f595c1))
|
|
10
|
+
|
|
3
11
|
## 2.17.1 (2026-05-14)
|
|
4
12
|
|
|
5
13
|
Full Changelog: [v2.17.0...v2.17.1](https://github.com/moderation-api/sdk-ruby/compare/v2.17.0...v2.17.1)
|
data/README.md
CHANGED
|
@@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application
|
|
|
15
15
|
<!-- x-release-please-start-version -->
|
|
16
16
|
|
|
17
17
|
```ruby
|
|
18
|
-
gem "moderation_api", "~> 2.
|
|
18
|
+
gem "moderation_api", "~> 2.18.0"
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
<!-- x-release-please-end -->
|
|
@@ -30,7 +30,7 @@ moderation_api = ModerationAPI::Client.new(
|
|
|
30
30
|
secret_key: ENV["MODAPI_SECRET_KEY"] # This is the default and can be omitted
|
|
31
31
|
)
|
|
32
32
|
|
|
33
|
-
response = moderation_api.content.submit(content: {text: "
|
|
33
|
+
response = moderation_api.content.submit(content: {text: "text", type: "text"})
|
|
34
34
|
|
|
35
35
|
puts(response.recommendation)
|
|
36
36
|
```
|
|
@@ -41,7 +41,7 @@ When the library is unable to connect to the API, or if the API returns a non-su
|
|
|
41
41
|
|
|
42
42
|
```ruby
|
|
43
43
|
begin
|
|
44
|
-
content = moderation_api.content.submit(content: {text: "
|
|
44
|
+
content = moderation_api.content.submit(content: {text: "text", type: "text"})
|
|
45
45
|
rescue ModerationAPI::Errors::APIConnectionError => e
|
|
46
46
|
puts("The server could not be reached")
|
|
47
47
|
puts(e.cause) # an underlying Exception, likely raised within `net/http`
|
|
@@ -84,7 +84,7 @@ moderation_api = ModerationAPI::Client.new(
|
|
|
84
84
|
)
|
|
85
85
|
|
|
86
86
|
# Or, configure per-request:
|
|
87
|
-
moderation_api.content.submit(content: {text: "
|
|
87
|
+
moderation_api.content.submit(content: {text: "text", type: "text"}, request_options: {max_retries: 5})
|
|
88
88
|
```
|
|
89
89
|
|
|
90
90
|
### Timeouts
|
|
@@ -98,7 +98,7 @@ moderation_api = ModerationAPI::Client.new(
|
|
|
98
98
|
)
|
|
99
99
|
|
|
100
100
|
# Or, configure per-request:
|
|
101
|
-
moderation_api.content.submit(content: {text: "
|
|
101
|
+
moderation_api.content.submit(content: {text: "text", type: "text"}, request_options: {timeout: 5})
|
|
102
102
|
```
|
|
103
103
|
|
|
104
104
|
On timeout, `ModerationAPI::Errors::APITimeoutError` is raised.
|
|
@@ -130,7 +130,7 @@ Note: the `extra_` parameters of the same name overrides the documented paramete
|
|
|
130
130
|
```ruby
|
|
131
131
|
response =
|
|
132
132
|
moderation_api.content.submit(
|
|
133
|
-
content: {text: "
|
|
133
|
+
content: {text: "text", type: "text"},
|
|
134
134
|
request_options: {
|
|
135
135
|
extra_query: {my_query_parameter: value},
|
|
136
136
|
extra_body: {my_body_parameter: value},
|
|
@@ -176,18 +176,20 @@ This library provides comprehensive [RBI](https://sorbet.org/docs/rbi) definitio
|
|
|
176
176
|
You can provide typesafe request parameters like so:
|
|
177
177
|
|
|
178
178
|
```ruby
|
|
179
|
-
moderation_api.content.submit(
|
|
179
|
+
moderation_api.content.submit(
|
|
180
|
+
content: ModerationAPI::ContentSubmitParams::Content::Text.new(text: "text")
|
|
181
|
+
)
|
|
180
182
|
```
|
|
181
183
|
|
|
182
184
|
Or, equivalently:
|
|
183
185
|
|
|
184
186
|
```ruby
|
|
185
187
|
# Hashes work, but are not typesafe:
|
|
186
|
-
moderation_api.content.submit(content: {text: "
|
|
188
|
+
moderation_api.content.submit(content: {text: "text", type: "text"})
|
|
187
189
|
|
|
188
190
|
# You can also splat a full Params class:
|
|
189
191
|
params = ModerationAPI::ContentSubmitParams.new(
|
|
190
|
-
content: ModerationAPI::ContentSubmitParams::Content::Text.new(text: "
|
|
192
|
+
content: ModerationAPI::ContentSubmitParams::Content::Text.new(text: "text")
|
|
191
193
|
)
|
|
192
194
|
moderation_api.content.submit(**params)
|
|
193
195
|
```
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: moderation_api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.18.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Moderation API
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-05-
|
|
11
|
+
date: 2026-05-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: cgi
|