runapi-runway-aleph 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: 56167311723e82f55c4fb956d06b4341f787b73b69a107e12e22d318ecd8366e
4
- data.tar.gz: 93d5a544147ec1d698971b76ca604926ccd391585ff149c5685e7cb3ea391b71
3
+ metadata.gz: bb42250458bd715b11cf906d442464db0b72bef068064cc5f146ab523311c5e4
4
+ data.tar.gz: '079ac40cc707ac1926bb61f42e6f457f25d90370a5d8553f6e4fcaaa6b5772c3'
5
5
  SHA512:
6
- metadata.gz: 7564b5a2e8bcd99e638505fbcf55d87c51ac77c5b2f91a8d8e28b9a4af51acc833167cc8505e6e8dd0f83ed8e0a158602ad7b4e1e8f520ec2b5c9d83967dd44e
7
- data.tar.gz: b63e2ba44057ea67f67fea3bf7f58aa5724979170b300edc8c7c53f5285196b4125b10d641d8e4f0651e264aae0d1a36eff0765074e2c9f48bdaa0aa40ad6713
6
+ metadata.gz: 0a4bb38cd68b19705714d3bb22f105bcaf2f34586201d5cba595b286abdda34ad0cafb598a42b28a0e26338a13e6fe4ad1712dafd0327bb812b25048bc6c24bd
7
+ data.tar.gz: 9b3b4becf9d920b1c287094bdf5ab64a044f78fc2f4469c7253915726fc36f51081f4a352117ba76cec3ba5974ec70c5d68ab7b330a3db366e37b51eb147870b
data/README.md CHANGED
@@ -1,19 +1,19 @@
1
- # Runway Aleph API Ruby SDK for RunAPI
1
+ # Runway Aleph Ruby SDK for RunAPI
2
2
 
3
- The runway aleph api Ruby SDK is the language-specific package for Runway Aleph on RunAPI. Use this runway aleph api package for prompt-guided video editing when your application needs JSON request bodies, task status lookup, and consistent RunAPI errors in Ruby.
3
+ The Runway Aleph Ruby SDK is the language-specific package for Runway Aleph 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 runway aleph api README is the Ruby package guide inside the public `runway-aleph-sdk` repository. For the repository overview, start at `../README.md`; for model details, use https://runapi.ai/models/runway-aleph; for API reference, use https://runapi.ai/docs#runway-aleph; for SDK docs, use https://runapi.ai/docs#sdk-runway-aleph.
5
+ This README is the Ruby package guide inside the public `runway-aleph-sdk` repository. For the repository overview, start at `../README.md`; for model details, use https://runapi.ai/models/runway-aleph; for API reference, use https://runapi.ai/docs#runway-aleph; for SDK docs, use https://runapi.ai/docs#sdk-runway-aleph.
6
6
 
7
7
  ## Install
8
8
 
9
9
  ```bash
10
- gem install runapi-runway_aleph
10
+ gem install runapi-runway-aleph
11
11
  ```
12
12
 
13
13
  ## Quick start
14
14
 
