runapi-luma 0.2.5 → 0.2.6
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 +2 -0
- data/lib/runapi/luma/client.rb +13 -5
- data/lib/runapi/luma/resources/modify_video.rb +14 -0
- data/lib/runapi/luma/types.rb +6 -0
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a534b8161b9606234d3c2c79dafaa70ea8d7108c766e3c2abc582d9dfe9efef9
|
|
4
|
+
data.tar.gz: 4b6e1751bb3952d519fe4be8f3c636753fe1fcd41f2892cfd7696156adea9aca
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8214de6e41dc2adde5aa44cfbdcc81b71834be141b85c8388de954b113512330281e83cb424e974700086fbcf6a879c44b1033326292066091d11f9dbf99cef2
|
|
7
|
+
data.tar.gz: 1b01d42f7c69fbeef2670fc76f591e4c459f6dccb658dc4669832ce7b84d0fa12b5877cb373540b38e8f2150804e75a269d8410e87281b1c555bd4ab2508530e
|
data/README.md
CHANGED
|
@@ -24,6 +24,8 @@ status = client.video_modifications.get(task.id)
|
|
|
24
24
|
|
|
25
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
26
|
|
|
27
|
+
RunAPI-generated file URLs are temporary. Download and store generated images, videos, audio, or other files in your own durable storage within 7 days; do not treat returned URLs as long-term assets.
|
|
28
|
+
|
|
27
29
|
## Language notes
|
|
28
30
|
|
|
29
31
|
Use Ruby keyword arguments and the `RunApi::Luma` error classes when building video jobs, Rails workers, or scripts. The available resources include video modifications. Keep `RUNAPI_API_KEY` in the environment or your secret manager; never commit API keys or callback secrets.
|
data/lib/runapi/luma/client.rb
CHANGED
|
@@ -2,14 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
module RunApi
|
|
4
4
|
module Luma
|
|
5
|
-
|
|
5
|
+
# Luma prompt-guided video modification API client.
|
|
6
|
+
# Applies visual edits to an existing video -- changing style, adjusting atmosphere,
|
|
7
|
+
# or adding effects -- while preserving the source motion.
|
|
8
|
+
#
|
|
9
|
+
# @example
|
|
10
|
+
# client = RunApi::Luma::Client.new(api_key: "your-api-key")
|
|
11
|
+
# result = client.modify_video.run(
|
|
12
|
+
# prompt: "Add a dramatic sunset lighting effect",
|
|
13
|
+
# source_video_url: "https://example.com/input.mp4"
|
|
14
|
+
# )
|
|
15
|
+
class Client < RunApi::Core::Client
|
|
16
|
+
# @return [Resources::ModifyVideo] Prompt-guided video editing that preserves source motion.
|
|
6
17
|
attr_reader :modify_video
|
|
7
18
|
|
|
8
19
|
def initialize(api_key: nil, **options)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
client_options = Core::ClientOptions.new(api_key: @api_key, **options)
|
|
12
|
-
http = client_options.http_client || Core::HttpClient.new(client_options)
|
|
20
|
+
super
|
|
13
21
|
@modify_video = Resources::ModifyVideo.new(http)
|
|
14
22
|
end
|
|
15
23
|
end
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
module RunApi
|
|
4
4
|
module Luma
|
|
5
5
|
module Resources
|
|
6
|
+
# Luma video modification resource.
|
|
7
|
+
# Apply prompt-guided visual edits to an existing video while preserving its motion.
|
|
6
8
|
class ModifyVideo
|
|
7
9
|
include RunApi::Core::ResourceHelpers
|
|
8
10
|
|
|
@@ -14,17 +16,29 @@ module RunApi
|
|
|
14
16
|
@http = http
|
|
15
17
|
end
|
|
16
18
|
|
|
19
|
+
# Modify a video and wait until complete.
|
|
20
|
+
#
|
|
21
|
+
# @param params [Hash] modification parameters
|
|
22
|
+
# @return [RunApi::Luma::Types::CompletedModifyVideoResponse] completed task with videos
|
|
17
23
|
def run(**params)
|
|
18
24
|
task = create(**params)
|
|
19
25
|
poll_until_complete { get(task.id) }
|
|
20
26
|
end
|
|
21
27
|
|
|
28
|
+
# Start a video modification task.
|
|
29
|
+
#
|
|
30
|
+
# @param params [Hash] modification parameters
|
|
31
|
+
# @return [RunApi::Luma::Types::ModifyVideoResponse] task creation result with id
|
|
22
32
|
def create(**params)
|
|
23
33
|
params = compact_params(params)
|
|
24
34
|
validate_params!(params)
|
|
25
35
|
request(:post, ENDPOINT, body: params)
|
|
26
36
|
end
|
|
27
37
|
|
|
38
|
+
# Get video modification task status by task ID.
|
|
39
|
+
#
|
|
40
|
+
# @param id [String] task ID
|
|
41
|
+
# @return [RunApi::Luma::Types::ModifyVideoResponse] current task status
|
|
28
42
|
def get(id)
|
|
29
43
|
request(:get, "#{ENDPOINT}/#{id}")
|
|
30
44
|
end
|
data/lib/runapi/luma/types.rb
CHANGED
|
@@ -2,22 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
module RunApi
|
|
4
4
|
module Luma
|
|
5
|
+
# Type definitions and constants for Luma video modification.
|
|
5
6
|
module Types
|
|
7
|
+
# A video file with a download URL.
|
|
6
8
|
class Video < RunApi::Core::BaseModel
|
|
7
9
|
optional :url, String
|
|
8
10
|
end
|
|
9
11
|
|
|
12
|
+
# Base async task response with id and status tracking.
|
|
10
13
|
class AsyncTaskResponse < RunApi::Core::TaskResponse
|
|
11
14
|
required :id, String
|
|
12
15
|
optional :status, String, enum: -> { RunApi::Core::TaskResponse::Status::ALL }
|
|
13
16
|
end
|
|
14
17
|
|
|
18
|
+
# Task status response for a video modification operation.
|
|
19
|
+
# On completion, +videos+ contains the modified output and +sources+ contains the original input.
|
|
15
20
|
class ModifyVideoResponse < AsyncTaskResponse
|
|
16
21
|
optional :videos, [-> { Video }]
|
|
17
22
|
optional :sources, [-> { Video }]
|
|
18
23
|
optional :error, String
|
|
19
24
|
end
|
|
20
25
|
|
|
26
|
+
# Completed video modification response with guaranteed output videos.
|
|
21
27
|
class CompletedModifyVideoResponse < ModifyVideoResponse
|
|
22
28
|
required :videos, [-> { Video }]
|
|
23
29
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: runapi-luma
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- RunAPI
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - "~>"
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 0.2.
|
|
18
|
+
version: 0.2.6
|
|
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.
|
|
25
|
+
version: 0.2.6
|
|
26
26
|
description: The luma ai api Ruby SDK is the language-specific package for Luma on
|
|
27
27
|
RunAPI. Use this luma ai api package for text-to-video, image-to-video, video editing,
|
|
28
28
|
and animation flows when your application needs JSON request bodies, task status
|