typecast-ruby 0.1.3 → 0.1.5
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/lib/typecast/client.rb +30 -1
- data/lib/typecast/models.rb +9 -3
- data/lib/typecast/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5de7b5e77a18c1e4e6834db6fedd467b922eb4a6124b01ad67b3521a7b5cebf7
|
|
4
|
+
data.tar.gz: 95ddc9f242aebcb75372c93bcebde790e36aa4a84a096c981b5a039055dfcd2b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6ade9e4df77283c37b69efc1fc8d417233d31b63b7f256c4badeccdd106f524014f01c526f199b3e187ceb6b8338cd2b0068814a67618930d8ebf37d4ce4ce6e
|
|
7
|
+
data.tar.gz: f8f83592269f2d30ee810e257a8713dd34ffadc034933b51b089aa9bc0b1fbff7de9a8b0b9fda8947f914570e76b3f2948eaca65d38d53f49a1db8877ec7aa65
|
data/lib/typecast/client.rb
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
require "json"
|
|
2
2
|
require "net/http"
|
|
3
|
+
require "rbconfig"
|
|
3
4
|
require "securerandom"
|
|
4
5
|
require "uri"
|
|
5
6
|
|
|
@@ -7,6 +8,7 @@ require "typecast/errors"
|
|
|
7
8
|
require "typecast/composer"
|
|
8
9
|
require "typecast/models"
|
|
9
10
|
require "typecast/timestamps"
|
|
11
|
+
require "typecast/version"
|
|
10
12
|
|
|
11
13
|
module Typecast
|
|
12
14
|
class Client
|
|
@@ -157,7 +159,34 @@ module Typecast
|
|
|
157
159
|
end
|
|
158
160
|
|
|
159
161
|
def auth_headers
|
|
160
|
-
|
|
162
|
+
headers = { "User-Agent" => user_agent }
|
|
163
|
+
headers["X-API-KEY"] = api_key unless api_key.empty?
|
|
164
|
+
headers
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
def user_agent
|
|
168
|
+
base = default_base_url? ? "default" : "custom"
|
|
169
|
+
timeout = @read_timeout == 30 ? "default" : "#{@read_timeout}s"
|
|
170
|
+
"typecast-ruby/#{VERSION} Ruby/#{RUBY_VERSION} net-http " \
|
|
171
|
+
"(base=#{base}; timeout=#{timeout}; os=#{os_name}; arch=#{arch_name}; sdk_env=ruby; platform=server)"
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
def os_name
|
|
175
|
+
host_os = RbConfig::CONFIG["host_os"].to_s.downcase
|
|
176
|
+
return "macos" if host_os.include?("darwin")
|
|
177
|
+
return "windows" if host_os.match?(/mswin|mingw|cygwin/)
|
|
178
|
+
return "linux" if host_os.include?("linux")
|
|
179
|
+
|
|
180
|
+
"unknown"
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
def arch_name
|
|
184
|
+
host_cpu = RbConfig::CONFIG["host_cpu"].to_s.downcase
|
|
185
|
+
return "arm64" if host_cpu.match?(/arm64|aarch64/)
|
|
186
|
+
return "x64" if host_cpu.match?(/x86_64|amd64/)
|
|
187
|
+
return "x86" if host_cpu.match?(/i386|i686|x86/)
|
|
188
|
+
|
|
189
|
+
"unknown"
|
|
161
190
|
end
|
|
162
191
|
|
|
163
192
|
def validate_api_key!
|
data/lib/typecast/models.rb
CHANGED
|
@@ -35,16 +35,22 @@ module Typecast
|
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
class OutputStream
|
|
38
|
-
attr_reader :audio_pitch, :audio_tempo, :audio_format
|
|
38
|
+
attr_reader :audio_pitch, :audio_tempo, :audio_format, :target_lufs
|
|
39
39
|
|
|
40
|
-
def initialize(audio_pitch: nil, audio_tempo: nil, audio_format: nil)
|
|
40
|
+
def initialize(audio_pitch: nil, audio_tempo: nil, audio_format: nil, target_lufs: nil)
|
|
41
41
|
@audio_pitch = audio_pitch
|
|
42
42
|
@audio_tempo = audio_tempo
|
|
43
43
|
@audio_format = audio_format
|
|
44
|
+
@target_lufs = target_lufs
|
|
44
45
|
end
|
|
45
46
|
|
|
46
47
|
def to_h
|
|
47
|
-
Models.compact(
|
|
48
|
+
Models.compact(
|
|
49
|
+
audio_pitch: audio_pitch,
|
|
50
|
+
audio_tempo: audio_tempo,
|
|
51
|
+
audio_format: audio_format,
|
|
52
|
+
target_lufs: target_lufs
|
|
53
|
+
)
|
|
48
54
|
end
|
|
49
55
|
end
|
|
50
56
|
|
data/lib/typecast/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: typecast-ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Neosapience
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-06-
|
|
11
|
+
date: 2026-06-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: minitest
|