Skip to content

Commit 51d177f

Browse files
refactor: rename RECLAIM_TOKEN to RECLAIM_API_KEY
Make the environment variable name more intuitive and aligned with common API key naming conventions. Changes: - lib/reclaim/client.rb: Update ENV variable and error message - lib/reclaim.rb: Update environment variable comment - README.md: Update all documentation references - test/test_reclaim.rb: Update all test references 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent ca95411 commit 51d177f

File tree

4 files changed

+28
-28
lines changed

4 files changed

+28
-28
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ gem 'reclaim'
3535
Set your Reclaim.ai API token as an environment variable:
3636

3737
```bash
38-
export RECLAIM_TOKEN='your_api_token_here'
38+
export RECLAIM_API_KEY='your_api_token_here'
3939
```
4040

4141
Get your API token from your [Reclaim.ai settings](https://app.reclaim.ai/settings/developer).
@@ -46,7 +46,7 @@ If you have the `dotenv` gem installed, the library will automatically load envi
4646

4747
```bash
4848
# .env
49-
RECLAIM_TOKEN='your_api_token_here'
49+
RECLAIM_API_KEY='your_api_token_here'
5050
```
5151

5252
**For users of this gem**: If you're using reclaim-ruby as a library in your own project and want .env file support, add dotenv to your project's Gemfile:
@@ -66,7 +66,7 @@ gem 'dotenv', '~> 2.8'
6666
```ruby
6767
require 'reclaim'
6868

69-
# Initialize client (uses ENV['RECLAIM_TOKEN'] by default)
69+
# Initialize client (uses ENV['RECLAIM_API_KEY'] by default)
7070
client = Reclaim::Client.new
7171

7272
# Or pass token explicitly
@@ -286,7 +286,7 @@ bundle install
286286
# Run unit tests only (no API calls)
287287
SKIP_INTEGRATION_TESTS=true bundle exec rake test
288288

289-
# Run all tests (requires RECLAIM_TOKEN)
289+
# Run all tests (requires RECLAIM_API_KEY)
290290
bundle exec rake test
291291

292292
# Run only integration tests
@@ -308,7 +308,7 @@ Main client for API interactions.
308308

309309
**Methods:**
310310

311-
- `initialize(token = nil)` - Create client (uses ENV['RECLAIM_TOKEN'] if token not provided)
311+
- `initialize(token = nil)` - Create client (uses ENV['RECLAIM_API_KEY'] if token not provided)
312312
- `create_task(**options)` - Create a new task
313313
- `list_tasks(filter: nil)` - List all tasks (filter: :active, :completed, :overdue, or nil)
314314
- `get_task(task_id)` - Get a specific task by ID

lib/reclaim.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# time scheme resolution, and caching.
88
#
99
# Environment Variables:
10-
# RECLAIM_TOKEN - Your Reclaim API token
10+
# RECLAIM_API_KEY - Your Reclaim API token
1111
#
1212
# Usage:
1313
# require 'reclaim'

lib/reclaim/client.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ class Client
1111
BASE_URL = 'https://api.app.reclaim.ai/api'
1212

1313
def initialize(token = nil)
14-
@token = token || ENV['RECLAIM_TOKEN']
15-
raise AuthenticationError, 'RECLAIM_TOKEN environment variable not set' unless @token
14+
@token = token || ENV['RECLAIM_API_KEY']
15+
raise AuthenticationError, 'RECLAIM_API_KEY environment variable not set' unless @token
1616

1717
@time_schemes_cache = nil
1818
end

test/test_reclaim.rb

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,13 @@ def test_task_to_hash
122122
class TestReclaimClient < Minitest::Test
123123
def setup
124124
# Set a test token for unit tests
125-
@original_token = ENV['RECLAIM_TOKEN']
126-
ENV['RECLAIM_TOKEN'] = 'test_token_12345'
125+
@original_token = ENV['RECLAIM_API_KEY']
126+
ENV['RECLAIM_API_KEY'] = 'test_token_12345'
127127
@client = Reclaim::Client.new
128128
end
129129

130130
def teardown
131-
ENV['RECLAIM_TOKEN'] = @original_token
131+
ENV['RECLAIM_API_KEY'] = @original_token
132132
end
133133

134134
def test_client_initialization_with_token
@@ -137,17 +137,17 @@ def test_client_initialization_with_token
137137
end
138138

139139
def test_client_initialization_without_token
140-
ENV['RECLAIM_TOKEN'] = nil
140+
ENV['RECLAIM_API_KEY'] = nil
141141

142142
error = assert_raises(Reclaim::AuthenticationError) do
143143
Reclaim::Client.new
144144
end
145145

146-
assert_equal 'RECLAIM_TOKEN environment variable not set', error.message
146+
assert_equal 'RECLAIM_API_KEY environment variable not set', error.message
147147
end
148148

149149
def test_client_initialization_with_env_token
150-
ENV['RECLAIM_TOKEN'] = 'env_token_test'
150+
ENV['RECLAIM_API_KEY'] = 'env_token_test'
151151
client = Reclaim::Client.new
152152

153153
assert_instance_of Reclaim::Client, client
@@ -408,9 +408,9 @@ def setup
408408
end
409409

410410
# Validate we have a real API token
411-
token = ENV['RECLAIM_TOKEN']
411+
token = ENV['RECLAIM_API_KEY']
412412
if !token || token == 'test_token_12345'
413-
skip "Real RECLAIM_TOKEN required for integration tests"
413+
skip "Real RECLAIM_API_KEY required for integration tests"
414414
end
415415

416416
@client = Reclaim::Client.new(token)
@@ -655,14 +655,14 @@ def setup
655655
@original_argv = ARGV.dup
656656

657657
# Mock environment variable for tests
658-
@original_token = ENV['RECLAIM_TOKEN']
659-
ENV['RECLAIM_TOKEN'] = 'test_token_for_cli_tests'
658+
@original_token = ENV['RECLAIM_API_KEY']
659+
ENV['RECLAIM_API_KEY'] = 'test_token_for_cli_tests'
660660
end
661661

662662
def teardown
663663
# Restore original ARGV and environment
664664
ARGV.replace(@original_argv)
665-
ENV['RECLAIM_TOKEN'] = @original_token
665+
ENV['RECLAIM_API_KEY'] = @original_token
666666
end
667667

668668
def test_default_command_and_filter_logic
@@ -891,12 +891,12 @@ def capture_io
891891

892892
class TestReclaimEnv < Minitest::Test
893893
def setup
894-
@original_token = ENV['RECLAIM_TOKEN']
894+
@original_token = ENV['RECLAIM_API_KEY']
895895
@original_load_path = $LOAD_PATH.dup
896896
end
897897

898898
def teardown
899-
ENV['RECLAIM_TOKEN'] = @original_token
899+
ENV['RECLAIM_API_KEY'] = @original_token
900900
$LOAD_PATH.replace(@original_load_path)
901901
end
902902

@@ -964,13 +964,13 @@ def test_integration_env_loading_on_require
964964

965965
begin
966966
FileUtils.mkdir_p(test_project_dir)
967-
File.write(env_file, "RECLAIM_TOKEN=integration_test_token\n")
967+
File.write(env_file, "RECLAIM_API_KEY=integration_test_token\n")
968968

969-
# Run in subprocess with clean environment (unset RECLAIM_TOKEN)
969+
# Run in subprocess with clean environment (unset RECLAIM_API_KEY)
970970
lib_path = File.expand_path('../../lib', __FILE__)
971971
result = Dir.chdir(test_project_dir) do
972-
# Use env to unset RECLAIM_TOKEN before running ruby
973-
`env -u RECLAIM_TOKEN ruby -I#{lib_path} -e "require 'reclaim'; puts ENV['RECLAIM_TOKEN']" 2>&1`
972+
# Use env to unset RECLAIM_API_KEY before running ruby
973+
`env -u RECLAIM_API_KEY ruby -I#{lib_path} -e "require 'reclaim'; puts ENV['RECLAIM_API_KEY']" 2>&1`
974974
end
975975

976976
# Verify the .env file was loaded
@@ -1018,14 +1018,14 @@ def test_graceful_fallback_without_dotenv
10181018
end
10191019

10201020
def test_reclaim_token_from_environment
1021-
# Verify that RECLAIM_TOKEN can be set and used
1022-
ENV['RECLAIM_TOKEN'] = 'test_token_value'
1021+
# Verify that RECLAIM_API_KEY can be set and used
1022+
ENV['RECLAIM_API_KEY'] = 'test_token_value'
10231023

10241024
client = Reclaim::Client.new
10251025
assert_equal 'test_token_value', client.instance_variable_get(:@token)
10261026

10271027
# Clean up
1028-
ENV['RECLAIM_TOKEN'] = @original_token
1028+
ENV['RECLAIM_API_KEY'] = @original_token
10291029
end
10301030
end
10311031

0 commit comments

Comments
 (0)