15
15
  ```ruby
16
- require "runapi-runway_aleph"
16
+ require "runapi-runway-aleph"
17
17
 
18
18
  client = RunApi::RunwayAleph::Client.new
19
19
  task = client.edit_video.create(
@@ -26,6 +26,8 @@ status = client.edit_video.get(task.id)
26
26
 
27
27
  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.
28
28
 
29
+ 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.
30
+
29
31
  ## Language notes
30
32
 
31
33
  Use Ruby keyword arguments and the `RunApi::RunwayAleph` error classes when building video jobs, Rails workers, or scripts. Keep `RUNAPI_API_KEY` in the environment or your secret manager; never commit API keys or callback secrets.
@@ -2,14 +2,22 @@
2
2
 
3
3
  module RunApi
4
4
  module RunwayAleph
5
- class Client
5
+ # Runway Aleph prompt-driven video editing API client.
6
+ # Unlike generation from scratch, Runway Aleph transforms an existing video
7
+ # using a text prompt, with optional style reference images.
8
+ #
9
+ # @example
10
+ # client = RunApi::RunwayAleph::Client.new(api_key: "your-api-key")
11
+ # result = client.edit_video.run(
12
+ # prompt: "Make it look like a watercolor painting",
13
+ # source_video_url: "https://cdn.runapi.ai/public/samples/video.mp4"
14
+ # )
15
+ class Client < RunApi::Core::Client
16
+ # @return [Resources::EditVideo] Prompt-driven video editing with optional style reference.
6
17
  attr_reader :edit_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
  @edit_video = Resources::EditVideo.new(http)
14
22
  end
15
23
  end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RunApi
4
+ module RunwayAleph
5
+ CONTRACT = {
6
+ "edit-video" => {
7
+ "models" => ["runway-aleph"],
8
+ "fields_by_model" => {
9
+ "runway-aleph" => {
10
+ "aspect_ratio" => {
11
+ "enum" => ["16:9", "9:16", "4:3", "3:4", "1:1", "21:9"]
12
+ },
13
+ "prompt" => {
14
+ "required" => true
15
+ },
16
+ "seed" => {
17
+ "type" => "integer"
18
+ },
19
+ "source_video_url" => {
20
+ "required" => true
21
+ }
22
+ }
23
+ }
24
+ }
25
+ }.freeze
26
+ end
27
+ end
@@ -3,39 +3,46 @@
3
3
  module RunApi
4
4
  module RunwayAleph
5
5
  module Resources
6
+ # Runway Aleph video editing resource.
7
+ # Transform an existing video using a text prompt and optional style reference image.
6
8
  class EditVideo
7
9
  include RunApi::Core::ResourceHelpers
8
10
 
9
11
  ENDPOINT = "/api/v1/runway_aleph/edit_video"
10
12
  RESPONSE_CLASS = Types::TaskCreateResponse
11
13
  COMPLETED_RESPONSE_CLASS = Types::CompletedEditVideoResponse
14
+ MODEL = "runway-aleph"
12
15
 
13
16
  def initialize(http)
14
17
  @http = http
15
18
  end
16
19
 
20
+ # Transform a video and wait until complete.
21
+ #
22
+ # @param params [Hash] edit parameters
23
+ # @return [RunApi::RunwayAleph::Types::CompletedEditVideoResponse] completed task with videos
17
24
  def run(**params)
18
25
  task = create(**params)
19
26
  poll_until_complete { get(task.id) }
20
27
  end
21
28
 
29
+ # Start a video editing task.
30
+ #
31
+ # @param params [Hash] edit parameters
32
+ # @return [RunApi::RunwayAleph::Types::TaskCreateResponse] task creation result with id
22
33
  def create(**params)
23
34
  params = compact_params(params)
24
- validate_params!(params)
35
+ validate_contract!(CONTRACT["edit-video"], params.merge(model: MODEL))
25
36
  request(:post, ENDPOINT, body: params)
26
37
  end
27
38
 
39
+ # Get video editing task status by task ID.
40
+ #
41
+ # @param id [String] task ID
42
+ # @return [RunApi::RunwayAleph::Types::EditVideoResponse] current task status
28
43
  def get(id)
29
44
  request(:get, "#{ENDPOINT}/#{id}")
30
45
  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
- validate_optional!(params, :aspect_ratio, Types::ASPECT_RATIOS)
38
- end
39
46
  end
40
47
  end
41
48
  end
@@ -2,18 +2,21 @@
2
2
 
3
3
  module RunApi
4
4
  module RunwayAleph
5
+ # Type definitions and constants for Runway Aleph video editing.
5
6
  module Types
6
- ASPECT_RATIOS = %w[16:9 9:16 4:3 3:4 1:1 21:9].freeze
7
-
7
+ # A generated output video.
8
8
  class Video < RunApi::Core::BaseModel
9
9
  optional :id, String
10
10
  required :url, String
11
11
  end
12
12
 
13
+ # A reference or extracted image.
13
14
  class Image < RunApi::Core::BaseModel
14
15
  required :url, String
15
16
  end
16
17
 
18
+ # Task status response for a video editing operation.
19
+ # Includes output videos and images when the task completes.
17
20
  class EditVideoResponse < RunApi::Core::TaskResponse
18
21
  required :id, String
19
22
  optional :status, String, enum: -> { RunApi::Core::TaskResponse::Status::ALL }
@@ -22,8 +25,10 @@ module RunApi
22
25
  optional :error, String
23
26
  end
24
27
 
28
+ # Initial response when a video editing task is created.
25
29
  class TaskCreateResponse < EditVideoResponse; end
26
30
 
31
+ # Completed video editing response with guaranteed output videos.
27
32
  class CompletedEditVideoResponse < EditVideoResponse
28
33
  required :videos, [-> { Video }]
29
34
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "runapi/core"
4
4
  require_relative "runway_aleph/types"
5
+ require_relative "runway_aleph/contract_gen"
5
6
  require_relative "runway_aleph/resources/edit_video"
6
7
  require_relative "runway_aleph/client"
7
8
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runapi-runway-aleph
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,17 +15,17 @@ 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 runway aleph api Ruby SDK is the language-specific package for Runway
27
- Aleph on RunAPI. Use this runway aleph api package for prompt-guided video editing
28
- when your application needs JSON request bodies, task status lookup, and consistent
25
+ version: 0.2.7
26
+ description: The Runway Aleph Ruby SDK is the language-specific package for Runway
27
+ Aleph on RunAPI. Use this package for video generation, animation, and video editing
28
+ workflows when your application needs request bodies, task status lookup, and consistent
29
29
  RunAPI errors in Ruby.
30
30
  email:
31
31
  - support@runapi.ai
@@ -39,15 +39,18 @@ files:
39
39
  - lib/runapi-runway_aleph.rb
40
40
  - lib/runapi/runway_aleph.rb
41
41
  - lib/runapi/runway_aleph/client.rb
42
+ - lib/runapi/runway_aleph/contract_gen.rb
42
43
  - lib/runapi/runway_aleph/resources/edit_video.rb
43
44
  - lib/runapi/runway_aleph/types.rb
44
45
  homepage: https://runapi.ai/models/runway-aleph
45
46
  licenses:
46
47
  - Apache-2.0
47
48
  metadata:
49
+ runapi_slug: runway-aleph
48
50
  homepage_uri: https://runapi.ai/models/runway-aleph
49
51
  documentation_uri: https://github.com/runapi-ai/runway-aleph-sdk/blob/main/ruby/README.md
50
52
  source_code_uri: https://github.com/runapi-ai/runway-aleph-sdk
53
+ bug_tracker_uri: https://github.com/runapi-ai/runway-aleph-sdk/issues
51
54
  changelog_uri: https://github.com/runapi-ai/runway-aleph-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: Runway Aleph API Ruby SDK for RunAPI
71
+ summary: Runway Aleph Ruby SDK for RunAPI
69
72
  test_files: []