algolia 3.34.3 → 3.34.4
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/.github/workflows/release.yml +1 -1
- data/AGENTS.md +182 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/lib/algolia/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 03d6bce34fbba23cd559298792898bbc4d1e3a3b68a57a842192dc6fc0334e2c
|
|
4
|
+
data.tar.gz: 9d30d5f50c4ece4c836738ef426988ebf7362dde85a4e544aba968ea96cd6a8b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b02665f3d715e8e109304d231009c8b1d4c53704b6f5ca74f359182ba5c0ac99b6a07305080f50f396e8ea6e39a29b6f9f27b8acf62713674ee1a866c15583b5
|
|
7
|
+
data.tar.gz: df7b681f76666269eeebb9e8092e17bea31add145e059d79b8ffcbbcd87787e4259d6f8eb4340c1f55d9c16aa8fe4290487f139bd26fb4add962df28a9474121
|
data/AGENTS.md
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
# RUBY CLIENT - AI AGENT INSTRUCTIONS
|
|
2
|
+
|
|
3
|
+
## ⚠️ CRITICAL: CHECK YOUR REPOSITORY FIRST
|
|
4
|
+
|
|
5
|
+
Before making ANY changes, verify you're in the correct repository:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
git remote -v
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
- ✅ **CORRECT**: `origin .../algolia/api-clients-automation.git` → You may proceed
|
|
12
|
+
- ❌ **WRONG**: `origin .../algolia/algoliasearch-client-ruby.git` → STOP! This is the PUBLIC repository
|
|
13
|
+
|
|
14
|
+
**If you're in `algoliasearch-client-ruby`**: Do NOT make changes here. All changes must go through `api-clients-automation`. PRs and commits made directly to the public repo will be discarded on next release.
|
|
15
|
+
|
|
16
|
+
## ⚠️ BEFORE ANY EDIT: Check If File Is Generated
|
|
17
|
+
|
|
18
|
+
Before editing ANY file, verify it's hand-written by checking `config/generation.config.mjs`:
|
|
19
|
+
|
|
20
|
+
```javascript
|
|
21
|
+
// In generation.config.mjs - patterns WITHOUT '!' are GENERATED (do not edit)
|
|
22
|
+
'clients/algoliasearch-client-ruby/lib/algolia/**', // Generated
|
|
23
|
+
'!clients/algoliasearch-client-ruby/lib/algolia/transport/**', // Hand-written ✓
|
|
24
|
+
'!clients/algoliasearch-client-ruby/lib/algolia/error.rb', // Hand-written ✓
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**Hand-written (safe to edit):**
|
|
28
|
+
|
|
29
|
+
- `lib/algolia/transport/**` - Transport, retry strategy, HTTP handling
|
|
30
|
+
- `lib/algolia/api_client.rb` - Core API client
|
|
31
|
+
- `lib/algolia/api_error.rb` - API error class
|
|
32
|
+
- `lib/algolia/configuration.rb` - Configuration
|
|
33
|
+
- `lib/algolia/error.rb` - Error base class
|
|
34
|
+
- `lib/algolia/logger_helper.rb` - Logging utilities
|
|
35
|
+
- `lib/algolia/user_agent.rb` - User agent handling
|
|
36
|
+
|
|
37
|
+
**Generated (DO NOT EDIT):**
|
|
38
|
+
|
|
39
|
+
- `lib/algolia/api/**` - API client classes
|
|
40
|
+
- `lib/algolia/models/**` - API models
|
|
41
|
+
- `Gemfile.lock`, `version.rb`
|
|
42
|
+
|
|
43
|
+
## Language Conventions
|
|
44
|
+
|
|
45
|
+
### Naming
|
|
46
|
+
|
|
47
|
+
- **Files**: `snake_case.rb`
|
|
48
|
+
- **Classes/Modules**: `PascalCase`
|
|
49
|
+
- **Methods/Variables**: `snake_case`
|
|
50
|
+
- **Constants**: `UPPER_SNAKE_CASE`
|
|
51
|
+
- **Predicates**: `method_name?` (returns boolean)
|
|
52
|
+
- **Dangerous methods**: `method_name!` (mutates or raises)
|
|
53
|
+
|
|
54
|
+
### Formatting
|
|
55
|
+
|
|
56
|
+
- RubyFmt for formatting
|
|
57
|
+
- Run: `yarn cli format ruby clients/algoliasearch-client-ruby`
|
|
58
|
+
|
|
59
|
+
### Ruby Idioms
|
|
60
|
+
|
|
61
|
+
- Use `attr_reader`, `attr_accessor` for accessors
|
|
62
|
+
- Prefer `||=` for memoization
|
|
63
|
+
- Use `&.` safe navigation operator
|
|
64
|
+
- Blocks over lambdas for callbacks
|
|
65
|
+
|
|
66
|
+
### Dependencies
|
|
67
|
+
|
|
68
|
+
- **HTTP**: Faraday (with Net::HTTP adapter)
|
|
69
|
+
- **Build**: Bundler + gemspec
|
|
70
|
+
- **Versions**: Ruby 3.4+
|
|
71
|
+
|
|
72
|
+
## Client Patterns
|
|
73
|
+
|
|
74
|
+
### Transport Architecture
|
|
75
|
+
|
|
76
|
+
```ruby
|
|
77
|
+
# lib/algolia/transport/
|
|
78
|
+
class Transport
|
|
79
|
+
def initialize(config)
|
|
80
|
+
@http_requester = HttpRequester.new(config.app_id, config.api_key)
|
|
81
|
+
@retry_strategy = RetryStrategy.new(config.hosts)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def request(method, path, body, opts)
|
|
85
|
+
# Retry with host failover
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Retry Strategy
|
|
91
|
+
|
|
92
|
+
```ruby
|
|
93
|
+
# lib/algolia/transport/retry_strategy.rb
|
|
94
|
+
class RetryStrategy
|
|
95
|
+
# Host states: :up, :down, :timed_out
|
|
96
|
+
# Retries on network errors
|
|
97
|
+
# 4xx errors not retried
|
|
98
|
+
end
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Configuration
|
|
102
|
+
|
|
103
|
+
```ruby
|
|
104
|
+
# Configuration object pattern
|
|
105
|
+
config = Algolia::Configuration.new(
|
|
106
|
+
app_id: 'APP_ID',
|
|
107
|
+
api_key: 'API_KEY',
|
|
108
|
+
hosts: [...],
|
|
109
|
+
read_timeout: 5,
|
|
110
|
+
write_timeout: 30
|
|
111
|
+
)
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Common Gotchas
|
|
115
|
+
|
|
116
|
+
### Symbol vs String Keys
|
|
117
|
+
|
|
118
|
+
```ruby
|
|
119
|
+
# API returns string keys, use with_indifferent_access or symbols
|
|
120
|
+
response[:hits] # May not work
|
|
121
|
+
response['hits'] # Works
|
|
122
|
+
response.hits # Works if using model objects
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Block Syntax
|
|
126
|
+
|
|
127
|
+
```ruby
|
|
128
|
+
# Use do..end for multi-line, braces for single-line
|
|
129
|
+
client.search { |r| r.query = 'test' }
|
|
130
|
+
|
|
131
|
+
client.search do |params|
|
|
132
|
+
params.query = 'test'
|
|
133
|
+
params.hits_per_page = 10
|
|
134
|
+
end
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Error Handling
|
|
138
|
+
|
|
139
|
+
```ruby
|
|
140
|
+
begin
|
|
141
|
+
response = client.search(params)
|
|
142
|
+
rescue Algolia::AlgoliaError => e
|
|
143
|
+
# Base error class
|
|
144
|
+
rescue Algolia::ApiError => e
|
|
145
|
+
# API returned error
|
|
146
|
+
puts e.status_code
|
|
147
|
+
puts e.message
|
|
148
|
+
end
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Nil Safety
|
|
152
|
+
|
|
153
|
+
```ruby
|
|
154
|
+
# Use safe navigation
|
|
155
|
+
result&.hits&.first&.object_id
|
|
156
|
+
|
|
157
|
+
# Or explicit checks
|
|
158
|
+
if result && result.hits && result.hits.any?
|
|
159
|
+
result.hits.first.object_id
|
|
160
|
+
end
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Deprecated Operations
|
|
164
|
+
|
|
165
|
+
Some operations in `ingestion_client.rb` and `search_client.rb` are deprecated. Check method documentation before use.
|
|
166
|
+
|
|
167
|
+
## Build & Test Commands
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
# From repo root (api-clients-automation)
|
|
171
|
+
yarn cli build clients ruby # Build Ruby client
|
|
172
|
+
yarn cli cts generate ruby # Generate CTS tests
|
|
173
|
+
yarn cli cts run ruby # Run CTS tests
|
|
174
|
+
yarn cli playground ruby search # Interactive playground
|
|
175
|
+
yarn cli format ruby clients/algoliasearch-client-ruby
|
|
176
|
+
|
|
177
|
+
# From client directory
|
|
178
|
+
cd clients/algoliasearch-client-ruby
|
|
179
|
+
bundle install # Install dependencies
|
|
180
|
+
bundle exec rake test # Run tests
|
|
181
|
+
bundle exec rubocop # Run linter
|
|
182
|
+
```
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
## [3.34.4](https://github.com/algolia/algoliasearch-client-ruby/compare/3.34.3...3.34.4)
|
|
2
|
+
|
|
3
|
+
- [f02ab6fa0](https://github.com/algolia/api-clients-automation/commit/f02ab6fa0) chore: agentic config prep ([#5825](https://github.com/algolia/api-clients-automation/pull/5825)) by [@Fluf22](https://github.com/Fluf22/)
|
|
4
|
+
|
|
1
5
|
## [3.34.3](https://github.com/algolia/algoliasearch-client-ruby/compare/3.34.2...3.34.3)
|
|
2
6
|
|
|
3
7
|
- [cd7a174b4](https://github.com/algolia/api-clients-automation/commit/cd7a174b4) fix(specs): BREAKING CHANGE — remove fields requirement from run response in CompAPI client ([#5809](https://github.com/algolia/api-clients-automation/pull/5809)) by [@ClaraMuller](https://github.com/ClaraMuller/)\
|
data/Gemfile.lock
CHANGED
data/lib/algolia/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: algolia
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.34.
|
|
4
|
+
version: 3.34.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- https://alg.li/support
|
|
@@ -121,6 +121,7 @@ files:
|
|
|
121
121
|
- ".github/workflows/issue.yml"
|
|
122
122
|
- ".github/workflows/release.yml"
|
|
123
123
|
- ".gitignore"
|
|
124
|
+
- AGENTS.md
|
|
124
125
|
- CHANGELOG.md
|
|
125
126
|
- Gemfile
|
|
126
127
|
- Gemfile.lock
|