runapi-core 0.2.14 → 0.2.16

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: 3c441c1752f41281ef46e89e708570844c321371e91b400879e92c1555038a61
4
- data.tar.gz: 927b1f5259c7d7e799f1509eb2f0b67ed8635722bbf920c4c49ce67a72f92838
3
+ metadata.gz: f199f45d065827bb1931ab5faff8dd945fd62b3cb0a5260b268fdfee41875a45
4
+ data.tar.gz: 6d2c40ffded8406818798c40bfddca448e1a7149981fd0b012dc5c0f4d17e02e
5
5
  SHA512:
6
- metadata.gz: 26702004f5ea1b631203123c83353c64ab858c0cc440c2f506717d666574d14d2a284f14bcb1874ecac7fed28a5c8b40bdd14425e25e31948c380a99c6f7515e
7
- data.tar.gz: 87ac2f48d103c696e196a9bbc00ba56cdf2d87322aebcb4453dae655db9ef89bfe3fa116a21127e4b5188823facb4ae838add55686a4c45950463dda5e23313f
6
+ metadata.gz: 17e79439f00b8b10fbbbbcf00b3d074cfd9e3cf9d70c4b20b91743aee12cba2e122c9da364a66c0c21844d5e2153083102acacfb639871e1a24377899b3bda41
7
+ data.tar.gz: 707cadac8b31ca82c31fa191cb017e58192eb7c6b4da7bd15aba8fe40209f783537ee2452bc4846538c123ddc0843c31c7b24a86158a766f7740ec309e269d38
data/README.md CHANGED
@@ -16,6 +16,8 @@ Use the core gem for common client options, error classes, request helpers, and
16
16
 
17
17
  RunAPI accepts an optional `X-Client-Request-Id` header on public API calls. Use printable ASCII values up to 512 characters. Accepted values are echoed in the response and stored with the RunAPI task for support and reconciliation.
18
18
 
19
+ Task-creation calls also accept an optional opaque `Idempotency-Key` up to 512 characters. Generate one value per logical task and reuse it only with identical input after an unknown result. Reusing the value with different input returns `409 Conflict`; do not derive it from `X-Client-Request-Id`.
20
+
19
21
  High-level Ruby Provider Client resource methods accept per-request options and keep response headers on the returned model object. This example uses the Suno Provider Client; install `runapi-suno` to run it.
20
22
 
21
23
  ```ruby
@@ -23,7 +25,10 @@ require "runapi/suno"
23
25
 
24
26
  client = RunApi::Suno::Client.new(api_key: ENV.fetch("RUNAPI_API_KEY"))
25
27
  options = RunApi::Core::RequestOptions.new(
26
- headers: {"X-Client-Request-Id" => "order-123"}
28
+ headers: {
29
+ "X-Client-Request-Id" => "order-123",
30
+ "Idempotency-Key" => "opaque-logical-task-123"
31
+ }
27
32
  )
28
33
 
29
34
  response = client.text_to_music.create(
@@ -17,11 +17,17 @@ module RunApi
17
17
  def initialize(api_key: nil, **options)
18
18
  @api_key = Core::Auth.resolve_api_key(api_key)
19
19
  client_options = Core::ClientOptions.new(api_key: @api_key, **options)
20
+ @owns_http_client = client_options.http_client.nil?
20
21
  @http = client_options.http_client || Core::HttpClient.new(client_options)
21
22
  @files = Files.new(@http)
22
23
  @account = Account.new(@http)
23
24
  end
24
25
 
26
+ # Closes the SDK-created HTTP client. Injected clients remain caller-owned.
27
+ def close
28
+ @http.close if @owns_http_client
29
+ end
30
+
25
31
  protected
26
32
 
27
33
  attr_reader :http
@@ -60,6 +60,12 @@ module RunApi
60
60
  close_multipart_files(req)
61
61
  end
62
62
 
63
+ def close
64
+ @pool.shutdown do |http|
65
+ http.finish if http.started?
66
+ end
67
+ end
68
+
63
69
  # PUT bytes straight to a pre-authorized upload URL with the exact headers
64
70
  # issued for it. Skips the base URL, auth, and retries: the URL is single-use
65
71
  # and the body is not safe to replay.
@@ -2,7 +2,7 @@
2
2
 
3
3
  module RunApi
4
4
  module Core
5
- VERSION = "0.2.14"
5
+ VERSION = "0.2.16"
6
6
  end
7
7
 
8
8
  VERSION = Core::VERSION
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runapi-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.14
4
+ version: 0.2.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - RunAPI
@@ -13,16 +13,22 @@ dependencies:
13
13
  name: connection_pool
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
- - - "~>"
16
+ - - ">="
17
17
  - !ruby/object:Gem::Version
18
18
  version: '2.4'
19
+ - - "<"
20
+ - !ruby/object:Gem::Version
21
+ version: '4'
19
22
  type: :runtime
20
23
  prerelease: false
21
24
  version_requirements: !ruby/object:Gem::Requirement
22
25
  requirements:
23
- - - "~>"
26
+ - - ">="
24
27
  - !ruby/object:Gem::Version
25
28
  version: '2.4'
29
+ - - "<"
30
+ - !ruby/object:Gem::Version
31
+ version: '4'
26
32
  description: The RunAPI Core Ruby SDK provides shared authentication, HTTP, retry,
27
33
  error, and polling primitives for RunAPI model gems. Install `runapi-core` only
28
34
  when you are building SDK infrastructure or shared Ruby tooling; application code
@@ -77,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
83
  - !ruby/object:Gem::Version
78
84
  version: '0'
79
85
  requirements: []
80
- rubygems_version: 4.0.10
86
+ rubygems_version: 4.0.17
81
87
  specification_version: 4
82
88
  summary: RunAPI Core Ruby SDK
83
89
  test_files: []