algolia / algolia/algoliasearch-client-ruby
`get_objects` fails when passing in `attributesToRetrieve`
- Dominant language
- Ruby
- Stars
- 172
- Forks
- 73
- PR merge metrics
- No merged PRs in 30d
Description
- Algolia Client Version: algolia (2.2.2)
- Language Version: ruby 2.6.5p114 (2019-10-01 revision 67812) [-darwin21]
### Description
When passing in `attributesToRetrieve ` to `get_objects` we receive an http error stating that `attributesToRetrieve` is an invalid key. We traced the issue back to the call made to the Algolia API here: https://github.com/algolia/algoliasearch-client-ruby/blob/5e7c715a596ac5e01064a16e9f46d3aaa825850b/lib/algolia/search_index.rb#L213
We tested that if we pass in `request_options` instead `opts` the call works as documented.
### Steps To Reproduce
```
search_config = Algolia::Search::Config.new(
application_id: 'app_id', api_key: 'api_key', symbolize_keys: false,
)
client = Algolia::Search::Client.new(search_config, { logger: Rails.logger })
index = client.init_index('my_index')
index.get_objects(['1'], { attributesToRetrieve: ["id"] })
# Fails with invalid key 'attributesToRetrieve'. Expected: appID, apiKey, requests (near 1:121)
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with lib/algolia/search_index.rb at the get_objects call linked in the issue, then reproduce the request using attributesToRetrieve from the provided Ruby example. Trace how opts and request_options are passed to the Algolia API; done means get_objects accepts attributesToRetrieve without the invalid-key HTTP error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100