runapi-runway 0.2.7 → 0.2.8

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: 59ad3e607d33dc4bb65bd09cbf86eaf3ff1de1c48c319db17a6ff01e28e506e1
4
- data.tar.gz: bdb1f84d784e5edcb01566aafd8f82865c6b6cf2b2552464981c16d6e29745c5
3
+ metadata.gz: ad79cfb3fe2fd25106c5b06257c8f4a204bc2f423fa033cf7fd7c37af6aaf5a0
4
+ data.tar.gz: 0ea01d23599ba93b73cca5b682fceeb2d40c27d258f0c2c245f937dfbd5d4fff
5
5
  SHA512:
6
- metadata.gz: 0b0be7c1953ea69ff61be3c96c23fb5f615288da5d6e8f8b9f72e71eb748049c0eab3697dc9576c3549116ac9f1eae18fbc1662040c6097971b5289adb16efef
7
- data.tar.gz: d88f0bf293488b0c5da4bd817578820525f8b7edb7a0ccffcb57044bb8f09030f6de5389fb2264108e1adcfd12d4f11d0ea9ae4e795dca7ea6f5a01cac75d91e
6
+ metadata.gz: 4d452b908a3800518ccc32c8d9a300b24f8e47afd51f597d3703e1da2af01f899195437ad8483807825253b0970f3d67acd8da850674fb0c43f927f7d5a0f780
7
+ data.tar.gz: c8d1792c8e980bfe52f58c9fac6cfc4f8ce397bdae4abb31eebcd2cc74100574ed30f1311e8fc3f054f3481ad0605b0ec7cbd1bc00782a503c893b601decb521
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # Runway API Ruby SDK for RunAPI
1
+ # Runway Ruby SDK for RunAPI
2
2
 
3
- The runway api Ruby SDK is the language-specific package for Runway on RunAPI. Use this runway 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 Runway Ruby SDK is the language-specific package for Runway 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 api README is the Ruby package guide inside the public `runway-sdk` repository. For the repository overview, start at `../README.md`; for model details, use https://runapi.ai/models/runway; for API reference, use https://runapi.ai/docs#runway; for SDK docs, use https://runapi.ai/docs#sdk-runway.
5
+ This README is the Ruby package guide inside the public `runway-sdk` repository. For the repository overview, start at `../README.md`; for model details, use https://runapi.ai/models/runway; for API reference, use https://runapi.ai/docs#runway; for SDK docs, use https://runapi.ai/docs#sdk-runway.
6
6
 
7
7
  ## Install
8
8
 
@@ -13,7 +13,7 @@ gem install runapi-runway
13
13
  ## Quick start
14
14
 
