typecast-ruby 0.1.7 → 0.1.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 +4 -4
- data/lib/typecast/client.rb +12 -2
- data/lib/typecast/version.rb +1 -1
- metadata +17 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6f13e3b3f4318a0a02d9e6f4a0ae42aedbd260a422dbb8cdd1cac83954b00c4c
|
|
4
|
+
data.tar.gz: 47db73ac6a78270f0bf13c3c04569fe4ff471211b3cd579cc33b85e15c468816
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ab36553b84e5ec6ee14c7988d2970945e170252f142a6d6e5d8853b2caf171ea87d5c93aa7124cab0b54d9bdcfb6ce3887dd2d9f4ea5e57ff65d882cb45985f8
|
|
7
|
+
data.tar.gz: 193f865fdfd38e7dbe2d5faba6c1288bea4f0665516ea559e15c1079b962726a57214d67589059528699b7f23069fffab1527750e788436423b3d1b51310d37b
|
data/lib/typecast/client.rb
CHANGED
|
@@ -16,12 +16,13 @@ module Typecast
|
|
|
16
16
|
|
|
17
17
|
attr_reader :api_key, :base_url
|
|
18
18
|
|
|
19
|
-
def initialize(api_key: ENV["TYPECAST_API_KEY"], base_url: ENV["TYPECAST_API_HOST"] || DEFAULT_BASE_URL, open_timeout: 10, read_timeout: 30)
|
|
19
|
+
def initialize(api_key: ENV["TYPECAST_API_KEY"], base_url: ENV["TYPECAST_API_HOST"] || DEFAULT_BASE_URL, open_timeout: 10, read_timeout: 30, source: nil, generated_by: nil)
|
|
20
20
|
@api_key = api_key.to_s.strip
|
|
21
21
|
@base_url = normalize_base_url(base_url)
|
|
22
22
|
validate_api_key!
|
|
23
23
|
@open_timeout = open_timeout
|
|
24
24
|
@read_timeout = read_timeout
|
|
25
|
+
@attribution = attribution_suffix(source, generated_by)
|
|
25
26
|
end
|
|
26
27
|
|
|
27
28
|
def text_to_speech(request)
|
|
@@ -190,7 +191,16 @@ module Typecast
|
|
|
190
191
|
base = default_base_url? ? "default" : "custom"
|
|
191
192
|
timeout = @read_timeout == 30 ? "default" : "#{@read_timeout}s"
|
|
192
193
|
"typecast-ruby/#{VERSION} Ruby/#{RUBY_VERSION} net-http " \
|
|
193
|
-
"(base=#{base}; timeout=#{timeout}; os=#{os_name}; arch=#{arch_name}; sdk_env=ruby; platform=server)"
|
|
194
|
+
"(base=#{base}; timeout=#{timeout}; os=#{os_name}; arch=#{arch_name}; sdk_env=ruby; platform=server)#{@attribution}"
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
def attribution_suffix(source, generated_by)
|
|
198
|
+
return "" if source.nil? && generated_by.nil?
|
|
199
|
+
unless %w[llms skill].include?(source) && generated_by&.match?(/\A[a-z0-9][a-z0-9._-]{0,31}\z/)
|
|
200
|
+
raise ArgumentError, "source (llms or skill) and generated_by must be valid and provided together"
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
" typecast-integration/1 (source=#{source}; generated_by=#{generated_by})"
|
|
194
204
|
end
|
|
195
205
|
|
|
196
206
|
def os_name
|
data/lib/typecast/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,15 +1,28 @@
|
|
|
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.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Neosapience
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: base64
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '0'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - ">="
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '0'
|
|
13
26
|
- !ruby/object:Gem::Dependency
|
|
14
27
|
name: minitest
|
|
15
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -60,7 +73,6 @@ homepage: https://github.com/neosapience/typecast-sdk/tree/main/typecast-ruby
|
|
|
60
73
|
licenses:
|
|
61
74
|
- MIT
|
|
62
75
|
metadata: {}
|
|
63
|
-
post_install_message:
|
|
64
76
|
rdoc_options: []
|
|
65
77
|
require_paths:
|
|
66
78
|
- lib
|
|
@@ -75,8 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
75
87
|
- !ruby/object:Gem::Version
|
|
76
88
|
version: '0'
|
|
77
89
|
requirements: []
|
|
78
|
-
rubygems_version:
|
|
79
|
-
signing_key:
|
|
90
|
+
rubygems_version: 4.0.16
|
|
80
91
|
specification_version: 4
|
|
81
92
|
summary: Official Ruby SDK for the Typecast Text-to-Speech API
|
|
82
93
|
test_files: []
|