claude-ruby 0.4.2 → 0.4.3
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/CHANGELOG.md +6 -0
- data/Gemfile.lock +6 -4
- data/README.md +8 -26
- data/lib/claude/client.rb +16 -8
- data/lib/claude/ruby/version.rb +1 -1
- data/sig/claude/client.rbs +0 -1
- metadata +10 -12
- data/claude-ruby.gemspec +0 -42
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b84b1d8c31e49380d6474c7cf30f581b51846158095feb37723e81470fa64ad3
|
|
4
|
+
data.tar.gz: fca20c7c2d90146cfe649c2e39fa77596d711805b9a4c84a83acc96d9e582fbf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1fa9f80289403fa0ca5112a51b646d96f162249c9b18c6e3cc32882469f6e7b76873e446deadf0149d6f638e751b1e36cedb3f6ac93961652bfbb24541d34ffd
|
|
7
|
+
data.tar.gz: 263f6b26c84aaaf8a28de3785cf5a62d762de5aecc04b17642258dbf1f1ca49e35ec8f99ac5b72e29f3b31f622fff1a33dcab7188179d64c2d0c2822575f0ee3
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## [0.4.3] - 2026-12-04
|
|
2
|
+
- Corrected the deprecation notices to name the official `anthropic` gem and marked this client as deprecated in its RubyGems summary.
|
|
3
|
+
- Disabled redirects on authenticated requests, restricted response parsing to JSON, and hid the API key from client inspection.
|
|
4
|
+
- Reject custom endpoint options that earlier versions silently ignored. The default Anthropic endpoint is unchanged.
|
|
5
|
+
- Raised the minimum HTTParty version to 0.24.0.
|
|
6
|
+
|
|
1
7
|
## [0.4.2] - 2026-01-19
|
|
2
8
|
- Added deprecation warning
|
|
3
9
|
|
data/Gemfile.lock
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
claude-ruby (0.4.
|
|
5
|
-
httparty
|
|
4
|
+
claude-ruby (0.4.3)
|
|
5
|
+
httparty (>= 0.24.0)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
9
9
|
specs:
|
|
10
10
|
ast (2.4.2)
|
|
11
|
+
csv (3.3.7)
|
|
11
12
|
docile (1.4.0)
|
|
12
|
-
httparty (0.
|
|
13
|
+
httparty (0.25.1)
|
|
14
|
+
csv
|
|
13
15
|
mini_mime (>= 1.0.0)
|
|
14
16
|
multi_xml (>= 0.5.2)
|
|
15
17
|
json (2.7.1)
|
|
@@ -25,7 +27,7 @@ GEM
|
|
|
25
27
|
rainbow (3.1.1)
|
|
26
28
|
rake (13.1.0)
|
|
27
29
|
regexp_parser (2.9.0)
|
|
28
|
-
rexml (3.
|
|
30
|
+
rexml (3.4.4)
|
|
29
31
|
rubocop (1.62.0)
|
|
30
32
|
json (~> 2.3)
|
|
31
33
|
language_server-protocol (>= 3.17.0)
|
data/README.md
CHANGED
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
> [!CAUTION]
|
|
4
4
|
> **This gem is deprecated and no longer maintained.**
|
|
5
5
|
>
|
|
6
|
-
>
|
|
7
|
-
>
|
|
8
|
-
> Please migrate to the official gem for the latest features, models, and ongoing support.
|
|
6
|
+
> For new development, use Anthropic's official [`anthropic` gem](https://rubygems.org/gems/anthropic).
|
|
9
7
|
|
|
10
8
|
---
|
|
11
9
|
|
|
@@ -13,27 +11,17 @@
|
|
|
13
11
|
|
|
14
12
|
`claude-ruby` gem is an unofficial ruby SDK for interacting with the Anthropic API, for generating and streaming messages through Claude
|
|
15
13
|
|
|
16
|
-
##
|
|
17
|
-
|
|
18
|
-
Add this line to your application's Gemfile:
|
|
19
|
-
|
|
20
|
-
```ruby
|
|
21
|
-
gem 'claude-ruby'
|
|
22
|
-
```
|
|
14
|
+
## Migrating to the official SDK
|
|
23
15
|
|
|
24
|
-
|
|
16
|
+
Install it with `gem install anthropic` or use this entry in your Gemfile.
|
|
25
17
|
|
|
26
18
|
```ruby
|
|
27
|
-
|
|
19
|
+
gem 'anthropic'
|
|
28
20
|
```
|
|
29
21
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
```ruby
|
|
33
|
-
$ gem install claude-ruby
|
|
34
|
-
```
|
|
22
|
+
Existing applications also need to update their client calls. The official SDK uses `require 'anthropic'` and `Anthropic::Client`. See [Anthropic's Ruby SDK examples](https://github.com/anthropics/anthropic-sdk-ruby#getting-started).
|
|
35
23
|
|
|
36
|
-
##
|
|
24
|
+
## Legacy client usage
|
|
37
25
|
|
|
38
26
|
To use this gem you'll need an API key from Anthropic, which can be obtained from the Anthropic console
|
|
39
27
|
by following the Get API Access link on the [Anthropic API page](https://www.anthropic.com/api).
|
|
@@ -219,13 +207,7 @@ response = claude_client.messages(messages,
|
|
|
219
207
|
|
|
220
208
|
## Custom endpoint
|
|
221
209
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
You can optionally optionally override this - e.g. for testing, or for using a beta endpoint.
|
|
225
|
-
|
|
226
|
-
```ruby
|
|
227
|
-
claude_client = Claude::Client.new(api_key, endpoint: 'your-custom-endpoint')
|
|
228
|
-
```
|
|
210
|
+
The legacy client sends requests to `https://api.anthropic.com/v1/messages`. Earlier versions accepted a custom `endpoint:` option but still sent requests to Anthropic. Version 0.4.3 raises an error when given a different endpoint, before sending a request.
|
|
229
211
|
|
|
230
212
|
## Vision
|
|
231
213
|
|
|
@@ -289,4 +271,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
|
289
271
|
## Trademarks
|
|
290
272
|
|
|
291
273
|
This is an unofficial gem which has not been developed by Anthropic.
|
|
292
|
-
We make no claims for the trademarks of 'Anthropic' and 'Claude', which are registered by Anthropic PBC.
|
|
274
|
+
We make no claims for the trademarks of 'Anthropic' and 'Claude', which are registered by Anthropic PBC.
|
data/lib/claude/client.rb
CHANGED
|
@@ -3,7 +3,7 @@ require 'json'
|
|
|
3
3
|
|
|
4
4
|
warn <<~DEPRECATION
|
|
5
5
|
[DEPRECATION WARNING] The 'claude-ruby' gem is deprecated and no longer maintained.
|
|
6
|
-
Please switch to the official Anthropic Ruby SDK: gem install anthropic
|
|
6
|
+
Please switch to the official Anthropic Ruby SDK: gem install anthropic
|
|
7
7
|
More info: https://github.com/anthropics/anthropic-sdk-ruby
|
|
8
8
|
DEPRECATION
|
|
9
9
|
|
|
@@ -34,10 +34,17 @@ module Claude
|
|
|
34
34
|
|
|
35
35
|
def initialize(api_key, endpoint: nil, timeout: 60)
|
|
36
36
|
@api_key = api_key
|
|
37
|
-
@endpoint = endpoint || anthropic_endpoint
|
|
38
37
|
@timeout = timeout
|
|
39
38
|
|
|
40
39
|
raise(ArgumentError, "api_key is required") if api_key.nil?
|
|
40
|
+
|
|
41
|
+
unless endpoint.nil? || [anthropic_endpoint, messages_endpoint].include?(endpoint.to_s.delete_suffix('/'))
|
|
42
|
+
raise ArgumentError, "Custom endpoints are unsupported. Use the official anthropic gem for a custom endpoint."
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def inspect
|
|
47
|
+
"#<#{self.class}>"
|
|
41
48
|
end
|
|
42
49
|
|
|
43
50
|
def version
|
|
@@ -113,12 +120,13 @@ module Claude
|
|
|
113
120
|
private
|
|
114
121
|
|
|
115
122
|
def post_api(url, data, timeout)
|
|
116
|
-
response = HTTParty.post(url, body: data.to_json, headers: headers, timeout: timeout)
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
123
|
+
response = HTTParty.post(url, body: data.to_json, headers: headers, timeout: timeout, follow_redirects: false)
|
|
124
|
+
raise "Refusing HTTP redirect (#{response.code}) from the Anthropic API" if (300..399).cover?(response.code)
|
|
125
|
+
|
|
126
|
+
payload = JSON.parse(response.body)
|
|
127
|
+
raise "#{payload['error']['type']}: #{payload['error']['message']}" if payload.is_a?(Hash) && payload['type'] == 'error'
|
|
128
|
+
|
|
129
|
+
payload
|
|
122
130
|
end
|
|
123
131
|
end
|
|
124
132
|
end
|
data/lib/claude/ruby/version.rb
CHANGED
data/sig/claude/client.rbs
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: claude-ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Web Ventures Ltd
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: httparty
|
|
@@ -16,16 +15,16 @@ dependencies:
|
|
|
16
15
|
requirements:
|
|
17
16
|
- - ">="
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
18
|
+
version: 0.24.0
|
|
20
19
|
type: :runtime
|
|
21
20
|
prerelease: false
|
|
22
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
22
|
requirements:
|
|
24
23
|
- - ">="
|
|
25
24
|
- !ruby/object:Gem::Version
|
|
26
|
-
version:
|
|
27
|
-
description: Ruby
|
|
28
|
-
|
|
25
|
+
version: 0.24.0
|
|
26
|
+
description: This unofficial Ruby client for the Anthropic API is retired. For new
|
|
27
|
+
development, install the 'anthropic' gem.
|
|
29
28
|
email:
|
|
30
29
|
- gems@dev.webven.nz
|
|
31
30
|
executables: []
|
|
@@ -38,7 +37,6 @@ files:
|
|
|
38
37
|
- LICENSE.txt
|
|
39
38
|
- README.md
|
|
40
39
|
- Rakefile
|
|
41
|
-
- claude-ruby.gemspec
|
|
42
40
|
- lib/claude/client.rb
|
|
43
41
|
- lib/claude/ruby.rb
|
|
44
42
|
- lib/claude/ruby/version.rb
|
|
@@ -56,7 +54,7 @@ post_install_message: |
|
|
|
56
54
|
DEPRECATION NOTICE: The 'claude-ruby' gem is deprecated.
|
|
57
55
|
|
|
58
56
|
Anthropic now provides an official Ruby SDK. Please migrate to:
|
|
59
|
-
gem install anthropic
|
|
57
|
+
gem install anthropic
|
|
60
58
|
|
|
61
59
|
More info: https://github.com/anthropics/anthropic-sdk-ruby
|
|
62
60
|
======================================================================
|
|
@@ -74,8 +72,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
74
72
|
- !ruby/object:Gem::Version
|
|
75
73
|
version: '0'
|
|
76
74
|
requirements: []
|
|
77
|
-
rubygems_version: 3.
|
|
78
|
-
signing_key:
|
|
75
|
+
rubygems_version: 3.6.9
|
|
79
76
|
specification_version: 4
|
|
80
|
-
summary:
|
|
77
|
+
summary: Deprecated unofficial Claude client. Use Anthropic's official 'anthropic'
|
|
78
|
+
gem.
|
|
81
79
|
test_files: []
|
data/claude-ruby.gemspec
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative "lib/claude/ruby/version"
|
|
4
|
-
|
|
5
|
-
Gem::Specification.new do |spec|
|
|
6
|
-
spec.name = "claude-ruby"
|
|
7
|
-
spec.version = Claude::Ruby::VERSION
|
|
8
|
-
spec.authors = ["Web Ventures Ltd"]
|
|
9
|
-
spec.email = ["gems@dev.webven.nz"]
|
|
10
|
-
|
|
11
|
-
spec.summary = 'A Ruby SDK for the Anthropic Claude API'
|
|
12
|
-
spec.description = 'Ruby SDK for interacting with the Anthropic API, for generating and streaming messages through Claude AI.'
|
|
13
|
-
spec.homepage = "https://github.com/webventures/claude-ruby.git"
|
|
14
|
-
spec.license = "MIT"
|
|
15
|
-
spec.required_ruby_version = ">= 3.0.0"
|
|
16
|
-
|
|
17
|
-
spec.metadata["homepage_uri"] = spec.homepage
|
|
18
|
-
spec.metadata["source_code_uri"] = "https://github.com/webventures/claude-ruby.git"
|
|
19
|
-
spec.metadata["changelog_uri"] = "https://github.com/webventures/claude-ruby/blob/main/CHANGELOG.md"
|
|
20
|
-
|
|
21
|
-
spec.post_install_message = <<~MSG
|
|
22
|
-
======================================================================
|
|
23
|
-
DEPRECATION NOTICE: The 'claude-ruby' gem is deprecated.
|
|
24
|
-
|
|
25
|
-
Anthropic now provides an official Ruby SDK. Please migrate to:
|
|
26
|
-
gem install anthropic-sdk-ruby
|
|
27
|
-
|
|
28
|
-
More info: https://github.com/anthropics/anthropic-sdk-ruby
|
|
29
|
-
======================================================================
|
|
30
|
-
MSG
|
|
31
|
-
|
|
32
|
-
spec.files = Dir.chdir(__dir__) do
|
|
33
|
-
`git ls-files -z`.split("\x0").reject do |f|
|
|
34
|
-
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
spec.bindir = "exe"
|
|
38
|
-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
|
39
|
-
spec.require_paths = ["lib"]
|
|
40
|
-
|
|
41
|
-
spec.add_dependency 'httparty'
|
|
42
|
-
end
|