15
15
  ```ruby
16
- require "runapi-runway"
16
+ require "runapi/runway"
17
17
 
18
18
  client = RunApi::Runway::Client.new
19
19
  task = client.text_to_video.create(
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RunApi
4
+ module Runway
5
+ CONTRACT = {
6
+ "extend-video" => {
7
+ "models" => ["runway"],
8
+ "fields_by_model" => {
9
+ "runway" => {
10
+ "output_resolution" => {
11
+ "enum" => ["720p", "1080p"],
12
+ "required" => true
13
+ },
14
+ "prompt" => {
15
+ "required" => true
16
+ },
17
+ "source_task_id" => {
18
+ "required" => true
19
+ }
20
+ }
21
+ }
22
+ },
23
+ "text-to-video" => {
24
+ "models" => ["runway"],
25
+ "fields_by_model" => {
26
+ "runway" => {
27
+ "aspect_ratio" => {
28
+ "enum" => ["16:9", "9:16", "1:1", "4:3", "3:4"]
29
+ },
30
+ "duration_seconds" => {
31
+ "enum" => [5, 10],
32
+ "required" => true,
33
+ "type" => "integer"
34
+ },
35
+ "output_resolution" => {
36
+ "enum" => ["720p", "1080p"],
37
+ "required" => true
38
+ },
39
+ "prompt" => {
40
+ "required" => true
41
+ }
42
+ }
43
+ }
44
+ }
45
+ }.freeze
46
+ end
47
+ end
@@ -11,6 +11,7 @@ module RunApi
11
11
  ENDPOINT = "/api/v1/runway/extend_video"
12
12
  RESPONSE_CLASS = Types::TaskCreateResponse
13
13
  COMPLETED_RESPONSE_CLASS = Types::CompletedTaskResponse
14
+ MODEL = "runway"
14
15
 
15
16
  def initialize(http)
16
17
  @http = http
@@ -24,36 +25,27 @@ module RunApi
24
25
  # @param watermark [String, nil] watermark text burned into the output
25
26
  # @param callback_url [String, nil] webhook URL for completion notification
26
27
  # @return [RunApi::Runway::Types::CompletedTaskResponse] completed task with videos
27
- def run(**params)
28
- task = create(**params)
29
- poll_until_complete { get(task.id) }
28
+ def run(options: nil, **params)
29
+ task = create(options: options, **params)
30
+ poll_until_complete { get(task.id, options: options) }
30
31
  end
31
32
 
32
33
  # Create an extend-video task without waiting for completion.
33
34
  #
34
35
  # @param params [Hash] extend-video parameters (see {#run} for details)
35
36
  # @return [RunApi::Runway::Types::TaskCreateResponse] task creation result with id
36
- def create(**params)
37
+ def create(options: nil, **params)
37
38
  params = compact_params(params)
38
- validate_params!(params)
39
- request(:post, ENDPOINT, body: params)
39
+ validate_contract!(CONTRACT["extend-video"], params.merge(model: MODEL))
40
+ request(:post, ENDPOINT, body: params, options: options)
40
41
  end
41
42
 
42
43
  # Get extend-video task status by task ID.
43
44
  #
44
45
  # @param id [String] task ID
45
46
  # @return [RunApi::Runway::Types::TaskResponse] current task status
46
- def get(id)
47
- request(:get, "#{ENDPOINT}/#{id}")
48
- end
49
-
50
- private
51
-
52
- def validate_params!(params)
53
- raise Core::ValidationError, "source_task_id is required" unless param(params, :source_task_id)
54
- raise Core::ValidationError, "prompt is required" unless param(params, :prompt)
55
- raise Core::ValidationError, "output_resolution is required" unless param(params, :output_resolution)
56
- validate_optional!(params, :output_resolution, Types::OUTPUT_RESOLUTIONS)
47
+ def get(id, options: nil)
48
+ request(:get, "#{ENDPOINT}/#{id}", options: options)
57
49
  end
58
50
  end
59
51
  end
@@ -11,6 +11,7 @@ module RunApi
11
11
  ENDPOINT = "/api/v1/runway/text_to_video"
12
12
  RESPONSE_CLASS = Types::TaskCreateResponse
13
13
  COMPLETED_RESPONSE_CLASS = Types::CompletedTaskResponse
14
+ MODEL = "runway"
14
15
 
15
16
  def initialize(http)
16
17
  @http = http
@@ -26,37 +27,27 @@ module RunApi
26
27
  # @param watermark [String, nil] watermark text burned into the output
27
28
  # @param callback_url [String, nil] webhook URL for completion notification
28
29
  # @return [RunApi::Runway::Types::CompletedTaskResponse] completed task with videos
29
- def run(**params)
30
- task = create(**params)
31
- poll_until_complete { get(task.id) }
30
+ def run(options: nil, **params)
31
+ task = create(options: options, **params)
32
+ poll_until_complete { get(task.id, options: options) }
32
33
  end
33
34
 
34
35
  # Create a text-to-video task without waiting for completion.
35
36
  #
36
37
  # @param params [Hash] text-to-video parameters (see {#run} for details)
37
38
  # @return [RunApi::Runway::Types::TaskCreateResponse] task creation result with id
38
- def create(**params)
39
+ def create(options: nil, **params)
39
40
  params = compact_params(params)
40
- validate_params!(params)
41
- request(:post, ENDPOINT, body: params)
41
+ validate_contract!(CONTRACT["text-to-video"], params.merge(model: MODEL))
42
+ request(:post, ENDPOINT, body: params, options: options)
42
43
  end
43
44
 
44
45
  # Get text-to-video task status by task ID.
45
46
  #
46
47
  # @param id [String] task ID
47
48
  # @return [RunApi::Runway::Types::TaskResponse] current task status
48
- def get(id)
49
- request(:get, "#{ENDPOINT}/#{id}")
50
- end
51
-
52
- private
53
-
54
- def validate_params!(params)
55
- raise Core::ValidationError, "prompt is required" unless param(params, :prompt)
56
- raise Core::ValidationError, "duration_seconds is required" unless param(params, :duration_seconds)
57
- raise Core::ValidationError, "output_resolution is required" unless param(params, :output_resolution)
58
- validate_optional!(params, :output_resolution, Types::OUTPUT_RESOLUTIONS)
59
- validate_optional!(params, :aspect_ratio, Types::ASPECT_RATIOS)
49
+ def get(id, options: nil)
50
+ request(:get, "#{ENDPOINT}/#{id}", options: options)
60
51
  end
61
52
  end
62
53
  end
@@ -4,13 +4,6 @@ module RunApi
4
4
  module Runway
5
5
  # Type definitions and constants for Runway Gen-4 video generation.
6
6
  module Types
7
- # Output resolution. 720p (1280x720) is faster and lower cost;
8
- # 1080p (1920x1080) produces higher detail at higher cost.
9
- OUTPUT_RESOLUTIONS = %w[720p 1080p].freeze
10
-
11
- # Aspect ratio for pure text-to-video. Ignored when a first-frame image is provided.
12
- ASPECT_RATIOS = %w[16:9 9:16 1:1 4:3 3:4].freeze
13
-
14
7
  # A generated video file with a download URL.
15
8
  class Video < RunApi::Core::BaseModel
16
9
  optional :id, String
data/lib/runapi/runway.rb CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "runapi/core"
4
4
  require_relative "runway/types"
5
+ require_relative "runway/contract_gen"
5
6
  require_relative "runway/resources/text_to_video"
6
7
  require_relative "runway/resources/extend_video"
7
8
  require_relative "runway/client"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runapi-runway
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.8
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.6
18
+ version: 0.3.0
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.6
26
- description: The runway api Ruby SDK is the language-specific package for Runway on
27
- RunAPI. Use this runway 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.3.0
26
+ description: The Runway Ruby SDK is the language-specific package for Runway 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,6 +39,7 @@ files:
39
39
  - lib/runapi-runway.rb
40
40
  - lib/runapi/runway.rb
41
41
  - lib/runapi/runway/client.rb
42
+ - lib/runapi/runway/contract_gen.rb
42
43
  - lib/runapi/runway/resources/extend_video.rb
43
44
  - lib/runapi/runway/resources/text_to_video.rb
44
45
  - lib/runapi/runway/types.rb
@@ -46,9 +47,11 @@ homepage: https://runapi.ai/models/runway
46
47
  licenses:
47
48
  - Apache-2.0
48
49
  metadata:
50
+ runapi_slug: runway
49
51
  homepage_uri: https://runapi.ai/models/runway
50
52
  documentation_uri: https://github.com/runapi-ai/runway-sdk/blob/main/ruby/README.md
51
53
  source_code_uri: https://github.com/runapi-ai/runway-sdk
54
+ bug_tracker_uri: https://github.com/runapi-ai/runway-sdk/issues
52
55
  changelog_uri: https://github.com/runapi-ai/runway-sdk/blob/main/CHANGELOG.md
53
56
  rdoc_options: []
54
57
  require_paths:
@@ -64,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
64
67
  - !ruby/object:Gem::Version
65
68
  version: '0'
66
69
  requirements: []
67
- rubygems_version: 4.0.10
70
+ rubygems_version: 4.0.17
68
71
  specification_version: 4
69
- summary: Runway API Ruby SDK for RunAPI
72
+ summary: Runway Ruby SDK for RunAPI
70
73
  test_files: []