runapi-recraft 0.2.4 → 0.2.5
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/README.md +43 -0
- data/lib/runapi/recraft/resources/remove_background.rb +1 -1
- data/lib/runapi/recraft/resources/upscale_image.rb +1 -1
- data/lib/runapi/recraft/types.rb +2 -2
- metadata +12 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ac78d7e6f131188a636f5e2a83ffa3438ceb02d00275c558375c1000980ae43e
|
|
4
|
+
data.tar.gz: bf40d14ed407faf3c15250c2c1778f37e5f342c904efa20374be1f8d0c80446b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e9cedf23b2a3730afe9a2bfeb3fa7fbc819ea2935524cbdce26e25a412f301c9c7128f63c213da60e45378339c1da35d02cf7c2568d42ac91e253370ed149960
|
|
7
|
+
data.tar.gz: 41c554461a6c770ecacfca8536440dec5d4b671438cd56e28a0fc9f8ffb6703ec669dd642805e48e71731d8c60bfd7afd78bbcc481335601a6f141d2a6a67c36
|
data/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Recraft API Ruby SDK for RunAPI
|
|
2
|
+
|
|
3
|
+
The recraft api Ruby SDK is the language-specific package for Recraft on RunAPI. Use this recraft api package for text-to-image, image editing, and creative production flows when your application needs JSON request bodies, task status lookup, and consistent RunAPI errors in Ruby.
|
|
4
|
+
|
|
5
|
+
This recraft api README is the Ruby package guide inside the public `recraft-sdk` repository. For the repository overview, start at `../README.md`; for model details, use https://runapi.ai/models/recraft; for API reference, use https://runapi.ai/docs#recraft; for SDK docs, use https://runapi.ai/docs#sdk-recraft.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
gem install runapi-recraft
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick start
|
|
14
|
+
|
|
15
|
+
```ruby
|
|
16
|
+
require "runapi-recraft"
|
|
17
|
+
|
|
18
|
+
client = RunApi::Recraft::Client.new
|
|
19
|
+
task = client.upscales.create(
|
|
20
|
+
# Pass the Recraft JSON request body from https://runapi.ai/docs#recraft.
|
|
21
|
+
)
|
|
22
|
+
status = client.upscales.get(task.id)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Use `create` when you want to submit a task and return quickly, `get` when you need the latest task state, and `run` when a script should create and poll until completion. In web request handlers, prefer `create` plus webhook or later `get` polling so a worker is not held open.
|
|
26
|
+
|
|
27
|
+
## Language notes
|
|
28
|
+
|
|
29
|
+
Use Ruby keyword arguments and the `RunApi::Recraft` error classes when building image jobs, Rails workers, or scripts. The available resources include upscales, and background removals. Keep `RUNAPI_API_KEY` in the environment or your secret manager; never commit API keys or callback secrets.
|
|
30
|
+
|
|
31
|
+
## Links
|
|
32
|
+
|
|
33
|
+
- Model page: https://runapi.ai/models/recraft
|
|
34
|
+
- SDK docs: https://runapi.ai/docs#sdk-recraft
|
|
35
|
+
- Product docs: https://runapi.ai/docs#recraft
|
|
36
|
+
- Pricing and rate limits: https://runapi.ai/models/recraft/crisp-upscale
|
|
37
|
+
- Provider comparison: https://runapi.ai/providers/recraft
|
|
38
|
+
- Full catalog: https://runapi.ai/models
|
|
39
|
+
- Repository: https://github.com/runapi-ai/recraft-sdk
|
|
40
|
+
|
|
41
|
+
## License
|
|
42
|
+
|
|
43
|
+
Licensed under the Apache License, Version 2.0.
|
|
@@ -34,7 +34,7 @@ module RunApi
|
|
|
34
34
|
|
|
35
35
|
def validate_params!(params)
|
|
36
36
|
raise Core::ValidationError, "model is required" unless param(params, :model)
|
|
37
|
-
raise Core::ValidationError, "
|
|
37
|
+
raise Core::ValidationError, "source_image_url is required" unless param(params, :source_image_url)
|
|
38
38
|
|
|
39
39
|
model = param(params, :model)
|
|
40
40
|
unless Types::REMOVE_BACKGROUND_MODELS.include?(model)
|
|
@@ -34,7 +34,7 @@ module RunApi
|
|
|
34
34
|
|
|
35
35
|
def validate_params!(params)
|
|
36
36
|
raise Core::ValidationError, "model is required" unless param(params, :model)
|
|
37
|
-
raise Core::ValidationError, "
|
|
37
|
+
raise Core::ValidationError, "source_image_url is required" unless param(params, :source_image_url)
|
|
38
38
|
|
|
39
39
|
model = param(params, :model)
|
|
40
40
|
unless Types::UPSCALE_IMAGE_MODELS.include?(model)
|
data/lib/runapi/recraft/types.rb
CHANGED
|
@@ -13,12 +13,12 @@ module RunApi
|
|
|
13
13
|
class ImageTaskResponse < RunApi::Core::TaskResponse
|
|
14
14
|
required :id, String
|
|
15
15
|
optional :status, String, enum: -> { RunApi::Core::TaskResponse::Status::ALL }
|
|
16
|
-
optional :images, [
|
|
16
|
+
optional :images, [-> { Image }]
|
|
17
17
|
optional :error, String
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
class CompletedImageTaskResponse < ImageTaskResponse
|
|
21
|
-
required :images, [
|
|
21
|
+
required :images, [-> { Image }]
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: runapi-recraft
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- RunAPI
|
|
@@ -15,22 +15,27 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - "~>"
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 0.2.
|
|
18
|
+
version: 0.2.5
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - "~>"
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 0.2.
|
|
26
|
-
description:
|
|
25
|
+
version: 0.2.5
|
|
26
|
+
description: The recraft api Ruby SDK is the language-specific package for Recraft
|
|
27
|
+
on RunAPI. Use this recraft api package for text-to-image, image editing, and creative
|
|
28
|
+
production flows when your application needs JSON request bodies, task status lookup,
|
|
29
|
+
and consistent RunAPI errors in Ruby.
|
|
27
30
|
email:
|
|
28
31
|
- contact@runapi.ai
|
|
29
32
|
executables: []
|
|
30
33
|
extensions: []
|
|
31
|
-
extra_rdoc_files:
|
|
34
|
+
extra_rdoc_files:
|
|
35
|
+
- README.md
|
|
32
36
|
files:
|
|
33
37
|
- LICENSE
|
|
38
|
+
- README.md
|
|
34
39
|
- lib/runapi-recraft.rb
|
|
35
40
|
- lib/runapi/recraft.rb
|
|
36
41
|
- lib/runapi/recraft/client.rb
|
|
@@ -42,7 +47,7 @@ licenses:
|
|
|
42
47
|
- Apache-2.0
|
|
43
48
|
metadata:
|
|
44
49
|
homepage_uri: https://runapi.ai/models/recraft
|
|
45
|
-
documentation_uri: https://github.com/runapi-ai/recraft-sdk/blob/main/README.md
|
|
50
|
+
documentation_uri: https://github.com/runapi-ai/recraft-sdk/blob/main/ruby/README.md
|
|
46
51
|
source_code_uri: https://github.com/runapi-ai/recraft-sdk
|
|
47
52
|
changelog_uri: https://github.com/runapi-ai/recraft-sdk/blob/main/CHANGELOG.md
|
|
48
53
|
rdoc_options: []
|
|
@@ -61,5 +66,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
61
66
|
requirements: []
|
|
62
67
|
rubygems_version: 4.0.10
|
|
63
68
|
specification_version: 4
|
|
64
|
-
summary: Recraft API
|
|
69
|
+
summary: Recraft API Ruby SDK for RunAPI
|
|
65
70
|
test_files: []
|