runapi-luma 0.2.5 → 0.2.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 35d4110ccae524821e2f501565de79a887afd9e5074453b0c510c384039f94fc
4
- data.tar.gz: c7255e052c18688fa8b82365b70b1699b7528d3c472bd0f0169d0522dea75430
3
+ metadata.gz: 564e060149498fd0586a42c53ddc6ca5379fa7c0d7f20d95f0ec3391521d7d91
4
+ data.tar.gz: d20f909564ecb4f108afa54b6370bfd1fa8b2169e47a7d3162712811fdfdda8a
5
5
  SHA512:
6
- metadata.gz: '0348b4a54c531c072eca71e4d94774d96adc3174647d53da27c1dd4b8000e96f5548370bad78320a9e9216a11d1fe1f721175468ea304e2155cf81fdb2f4ae59'
7
- data.tar.gz: 57869ae8dd131e7fd59f21e29214bb1559ee8b593c60189a5fa37c77c3f7fbaedb77172188c442475b8ec780fb70f9a545a828b44fbdbb41a900b0f5a1be50df
6
+ metadata.gz: 2b6c45120f464db14f633bd5131cf9b18fe9bc1c304e88e6a2432f745aaf287945be99655b676476a98f919a9bb44b8d1cf05cdd49c743e3b2454a5922d83a5c
7
+ data.tar.gz: 292f08bbaaeeac22b5ce62dd29c8bc17d67271b53f213e3bf1696d705db40469dc57320a7b957cf6ba4f17028153692f7bfd2f0b62b8028bc0073b1d1ee07cb1
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # Luma AI API Ruby SDK for RunAPI
1
+ # Luma API Ruby SDK for RunAPI
2
2
 
3
- The luma ai api Ruby SDK is the language-specific package for Luma on RunAPI. Use this luma ai api package for text-to-video, image-to-video, video editing, and animation flows when your application needs JSON request bodies, task status lookup, and consistent RunAPI errors in Ruby.
3
+ The Luma Ruby SDK is the language-specific package for Luma on RunAPI. Use this package for video generation, animation, and video editing workflows when your application needs request bodies, task status lookup, and consistent RunAPI errors in Ruby.
4
4
 
5
- This luma ai api README is the Ruby package guide inside the public `luma-sdk` repository. For the repository overview, start at `../README.md`; for model details, use https://runapi.ai/models/luma; for API reference, use https://runapi.ai/docs#luma; for SDK docs, use https://runapi.ai/docs#sdk-luma.
5
+ This README is the Ruby package guide inside the public `luma-sdk` repository. For the repository overview, start at `../README.md`; for model details, use https://runapi.ai/models/luma; for API reference, use https://runapi.ai/docs#luma; for SDK docs, use https://runapi.ai/docs#sdk-luma.
6
6
 
7
7
  ## Install
8
8
 
@@ -16,17 +16,19 @@ gem install runapi-luma
16
16
  require "runapi-luma"
17
17
 
18
18
  client = RunApi::Luma::Client.new
19
- task = client.video_modifications.create(
19
+ task = client.modify_video.create(
20
20
  # Pass the Luma JSON request body from https://runapi.ai/docs#luma.
21
21
  )
22
- status = client.video_modifications.get(task.id)
22
+ status = client.modify_video.get(task.id)
23
23
  ```
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
- 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.
31
+ Use Ruby keyword arguments and the `RunApi::Luma` error classes when building video jobs, Rails workers, or scripts. The available resources are `modify_video`. Keep `RUNAPI_API_KEY` in the environment or your secret manager; never commit API keys or callback secrets.
30
32
 
31
33
  ## Links
32
34
 
@@ -2,14 +2,22 @@
2
2
 
3
3
  module RunApi
4
4
  module Luma
5
- class Client
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://cdn.runapi.ai/public/samples/video.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
- @api_key = Core::Auth.resolve_api_key(api_key)
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
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RunApi
4
+ module Luma
5
+ CONTRACT = {
6
+ "modify-video" => {
7
+ "models" => ["luma-modify-video"],
8
+ "fields_by_model" => {
9
+ "luma-modify-video" => {
10
+ "prompt" => {
11
+ "required" => true
12
+ },
13
+ "source_video_url" => {
14
+ "required" => true
15
+ }
16
+ }
17
+ }
18
+ }
19
+ }.freeze
20
+ end
21
+ 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,27 +16,32 @@ 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
- validate_params!(params)
34
+ validate_contract!(CONTRACT["modify-video"], 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
31
-
32
- private
33
-
34
- def validate_params!(params)
35
- raise Core::ValidationError, "prompt is required" unless param(params, :prompt)
36
- raise Core::ValidationError, "source_video_url is required" unless param(params, :source_video_url)
37
- end
38
45
  end
39
46
  end
40
47
  end
@@ -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
data/lib/runapi/luma.rb CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "runapi/core"
4
4
  require_relative "luma/types"
5
+ require_relative "luma/contract_gen"
5
6
  require_relative "luma/resources/modify_video"
6
7
  require_relative "luma/client"
7
8
 
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.5
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - RunAPI
@@ -15,18 +15,18 @@ dependencies:
15
15
  requirements:
16
16
  - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: 0.2.5
18
+ version: 0.2.7
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.5
26
- description: The luma ai api Ruby SDK is the language-specific package for Luma on
27
- RunAPI. Use this luma ai api package for text-to-video, image-to-video, video editing,
28
- and animation flows when your application needs JSON request bodies, task status
29
- lookup, and consistent RunAPI errors in Ruby.
25
+ version: 0.2.7
26
+ description: The Luma Ruby SDK is the language-specific package for Luma on RunAPI.
27
+ Use this package for video generation, animation, and video editing workflows when
28
+ your application needs request bodies, task status lookup, and consistent RunAPI
29
+ errors in Ruby.
30
30
  email:
31
31
  - contact@runapi.ai
32
32
  executables: []
@@ -39,15 +39,18 @@ files:
39
39
  - lib/runapi-luma.rb
40
40
  - lib/runapi/luma.rb
41
41
  - lib/runapi/luma/client.rb
42
+ - lib/runapi/luma/contract_gen.rb
42
43
  - lib/runapi/luma/resources/modify_video.rb
43
44
  - lib/runapi/luma/types.rb
44
45
  homepage: https://runapi.ai/models/luma
45
46
  licenses:
46
47
  - Apache-2.0
47
48
  metadata:
49
+ runapi_slug: luma
48
50
  homepage_uri: https://runapi.ai/models/luma
49
51
  documentation_uri: https://github.com/runapi-ai/luma-sdk/blob/main/ruby/README.md
50
52
  source_code_uri: https://github.com/runapi-ai/luma-sdk
53
+ bug_tracker_uri: https://github.com/runapi-ai/luma-sdk/issues
51
54
  changelog_uri: https://github.com/runapi-ai/luma-sdk/blob/main/CHANGELOG.md
52
55
  rdoc_options: []
53
56
  require_paths:
@@ -65,5 +68,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
65
68
  requirements: []
66
69
  rubygems_version: 4.0.10
67
70
  specification_version: 4
68
- summary: Luma AI API Ruby SDK for RunAPI
71
+ summary: Luma API Ruby SDK for RunAPI
69
72
  test_files: []