Skip to content

Commit bd0724d

Browse files
chore: generated code for commit 47dd4bb5. [skip ci]
algolia/api-clients-automation@47dd4bb Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Clément Vannicatte <[email protected]>
1 parent d81c5dc commit bd0724d

File tree

2 files changed

+62
-4
lines changed

2 files changed

+62
-4
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ For full documentation, visit the **[Algolia Ruby API Client](https://www.algoli
5151

5252
## ❓ Troubleshooting
5353

54-
Encountering an issue? Before reaching out to support, we recommend heading to our [FAQ](https://www.algolia.com/doc/api-client/troubleshooting/faq/ruby/) where you will find answers for the most common issues and gotchas with the client.
54+
Encountering an issue? Before reaching out to support, we recommend heading to our [FAQ](https://www.algolia.com/doc/api-client/troubleshooting/faq/ruby/) where you will find answers for the most common issues and gotchas with the client. You can also open [a GitHub issue](https://github.com/algolia/api-clients-automation/issues/new?assignees=&labels=&projects=&template=Bug_report.md)
5555

56-
## Upgrade from V1 to V2
56+
## Contributing
5757

58-
If you were using the v1 and wish to update to v2, please follow our [Upgrade Guide](upgrade_guide.md)
58+
This repository hosts the code of the generated Algolia API client for Ruby, if you'd like to contribute, head over to the [main repository](https://github.com/algolia/api-clients-automation). You can also find contributing guides on [our documentation website](https://api-clients-automation.netlify.app/docs/contributing/introduction).
5959

6060
## 📄 License
6161

62-
Algolia Ruby API Client is an open-sourced software licensed under the [MIT license](LICENSE.md).
62+
The Algolia Ruby API Client is an open-sourced software licensed under the [MIT license](LICENSE).

lib/algolia/api/search_client.rb

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3178,6 +3178,64 @@ def get_secured_api_key_remaining_validity(secured_api_key)
31783178
valid_until - now
31793179
end
31803180

3181+
# Helper: Saves the given array of objects in the given index. The `chunked_batch` helper is used under the hood, which creates a `batch` requests with at most 1000 objects in it.
3182+
#
3183+
# @param index_name [String]: The `index_name` to save `objects` in.
3184+
# @param objects [Array]: The array of `objects` to store in the given Algolia `indexName`.
3185+
# @param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
3186+
#
3187+
# @return [BatchResponse]
3188+
#
3189+
def save_objects(index_name, objects, request_options = {})
3190+
chunked_batch(
3191+
index_name,
3192+
objects,
3193+
Search::Action::ADD_OBJECT,
3194+
false,
3195+
1000,
3196+
request_options
3197+
)
3198+
end
3199+
3200+
# Helper: Deletes every records for the given objectIDs. The `chunked_batch` helper is used under the hood, which creates a `batch` requests with at most 1000 objectIDs in it.
3201+
#
3202+
# @param index_name [String]: The `index_name` to delete `object_ids` from.
3203+
# @param object_ids [Array]: The object_ids to delete.
3204+
# @param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
3205+
#
3206+
# @return [BatchResponse]
3207+
#
3208+
def delete_objects(index_name, object_ids, request_options = {})
3209+
chunked_batch(
3210+
index_name,
3211+
object_ids.map { |id| { "objectID" => id } },
3212+
Search::Action::DELETE_OBJECT,
3213+
false,
3214+
1000,
3215+
request_options
3216+
)
3217+
end
3218+
3219+
# Helper: Replaces object content of all the given objects according to their respective `object_id` field. The `chunkedBatch` helper is used under the hood, which creates a `batch` requests with at most 1000 objects in it.
3220+
#
3221+
# @param index_name [String]: The `index_name` to delete `object_ids` from.
3222+
# @param objects [Array]: The objects to partially update.
3223+
# @param create_if_not_exists [Boolean]: To be provided if non-existing objects are passed, otherwise, the call will fail.
3224+
# @param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
3225+
#
3226+
# @return [BatchResponse]
3227+
#
3228+
def partial_update_objects(index_name, objects, create_if_not_exists, request_options = {})
3229+
chunked_batch(
3230+
index_name,
3231+
objects,
3232+
create_if_not_exists ? Search::Action::PARTIAL_UPDATE_OBJECT : Search::Action::PARTIAL_UPDATE_OBJECT_NO_CREATE,
3233+
false,
3234+
1000,
3235+
request_options
3236+
)
3237+
end
3238+
31813239
# Helper: Chunks the given `objects` list in subset of 1000 elements max in order to make it fit in `batch` requests.
31823240
#
31833241
# @param index_name [String] the `index_name` where the operation will be performed.

0 commit comments

Comments
 (0)