algolia 2.3.3 → 3.0.0.alpha.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -89
- data/Gemfile +1 -14
- data/Gemfile.lock +64 -0
- data/README.md +4 -6
- data/Rakefile +0 -39
- data/algolia.gemspec +24 -39
- data/lib/algolia/api/abtesting_client.rb +418 -0
- data/lib/algolia/api/analytics_client.rb +1294 -0
- data/lib/algolia/api/ingestion_client.rb +1659 -0
- data/lib/algolia/api/insights_client.rb +252 -0
- data/lib/algolia/api/monitoring_client.rb +555 -0
- data/lib/algolia/api/personalization_client.rb +365 -0
- data/lib/algolia/api/query_suggestions_client.rb +491 -0
- data/lib/algolia/api/recommend_client.rb +460 -0
- data/lib/algolia/api/search_client.rb +2723 -0
- data/lib/algolia/api_client.rb +153 -0
- data/lib/algolia/api_error.rb +48 -0
- data/lib/algolia/configuration.rb +41 -0
- data/lib/algolia/logger_helper.rb +1 -1
- data/lib/algolia/models/abtesting/ab_test.rb +332 -0
- data/lib/algolia/models/abtesting/ab_test_response.rb +219 -0
- data/lib/algolia/models/abtesting/ab_tests_variant.rb +217 -0
- data/lib/algolia/models/abtesting/ab_tests_variant_search_params.rb +236 -0
- data/lib/algolia/models/abtesting/add_ab_tests_request.rb +239 -0
- data/lib/algolia/models/abtesting/add_ab_tests_variant.rb +96 -0
- data/lib/algolia/models/abtesting/currencies_value.rb +223 -0
- data/lib/algolia/models/abtesting/custom_search_params.rb +195 -0
- data/lib/algolia/models/abtesting/error_base.rb +196 -0
- data/lib/algolia/models/abtesting/filter_effects.rb +202 -0
- data/lib/algolia/models/abtesting/filter_effects_empty_search.rb +204 -0
- data/lib/algolia/models/abtesting/filter_effects_outliers.rb +204 -0
- data/lib/algolia/models/abtesting/list_ab_tests_response.rb +221 -0
- data/lib/algolia/models/abtesting/variant.rb +399 -0
- data/lib/algolia/models/analytics/average_click_event.rb +219 -0
- data/lib/algolia/models/analytics/click_position.rb +209 -0
- data/lib/algolia/models/analytics/click_through_rate_event.rb +249 -0
- data/lib/algolia/models/analytics/conversion_rate_event.rb +249 -0
- data/lib/algolia/models/analytics/direction.rb +33 -0
- data/lib/algolia/models/analytics/error_base.rb +196 -0
- data/lib/algolia/models/analytics/get_average_click_position_response.rb +221 -0
- data/lib/algolia/models/analytics/get_click_positions_response.rb +215 -0
- data/lib/algolia/models/analytics/get_click_through_rate_response.rb +251 -0
- data/lib/algolia/models/analytics/get_conversation_rate_response.rb +251 -0
- data/lib/algolia/models/analytics/get_no_click_rate_response.rb +251 -0
- data/lib/algolia/models/analytics/get_no_results_rate_response.rb +251 -0
- data/lib/algolia/models/analytics/get_searches_count_response.rb +209 -0
- data/lib/algolia/models/analytics/get_searches_no_clicks_response.rb +197 -0
- data/lib/algolia/models/analytics/get_searches_no_results_response.rb +197 -0
- data/lib/algolia/models/analytics/get_status_response.rb +195 -0
- data/lib/algolia/models/analytics/get_top_countries_response.rb +197 -0
- data/lib/algolia/models/analytics/get_top_filter_attribute.rb +207 -0
- data/lib/algolia/models/analytics/get_top_filter_attributes_response.rb +197 -0
- data/lib/algolia/models/analytics/get_top_filter_for_attribute.rb +231 -0
- data/lib/algolia/models/analytics/get_top_filter_for_attribute_response.rb +197 -0
- data/lib/algolia/models/analytics/get_top_filters_no_results_response.rb +197 -0
- data/lib/algolia/models/analytics/get_top_filters_no_results_value.rb +219 -0
- data/lib/algolia/models/analytics/get_top_filters_no_results_values.rb +209 -0
- data/lib/algolia/models/analytics/get_top_hits_response.rb +96 -0
- data/lib/algolia/models/analytics/get_top_searches_response.rb +96 -0
- data/lib/algolia/models/analytics/get_users_count_response.rb +209 -0
- data/lib/algolia/models/analytics/no_click_rate_event.rb +249 -0
- data/lib/algolia/models/analytics/no_results_rate_event.rb +249 -0
- data/lib/algolia/models/analytics/order_by.rb +35 -0
- data/lib/algolia/models/analytics/search_event.rb +207 -0
- data/lib/algolia/models/analytics/search_no_click_event.rb +219 -0
- data/lib/algolia/models/analytics/search_no_result_event.rb +219 -0
- data/lib/algolia/models/analytics/top_country.rb +207 -0
- data/lib/algolia/models/analytics/top_hit.rb +207 -0
- data/lib/algolia/models/analytics/top_hit_with_analytics.rb +285 -0
- data/lib/algolia/models/analytics/top_hits_response.rb +197 -0
- data/lib/algolia/models/analytics/top_hits_response_with_analytics.rb +197 -0
- data/lib/algolia/models/analytics/top_search.rb +219 -0
- data/lib/algolia/models/analytics/top_search_with_analytics.rb +309 -0
- data/lib/algolia/models/analytics/top_searches_response.rb +197 -0
- data/lib/algolia/models/analytics/top_searches_response_with_analytics.rb +197 -0
- data/lib/algolia/models/analytics/user_with_date.rb +207 -0
- data/lib/algolia/models/ingestion/action_type.rb +34 -0
- data/lib/algolia/models/ingestion/auth_algolia.rb +207 -0
- data/lib/algolia/models/ingestion/auth_algolia_partial.rb +203 -0
- data/lib/algolia/models/ingestion/auth_api_key.rb +195 -0
- data/lib/algolia/models/ingestion/auth_api_key_partial.rb +193 -0
- data/lib/algolia/models/ingestion/auth_basic.rb +206 -0
- data/lib/algolia/models/ingestion/auth_basic_partial.rb +202 -0
- data/lib/algolia/models/ingestion/auth_google_service_account.rb +208 -0
- data/lib/algolia/models/ingestion/auth_google_service_account_partial.rb +204 -0
- data/lib/algolia/models/ingestion/auth_input.rb +99 -0
- data/lib/algolia/models/ingestion/auth_input_partial.rb +99 -0
- data/lib/algolia/models/ingestion/auth_o_auth.rb +220 -0
- data/lib/algolia/models/ingestion/auth_o_auth_partial.rb +214 -0
- data/lib/algolia/models/ingestion/authentication.rb +283 -0
- data/lib/algolia/models/ingestion/authentication_create.rb +249 -0
- data/lib/algolia/models/ingestion/authentication_create_response.rb +220 -0
- data/lib/algolia/models/ingestion/authentication_search.rb +197 -0
- data/lib/algolia/models/ingestion/authentication_sort_keys.rb +36 -0
- data/lib/algolia/models/ingestion/authentication_type.rb +36 -0
- data/lib/algolia/models/ingestion/authentication_update.rb +243 -0
- data/lib/algolia/models/ingestion/authentication_update_response.rb +220 -0
- data/lib/algolia/models/ingestion/big_commerce_channel.rb +207 -0
- data/lib/algolia/models/ingestion/big_commerce_metafield.rb +207 -0
- data/lib/algolia/models/ingestion/big_query_data_type.rb +33 -0
- data/lib/algolia/models/ingestion/delete_response.rb +195 -0
- data/lib/algolia/models/ingestion/destination.rb +283 -0
- data/lib/algolia/models/ingestion/destination_create.rb +250 -0
- data/lib/algolia/models/ingestion/destination_create_response.rb +220 -0
- data/lib/algolia/models/ingestion/destination_index_name.rb +238 -0
- data/lib/algolia/models/ingestion/destination_index_prefix.rb +195 -0
- data/lib/algolia/models/ingestion/destination_input.rb +96 -0
- data/lib/algolia/models/ingestion/destination_search.rb +197 -0
- data/lib/algolia/models/ingestion/destination_sort_keys.rb +35 -0
- data/lib/algolia/models/ingestion/destination_type.rb +34 -0
- data/lib/algolia/models/ingestion/destination_update.rb +243 -0
- data/lib/algolia/models/ingestion/destination_update_response.rb +220 -0
- data/lib/algolia/models/ingestion/docker_image_type.rb +34 -0
- data/lib/algolia/models/ingestion/docker_registry.rb +33 -0
- data/lib/algolia/models/ingestion/docker_source_discover.rb +207 -0
- data/lib/algolia/models/ingestion/docker_source_streams.rb +196 -0
- data/lib/algolia/models/ingestion/error_base.rb +196 -0
- data/lib/algolia/models/ingestion/event.rb +311 -0
- data/lib/algolia/models/ingestion/event_sort_keys.rb +34 -0
- data/lib/algolia/models/ingestion/event_status.rb +37 -0
- data/lib/algolia/models/ingestion/event_type.rb +35 -0
- data/lib/algolia/models/ingestion/list_authentications_response.rb +207 -0
- data/lib/algolia/models/ingestion/list_destinations_response.rb +207 -0
- data/lib/algolia/models/ingestion/list_events_response.rb +218 -0
- data/lib/algolia/models/ingestion/list_sources_response.rb +207 -0
- data/lib/algolia/models/ingestion/list_tasks_response.rb +208 -0
- data/lib/algolia/models/ingestion/mapping_type_csv.rb +36 -0
- data/lib/algolia/models/ingestion/method_type.rb +33 -0
- data/lib/algolia/models/ingestion/on_demand_date_utils_input.rb +208 -0
- data/lib/algolia/models/ingestion/on_demand_trigger.rb +227 -0
- data/lib/algolia/models/ingestion/on_demand_trigger_input.rb +217 -0
- data/lib/algolia/models/ingestion/on_demand_trigger_type.rb +32 -0
- data/lib/algolia/models/ingestion/order_keys.rb +33 -0
- data/lib/algolia/models/ingestion/pagination.rb +227 -0
- data/lib/algolia/models/ingestion/platform.rb +33 -0
- data/lib/algolia/models/ingestion/platform_none.rb +32 -0
- data/lib/algolia/models/ingestion/platform_with_none.rb +96 -0
- data/lib/algolia/models/ingestion/record_type.rb +33 -0
- data/lib/algolia/models/ingestion/run.rb +359 -0
- data/lib/algolia/models/ingestion/run_list_response.rb +218 -0
- data/lib/algolia/models/ingestion/run_outcome.rb +34 -0
- data/lib/algolia/models/ingestion/run_progress.rb +201 -0
- data/lib/algolia/models/ingestion/run_reason_code.rb +38 -0
- data/lib/algolia/models/ingestion/run_response.rb +208 -0
- data/lib/algolia/models/ingestion/run_sort_keys.rb +34 -0
- data/lib/algolia/models/ingestion/run_status.rb +36 -0
- data/lib/algolia/models/ingestion/run_type.rb +34 -0
- data/lib/algolia/models/ingestion/schedule_date_utils_input.rb +214 -0
- data/lib/algolia/models/ingestion/schedule_trigger.rb +251 -0
- data/lib/algolia/models/ingestion/schedule_trigger_input.rb +229 -0
- data/lib/algolia/models/ingestion/schedule_trigger_type.rb +32 -0
- data/lib/algolia/models/ingestion/source.rb +282 -0
- data/lib/algolia/models/ingestion/source_big_commerce.rb +235 -0
- data/lib/algolia/models/ingestion/source_big_query.rb +278 -0
- data/lib/algolia/models/ingestion/source_commercetools.rb +238 -0
- data/lib/algolia/models/ingestion/source_create.rb +248 -0
- data/lib/algolia/models/ingestion/source_create_response.rb +218 -0
- data/lib/algolia/models/ingestion/source_csv.rb +276 -0
- data/lib/algolia/models/ingestion/source_docker.rb +261 -0
- data/lib/algolia/models/ingestion/source_input.rb +100 -0
- data/lib/algolia/models/ingestion/source_json.rb +236 -0
- data/lib/algolia/models/ingestion/source_search.rb +196 -0
- data/lib/algolia/models/ingestion/source_sort_keys.rb +35 -0
- data/lib/algolia/models/ingestion/source_type.rb +37 -0
- data/lib/algolia/models/ingestion/source_update.rb +211 -0
- data/lib/algolia/models/ingestion/source_update_commercetools.rb +207 -0
- data/lib/algolia/models/ingestion/source_update_docker.rb +246 -0
- data/lib/algolia/models/ingestion/source_update_input.rb +99 -0
- data/lib/algolia/models/ingestion/source_update_response.rb +218 -0
- data/lib/algolia/models/ingestion/subscription_trigger.rb +217 -0
- data/lib/algolia/models/ingestion/subscription_trigger_type.rb +32 -0
- data/lib/algolia/models/ingestion/task.rb +334 -0
- data/lib/algolia/models/ingestion/task_create.rb +299 -0
- data/lib/algolia/models/ingestion/task_create_response.rb +208 -0
- data/lib/algolia/models/ingestion/task_create_trigger.rb +97 -0
- data/lib/algolia/models/ingestion/task_input.rb +96 -0
- data/lib/algolia/models/ingestion/task_search.rb +196 -0
- data/lib/algolia/models/ingestion/task_sort_keys.rb +36 -0
- data/lib/algolia/models/ingestion/task_update.rb +250 -0
- data/lib/algolia/models/ingestion/task_update_response.rb +208 -0
- data/lib/algolia/models/ingestion/trigger.rb +97 -0
- data/lib/algolia/models/ingestion/trigger_type.rb +34 -0
- data/lib/algolia/models/ingestion/trigger_update_input.rb +196 -0
- data/lib/algolia/models/ingestion/window.rb +208 -0
- data/lib/algolia/models/insights/add_to_cart_event.rb +32 -0
- data/lib/algolia/models/insights/added_to_cart_object_ids.rb +384 -0
- data/lib/algolia/models/insights/added_to_cart_object_ids_after_search.rb +419 -0
- data/lib/algolia/models/insights/click_event.rb +32 -0
- data/lib/algolia/models/insights/clicked_filters.rb +351 -0
- data/lib/algolia/models/insights/clicked_object_ids.rb +341 -0
- data/lib/algolia/models/insights/clicked_object_ids_after_search.rb +418 -0
- data/lib/algolia/models/insights/conversion_event.rb +32 -0
- data/lib/algolia/models/insights/converted_filters.rb +350 -0
- data/lib/algolia/models/insights/converted_object_ids.rb +351 -0
- data/lib/algolia/models/insights/converted_object_ids_after_search.rb +386 -0
- data/lib/algolia/models/insights/discount.rb +97 -0
- data/lib/algolia/models/insights/error_base.rb +196 -0
- data/lib/algolia/models/insights/events_items.rb +106 -0
- data/lib/algolia/models/insights/events_response.rb +204 -0
- data/lib/algolia/models/insights/insights_events.rb +215 -0
- data/lib/algolia/models/insights/object_data.rb +211 -0
- data/lib/algolia/models/insights/object_data_after_search.rb +221 -0
- data/lib/algolia/models/insights/price.rb +97 -0
- data/lib/algolia/models/insights/purchase_event.rb +32 -0
- data/lib/algolia/models/insights/purchased_object_ids.rb +384 -0
- data/lib/algolia/models/insights/purchased_object_ids_after_search.rb +419 -0
- data/lib/algolia/models/insights/view_event.rb +32 -0
- data/lib/algolia/models/insights/viewed_filters.rb +351 -0
- data/lib/algolia/models/insights/viewed_object_ids.rb +351 -0
- data/lib/algolia/models/monitoring/error_base.rb +196 -0
- data/lib/algolia/models/monitoring/get_inventory403_response.rb +192 -0
- data/lib/algolia/models/monitoring/incident.rb +225 -0
- data/lib/algolia/models/monitoring/incidents_inner.rb +202 -0
- data/lib/algolia/models/monitoring/incidents_response.rb +194 -0
- data/lib/algolia/models/monitoring/indexing_time_response.rb +192 -0
- data/lib/algolia/models/monitoring/indexing_time_response_metrics.rb +194 -0
- data/lib/algolia/models/monitoring/infrastructure_response.rb +192 -0
- data/lib/algolia/models/monitoring/infrastructure_response_metrics.rb +243 -0
- data/lib/algolia/models/monitoring/inventory_response.rb +194 -0
- data/lib/algolia/models/monitoring/latency_response.rb +192 -0
- data/lib/algolia/models/monitoring/latency_response_metrics.rb +194 -0
- data/lib/algolia/models/monitoring/metric.rb +37 -0
- data/lib/algolia/models/monitoring/period.rb +36 -0
- data/lib/algolia/models/monitoring/probes_metric.rb +203 -0
- data/lib/algolia/models/monitoring/region.rb +46 -0
- data/lib/algolia/models/monitoring/server.rb +272 -0
- data/lib/algolia/models/monitoring/server_status.rb +32 -0
- data/lib/algolia/models/monitoring/status.rb +35 -0
- data/lib/algolia/models/monitoring/status_response.rb +194 -0
- data/lib/algolia/models/monitoring/time_inner.rb +203 -0
- data/lib/algolia/models/monitoring/type.rb +32 -0
- data/lib/algolia/models/personalization/delete_user_profile_response.rb +207 -0
- data/lib/algolia/models/personalization/error_base.rb +196 -0
- data/lib/algolia/models/personalization/event_scoring.rb +219 -0
- data/lib/algolia/models/personalization/facet_scoring.rb +207 -0
- data/lib/algolia/models/personalization/get_user_token_response.rb +219 -0
- data/lib/algolia/models/personalization/personalization_strategy_params.rb +223 -0
- data/lib/algolia/models/personalization/set_personalization_strategy_response.rb +195 -0
- data/lib/algolia/models/query-suggestions/base_query_suggestions_configuration_response.rb +223 -0
- data/lib/algolia/models/query-suggestions/base_query_suggestions_configuration_with_index.rb +195 -0
- data/lib/algolia/models/query-suggestions/base_response.rb +203 -0
- data/lib/algolia/models/query-suggestions/error_base.rb +196 -0
- data/lib/algolia/models/query-suggestions/facet.rb +204 -0
- data/lib/algolia/models/query-suggestions/get_config_status200_response.rb +233 -0
- data/lib/algolia/models/query-suggestions/get_log_file200_response.rb +244 -0
- data/lib/algolia/models/query-suggestions/languages.rb +97 -0
- data/lib/algolia/models/query-suggestions/log_level.rb +34 -0
- data/lib/algolia/models/query-suggestions/query_suggestions_configuration.rb +255 -0
- data/lib/algolia/models/query-suggestions/query_suggestions_configuration_response.rb +315 -0
- data/lib/algolia/models/query-suggestions/query_suggestions_configuration_with_index.rb +275 -0
- data/lib/algolia/models/query-suggestions/source_index.rb +305 -0
- data/lib/algolia/models/recommend/advanced_syntax_features.rb +33 -0
- data/lib/algolia/models/recommend/alternatives_as_exact.rb +34 -0
- data/lib/algolia/models/recommend/anchoring.rb +35 -0
- data/lib/algolia/models/recommend/around_precision.rb +97 -0
- data/lib/algolia/models/recommend/around_precision_from_value_inner.rb +201 -0
- data/lib/algolia/models/recommend/around_radius.rb +97 -0
- data/lib/algolia/models/recommend/around_radius_all.rb +32 -0
- data/lib/algolia/models/recommend/automatic_facet_filter.rb +216 -0
- data/lib/algolia/models/recommend/automatic_facet_filters.rb +97 -0
- data/lib/algolia/models/recommend/base_recommend_request.rb +233 -0
- data/lib/algolia/models/recommend/base_recommendations_query.rb +246 -0
- data/lib/algolia/models/recommend/base_recommended_for_you_query.rb +234 -0
- data/lib/algolia/models/recommend/base_recommended_for_you_query_parameters.rb +195 -0
- data/lib/algolia/models/recommend/base_search_params.rb +564 -0
- data/lib/algolia/models/recommend/base_search_params_without_query.rb +546 -0
- data/lib/algolia/models/recommend/base_search_response.rb +517 -0
- data/lib/algolia/models/recommend/base_trending_facets_query.rb +226 -0
- data/lib/algolia/models/recommend/base_trending_items_query.rb +252 -0
- data/lib/algolia/models/recommend/condition.rb +244 -0
- data/lib/algolia/models/recommend/consequence.rb +239 -0
- data/lib/algolia/models/recommend/consequence_hide.rb +196 -0
- data/lib/algolia/models/recommend/consequence_params.rb +1121 -0
- data/lib/algolia/models/recommend/consequence_query.rb +97 -0
- data/lib/algolia/models/recommend/consequence_query_object.rb +207 -0
- data/lib/algolia/models/recommend/deleted_at_response.rb +208 -0
- data/lib/algolia/models/recommend/distinct.rb +97 -0
- data/lib/algolia/models/recommend/edit.rb +234 -0
- data/lib/algolia/models/recommend/edit_type.rb +33 -0
- data/lib/algolia/models/recommend/error_base.rb +196 -0
- data/lib/algolia/models/recommend/exact_on_single_word_query.rb +34 -0
- data/lib/algolia/models/recommend/exhaustive.rb +234 -0
- data/lib/algolia/models/recommend/facet_filters.rb +97 -0
- data/lib/algolia/models/recommend/facet_ordering.rb +205 -0
- data/lib/algolia/models/recommend/facets.rb +196 -0
- data/lib/algolia/models/recommend/facets_stats.rb +223 -0
- data/lib/algolia/models/recommend/get_recommend_task_response.rb +216 -0
- data/lib/algolia/models/recommend/get_recommendations_params.rb +198 -0
- data/lib/algolia/models/recommend/get_recommendations_response.rb +194 -0
- data/lib/algolia/models/recommend/highlight_result.rb +96 -0
- data/lib/algolia/models/recommend/highlight_result_option.rb +253 -0
- data/lib/algolia/models/recommend/ignore_plurals.rb +97 -0
- data/lib/algolia/models/recommend/index_settings_as_search_params.rb +723 -0
- data/lib/algolia/models/recommend/match_level.rb +34 -0
- data/lib/algolia/models/recommend/matched_geo_location.rb +213 -0
- data/lib/algolia/models/recommend/mixed_search_filters.rb +96 -0
- data/lib/algolia/models/recommend/mode.rb +33 -0
- data/lib/algolia/models/recommend/numeric_filters.rb +97 -0
- data/lib/algolia/models/recommend/optional_filters.rb +97 -0
- data/lib/algolia/models/recommend/params.rb +220 -0
- data/lib/algolia/models/recommend/personalization.rb +213 -0
- data/lib/algolia/models/recommend/promote.rb +96 -0
- data/lib/algolia/models/recommend/promote_object_id.rb +208 -0
- data/lib/algolia/models/recommend/promote_object_ids.rb +210 -0
- data/lib/algolia/models/recommend/query_type.rb +34 -0
- data/lib/algolia/models/recommend/ranking_info.rb +328 -0
- data/lib/algolia/models/recommend/re_ranking_apply_filter.rb +97 -0
- data/lib/algolia/models/recommend/recommend_hit.rb +271 -0
- data/lib/algolia/models/recommend/recommend_models.rb +35 -0
- data/lib/algolia/models/recommend/recommendation_models.rb +33 -0
- data/lib/algolia/models/recommend/recommendations_hit.rb +96 -0
- data/lib/algolia/models/recommend/recommendations_hits.rb +216 -0
- data/lib/algolia/models/recommend/recommendations_query.rb +304 -0
- data/lib/algolia/models/recommend/recommendations_request.rb +98 -0
- data/lib/algolia/models/recommend/recommendations_results.rb +553 -0
- data/lib/algolia/models/recommend/recommended_for_you_model.rb +32 -0
- data/lib/algolia/models/recommend/recommended_for_you_query.rb +292 -0
- data/lib/algolia/models/recommend/recommended_for_you_query_parameters.rb +1105 -0
- data/lib/algolia/models/recommend/redirect.rb +195 -0
- data/lib/algolia/models/recommend/redirect_rule_index_metadata.rb +242 -0
- data/lib/algolia/models/recommend/redirect_rule_index_metadata_data.rb +195 -0
- data/lib/algolia/models/recommend/remove_stop_words.rb +97 -0
- data/lib/algolia/models/recommend/remove_words_if_no_results.rb +35 -0
- data/lib/algolia/models/recommend/rendering_content.rb +193 -0
- data/lib/algolia/models/recommend/rule_response.rb +246 -0
- data/lib/algolia/models/recommend/rule_response_metadata.rb +193 -0
- data/lib/algolia/models/recommend/search_params_object.rb +1103 -0
- data/lib/algolia/models/recommend/search_params_query.rb +193 -0
- data/lib/algolia/models/recommend/search_recommend_rules_params.rb +268 -0
- data/lib/algolia/models/recommend/search_recommend_rules_response.rb +233 -0
- data/lib/algolia/models/recommend/semantic_search.rb +198 -0
- data/lib/algolia/models/recommend/snippet_result.rb +96 -0
- data/lib/algolia/models/recommend/snippet_result_option.rb +229 -0
- data/lib/algolia/models/recommend/sort_remaining_by.rb +34 -0
- data/lib/algolia/models/recommend/tag_filters.rb +97 -0
- data/lib/algolia/models/recommend/task_status.rb +33 -0
- data/lib/algolia/models/recommend/trending_facet_hit.rb +238 -0
- data/lib/algolia/models/recommend/trending_facets_model.rb +32 -0
- data/lib/algolia/models/recommend/trending_facets_query.rb +284 -0
- data/lib/algolia/models/recommend/trending_items_model.rb +32 -0
- data/lib/algolia/models/recommend/trending_items_query.rb +310 -0
- data/lib/algolia/models/recommend/typo_tolerance.rb +97 -0
- data/lib/algolia/models/recommend/typo_tolerance_enum.rb +33 -0
- data/lib/algolia/models/recommend/value.rb +226 -0
- data/lib/algolia/models/search/acl.rb +47 -0
- data/lib/algolia/models/search/action.rb +38 -0
- data/lib/algolia/models/search/add_api_key_response.rb +207 -0
- data/lib/algolia/models/search/advanced_syntax_features.rb +33 -0
- data/lib/algolia/models/search/alternatives_as_exact.rb +34 -0
- data/lib/algolia/models/search/anchoring.rb +35 -0
- data/lib/algolia/models/search/api_key.rb +272 -0
- data/lib/algolia/models/search/around_precision.rb +97 -0
- data/lib/algolia/models/search/around_precision_from_value_inner.rb +201 -0
- data/lib/algolia/models/search/around_radius.rb +97 -0
- data/lib/algolia/models/search/around_radius_all.rb +32 -0
- data/lib/algolia/models/search/assign_user_id_params.rb +196 -0
- data/lib/algolia/models/search/attribute_to_update.rb +96 -0
- data/lib/algolia/models/search/automatic_facet_filter.rb +216 -0
- data/lib/algolia/models/search/automatic_facet_filters.rb +97 -0
- data/lib/algolia/models/search/base_get_api_key_response.rb +205 -0
- data/lib/algolia/models/search/base_index_settings.rb +366 -0
- data/lib/algolia/models/search/base_search_params.rb +564 -0
- data/lib/algolia/models/search/base_search_params_without_query.rb +546 -0
- data/lib/algolia/models/search/base_search_response.rb +517 -0
- data/lib/algolia/models/search/batch_assign_user_ids_params.rb +210 -0
- data/lib/algolia/models/search/batch_dictionary_entries_params.rb +208 -0
- data/lib/algolia/models/search/batch_dictionary_entries_request.rb +227 -0
- data/lib/algolia/models/search/batch_params.rb +197 -0
- data/lib/algolia/models/search/batch_request.rb +228 -0
- data/lib/algolia/models/search/batch_response.rb +209 -0
- data/lib/algolia/models/search/batch_write_params.rb +197 -0
- data/lib/algolia/models/search/browse_params.rb +96 -0
- data/lib/algolia/models/search/browse_params_object.rb +1113 -0
- data/lib/algolia/models/search/browse_response.rb +568 -0
- data/lib/algolia/models/search/built_in_operation.rb +229 -0
- data/lib/algolia/models/search/built_in_operation_type.rb +38 -0
- data/lib/algolia/models/search/condition.rb +244 -0
- data/lib/algolia/models/search/consequence.rb +239 -0
- data/lib/algolia/models/search/consequence_hide.rb +196 -0
- data/lib/algolia/models/search/consequence_params.rb +1121 -0
- data/lib/algolia/models/search/consequence_query.rb +97 -0
- data/lib/algolia/models/search/consequence_query_object.rb +207 -0
- data/lib/algolia/models/search/created_at_response.rb +196 -0
- data/lib/algolia/models/search/cursor.rb +193 -0
- data/lib/algolia/models/search/delete_api_key_response.rb +195 -0
- data/lib/algolia/models/search/delete_by_params.rb +263 -0
- data/lib/algolia/models/search/delete_source_response.rb +195 -0
- data/lib/algolia/models/search/deleted_at_response.rb +208 -0
- data/lib/algolia/models/search/dictionary_action.rb +33 -0
- data/lib/algolia/models/search/dictionary_entry.rb +276 -0
- data/lib/algolia/models/search/dictionary_entry_state.rb +33 -0
- data/lib/algolia/models/search/dictionary_language.rb +194 -0
- data/lib/algolia/models/search/dictionary_settings_params.rb +195 -0
- data/lib/algolia/models/search/dictionary_type.rb +34 -0
- data/lib/algolia/models/search/distinct.rb +97 -0
- data/lib/algolia/models/search/edit.rb +234 -0
- data/lib/algolia/models/search/edit_type.rb +33 -0
- data/lib/algolia/models/search/error_base.rb +196 -0
- data/lib/algolia/models/search/exact_on_single_word_query.rb +34 -0
- data/lib/algolia/models/search/exhaustive.rb +234 -0
- data/lib/algolia/models/search/facet_filters.rb +97 -0
- data/lib/algolia/models/search/facet_hits.rb +219 -0
- data/lib/algolia/models/search/facet_ordering.rb +205 -0
- data/lib/algolia/models/search/facets.rb +196 -0
- data/lib/algolia/models/search/facets_stats.rb +223 -0
- data/lib/algolia/models/search/fetched_index.rb +313 -0
- data/lib/algolia/models/search/get_api_key_response.rb +301 -0
- data/lib/algolia/models/search/get_dictionary_settings_response.rb +194 -0
- data/lib/algolia/models/search/get_logs_response.rb +196 -0
- data/lib/algolia/models/search/get_objects_params.rb +197 -0
- data/lib/algolia/models/search/get_objects_request.rb +220 -0
- data/lib/algolia/models/search/get_objects_response.rb +197 -0
- data/lib/algolia/models/search/get_task_response.rb +216 -0
- data/lib/algolia/models/search/get_top_user_ids_response.rb +198 -0
- data/lib/algolia/models/search/has_pending_mappings_response.rb +207 -0
- data/lib/algolia/models/search/highlight_result.rb +96 -0
- data/lib/algolia/models/search/highlight_result_option.rb +253 -0
- data/lib/algolia/models/search/hit.rb +241 -0
- data/lib/algolia/models/search/ignore_plurals.rb +97 -0
- data/lib/algolia/models/search/index_settings.rb +912 -0
- data/lib/algolia/models/search/index_settings_as_search_params.rb +723 -0
- data/lib/algolia/models/search/languages.rb +221 -0
- data/lib/algolia/models/search/list_api_keys_response.rb +197 -0
- data/lib/algolia/models/search/list_clusters_response.rb +198 -0
- data/lib/algolia/models/search/list_indices_response.rb +207 -0
- data/lib/algolia/models/search/list_user_ids_response.rb +198 -0
- data/lib/algolia/models/search/log.rb +358 -0
- data/lib/algolia/models/search/log_query.rb +213 -0
- data/lib/algolia/models/search/log_type.rb +35 -0
- data/lib/algolia/models/search/match_level.rb +34 -0
- data/lib/algolia/models/search/matched_geo_location.rb +213 -0
- data/lib/algolia/models/search/mixed_search_filters.rb +96 -0
- data/lib/algolia/models/search/mode.rb +33 -0
- data/lib/algolia/models/search/multiple_batch_request.rb +240 -0
- data/lib/algolia/models/search/multiple_batch_response.rb +211 -0
- data/lib/algolia/models/search/numeric_filters.rb +97 -0
- data/lib/algolia/models/search/operation_index_params.rb +240 -0
- data/lib/algolia/models/search/operation_type.rb +33 -0
- data/lib/algolia/models/search/optional_filters.rb +97 -0
- data/lib/algolia/models/search/params.rb +220 -0
- data/lib/algolia/models/search/personalization.rb +213 -0
- data/lib/algolia/models/search/promote.rb +96 -0
- data/lib/algolia/models/search/promote_object_id.rb +208 -0
- data/lib/algolia/models/search/promote_object_ids.rb +210 -0
- data/lib/algolia/models/search/query_type.rb +34 -0
- data/lib/algolia/models/search/ranking_info.rb +328 -0
- data/lib/algolia/models/search/re_ranking_apply_filter.rb +97 -0
- data/lib/algolia/models/search/redirect.rb +195 -0
- data/lib/algolia/models/search/redirect_rule_index_metadata.rb +242 -0
- data/lib/algolia/models/search/redirect_rule_index_metadata_data.rb +195 -0
- data/lib/algolia/models/search/remove_stop_words.rb +97 -0
- data/lib/algolia/models/search/remove_user_id_response.rb +195 -0
- data/lib/algolia/models/search/remove_words_if_no_results.rb +35 -0
- data/lib/algolia/models/search/rendering_content.rb +193 -0
- data/lib/algolia/models/search/replace_source_response.rb +195 -0
- data/lib/algolia/models/search/rule.rb +249 -0
- data/lib/algolia/models/search/save_object_response.rb +217 -0
- data/lib/algolia/models/search/save_synonym_response.rb +219 -0
- data/lib/algolia/models/search/scope_type.rb +34 -0
- data/lib/algolia/models/search/search_dictionary_entries_params.rb +244 -0
- data/lib/algolia/models/search/search_for_facet_values_request.rb +227 -0
- data/lib/algolia/models/search/search_for_facet_values_response.rb +218 -0
- data/lib/algolia/models/search/search_for_facets.rb +1158 -0
- data/lib/algolia/models/search/search_for_facets_options.rb +274 -0
- data/lib/algolia/models/search/search_for_hits.rb +1134 -0
- data/lib/algolia/models/search/search_for_hits_options.rb +226 -0
- data/lib/algolia/models/search/search_hits.rb +223 -0
- data/lib/algolia/models/search/search_method_params.rb +227 -0
- data/lib/algolia/models/search/search_params.rb +96 -0
- data/lib/algolia/models/search/search_params_object.rb +1103 -0
- data/lib/algolia/models/search/search_params_query.rb +193 -0
- data/lib/algolia/models/search/search_params_string.rb +193 -0
- data/lib/algolia/models/search/search_query.rb +96 -0
- data/lib/algolia/models/search/search_response.rb +560 -0
- data/lib/algolia/models/search/search_responses.rb +196 -0
- data/lib/algolia/models/search/search_result.rb +96 -0
- data/lib/algolia/models/search/search_rules_params.rb +311 -0
- data/lib/algolia/models/search/search_rules_response.rb +233 -0
- data/lib/algolia/models/search/search_strategy.rb +33 -0
- data/lib/algolia/models/search/search_synonyms_params.rb +193 -0
- data/lib/algolia/models/search/search_synonyms_response.rb +212 -0
- data/lib/algolia/models/search/search_type_default.rb +32 -0
- data/lib/algolia/models/search/search_type_facet.rb +32 -0
- data/lib/algolia/models/search/search_user_ids_params.rb +244 -0
- data/lib/algolia/models/search/search_user_ids_response.rb +264 -0
- data/lib/algolia/models/search/semantic_search.rb +198 -0
- data/lib/algolia/models/search/snippet_result.rb +96 -0
- data/lib/algolia/models/search/snippet_result_option.rb +229 -0
- data/lib/algolia/models/search/sort_remaining_by.rb +34 -0
- data/lib/algolia/models/search/source.rb +206 -0
- data/lib/algolia/models/search/standard_entries.rb +224 -0
- data/lib/algolia/models/search/synonym_hit.rb +295 -0
- data/lib/algolia/models/search/synonym_type.rb +36 -0
- data/lib/algolia/models/search/tag_filters.rb +97 -0
- data/lib/algolia/models/search/task_status.rb +33 -0
- data/lib/algolia/models/search/time_range.rb +207 -0
- data/lib/algolia/models/search/typo_tolerance.rb +97 -0
- data/lib/algolia/models/search/typo_tolerance_enum.rb +33 -0
- data/lib/algolia/models/search/update_api_key_response.rb +207 -0
- data/lib/algolia/models/search/updated_at_response.rb +208 -0
- data/lib/algolia/models/search/updated_at_with_object_id_response.rb +214 -0
- data/lib/algolia/models/search/updated_rule_response.rb +219 -0
- data/lib/algolia/models/search/user_highlight_result.rb +205 -0
- data/lib/algolia/models/search/user_hit.rb +269 -0
- data/lib/algolia/models/search/user_id.rb +247 -0
- data/lib/algolia/models/search/value.rb +226 -0
- data/lib/algolia/transport/echo_requester.rb +10 -0
- data/lib/algolia/{http → transport/http}/http_requester.rb +24 -19
- data/lib/algolia/{http → transport/http}/response.rb +11 -1
- data/lib/algolia/transport/request_options.rb +19 -31
- data/lib/algolia/transport/retry_strategy.rb +5 -8
- data/lib/algolia/transport/stateful_host.rb +1 -2
- data/lib/algolia/transport/transport.rb +33 -73
- data/lib/algolia/user_agent.rb +4 -14
- data/lib/algolia/version.rb +3 -1
- data/lib/algolia.rb +23 -40
- metadata +523 -218
- data/.circleci/config.yml +0 -155
- data/.dockerignore +0 -38
- data/.github/ISSUE_TEMPLATE.md +0 -20
- data/.github/PULL_REQUEST_TEMPLATE.md +0 -22
- data/.gitignore +0 -40
- data/.rubocop.yml +0 -189
- data/.rubocop_todo.yml +0 -14
- data/CODE_OF_CONDUCT.md +0 -74
- data/CONTRIBUTING.MD +0 -184
- data/DOCKER_README.MD +0 -89
- data/Dockerfile +0 -7
- data/LICENSE +0 -21
- data/SECURITY.md +0 -3
- data/Steepfile +0 -6
- data/bin/console +0 -21
- data/bin/setup +0 -8
- data/lib/algolia/account_client.rb +0 -65
- data/lib/algolia/analytics_client.rb +0 -105
- data/lib/algolia/config/analytics_config.rb +0 -20
- data/lib/algolia/config/base_config.rb +0 -43
- data/lib/algolia/config/insights_config.rb +0 -20
- data/lib/algolia/config/personalization_config.rb +0 -20
- data/lib/algolia/config/recommend_config.rb +0 -6
- data/lib/algolia/config/recommendation_config.rb +0 -7
- data/lib/algolia/config/search_config.rb +0 -40
- data/lib/algolia/defaults.rb +0 -35
- data/lib/algolia/helpers.rb +0 -134
- data/lib/algolia/insights_client.rb +0 -238
- data/lib/algolia/iterators/base_iterator.rb +0 -19
- data/lib/algolia/iterators/object_iterator.rb +0 -28
- data/lib/algolia/iterators/paginator_iterator.rb +0 -46
- data/lib/algolia/iterators/rule_iterator.rb +0 -9
- data/lib/algolia/iterators/synonym_iterator.rb +0 -9
- data/lib/algolia/personalization_client.rb +0 -60
- data/lib/algolia/recommend_client.rb +0 -134
- data/lib/algolia/recommendation_client.rb +0 -7
- data/lib/algolia/responses/add_api_key_response.rb +0 -38
- data/lib/algolia/responses/base_response.rb +0 -9
- data/lib/algolia/responses/delete_api_key_response.rb +0 -40
- data/lib/algolia/responses/dictionary_response.rb +0 -33
- data/lib/algolia/responses/indexing_response.rb +0 -28
- data/lib/algolia/responses/multiple_batch_indexing_response.rb +0 -29
- data/lib/algolia/responses/multiple_response.rb +0 -45
- data/lib/algolia/responses/restore_api_key_response.rb +0 -36
- data/lib/algolia/responses/update_api_key_response.rb +0 -39
- data/lib/algolia/search_client.rb +0 -791
- data/lib/algolia/search_index.rb +0 -1059
- data/renovate.json +0 -5
- data/sig/config/algolia_config.rbs +0 -24
- data/sig/config/analytics_config.rbs +0 -11
- data/sig/config/insights_config.rbs +0 -11
- data/sig/config/recommendation_config.rbs +0 -11
- data/sig/config/search_config.rbs +0 -11
- data/sig/enums/call_type.rbs +0 -5
- data/sig/helpers.rbs +0 -12
- data/sig/http/http_requester.rbs +0 -17
- data/sig/http/response.rbs +0 -14
- data/sig/interfaces/_connection.rbs +0 -16
- data/sig/iterators/base_iterator.rbs +0 -15
- data/sig/iterators/object_iterator.rbs +0 -6
- data/sig/iterators/paginator_iterator.rbs +0 -8
- data/sig/iterators/rule_iterator.rbs +0 -5
- data/sig/iterators/synonym_iterator.rbs +0 -5
- data/sig/transport/request_options.rbs +0 -33
- data/sig/transport/stateful_host.rbs +0 -21
- data/test/algolia/integration/account_client_test.rb +0 -47
- data/test/algolia/integration/analytics_client_test.rb +0 -117
- data/test/algolia/integration/base_test.rb +0 -9
- data/test/algolia/integration/insights_client_test.rb +0 -80
- data/test/algolia/integration/mocks/mock_requester.rb +0 -47
- data/test/algolia/integration/personalization_client_test.rb +0 -30
- data/test/algolia/integration/recommend_client_test.rb +0 -70
- data/test/algolia/integration/recommendation_client_test.rb +0 -30
- data/test/algolia/integration/search_client_test.rb +0 -465
- data/test/algolia/integration/search_index_test.rb +0 -729
- data/test/algolia/unit/algolia_config_test.rb +0 -16
- data/test/algolia/unit/helpers_test.rb +0 -88
- data/test/algolia/unit/http_requester_test.rb +0 -27
- data/test/algolia/unit/retry_strategy_test.rb +0 -139
- data/test/algolia/unit/user_agent_test.rb +0 -16
- data/test/test_helper.rb +0 -121
- data/upgrade_guide.md +0 -603
- /data/lib/algolia/{enums → transport}/call_type.rb +0 -0
- /data/lib/algolia/{enums → transport}/retry_outcome_type.rb +0 -0
@@ -1,791 +0,0 @@
|
|
1
|
-
require 'faraday'
|
2
|
-
require 'openssl'
|
3
|
-
require 'base64'
|
4
|
-
|
5
|
-
module Algolia
|
6
|
-
module Search
|
7
|
-
# Class Client
|
8
|
-
class Client
|
9
|
-
include CallType
|
10
|
-
include Helpers
|
11
|
-
|
12
|
-
# Initialize a client to connect to Algolia
|
13
|
-
#
|
14
|
-
# @param search_config [Search::Config] a Search::Config object which contains your APP_ID and API_KEY
|
15
|
-
# @option adapter [Object] adapter object used for the connection
|
16
|
-
# @option logger [Object]
|
17
|
-
# @option http_requester [Object] http_requester object used for the connection
|
18
|
-
#
|
19
|
-
def initialize(search_config, opts = {})
|
20
|
-
@config = search_config
|
21
|
-
adapter = opts[:adapter] || Defaults::ADAPTER
|
22
|
-
@logger = opts[:logger] || LoggerHelper.create
|
23
|
-
requester = opts[:http_requester] || Defaults::REQUESTER_CLASS.new(adapter, @logger)
|
24
|
-
@transporter = Transport::Transport.new(@config, requester)
|
25
|
-
end
|
26
|
-
|
27
|
-
# Create a new client providing only app ID and API key
|
28
|
-
#
|
29
|
-
# @param app_id [String] Algolia application ID
|
30
|
-
# @param api_key [String] Algolia API key
|
31
|
-
#
|
32
|
-
# @return self
|
33
|
-
#
|
34
|
-
def self.create(app_id, api_key)
|
35
|
-
config = Search::Config.new(application_id: app_id, api_key: api_key)
|
36
|
-
create_with_config(config)
|
37
|
-
end
|
38
|
-
|
39
|
-
# Create a new client providing only the search config
|
40
|
-
#
|
41
|
-
# @param config [Search::Config]
|
42
|
-
#
|
43
|
-
# @return self
|
44
|
-
#
|
45
|
-
def self.create_with_config(config)
|
46
|
-
new(config)
|
47
|
-
end
|
48
|
-
|
49
|
-
# Fetch the task status until it returns as "published", meaning the operation is done
|
50
|
-
#
|
51
|
-
# @param index_name [String]
|
52
|
-
# @param task_id [Integer]
|
53
|
-
# @param time_before_retry [Integer] time before retrying the call, in ms
|
54
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
55
|
-
#
|
56
|
-
# @return nil
|
57
|
-
#
|
58
|
-
def wait_task(index_name, task_id, time_before_retry = WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, opts = {})
|
59
|
-
loop do
|
60
|
-
status = get_task_status(index_name, task_id, opts)
|
61
|
-
if status == 'published'
|
62
|
-
return
|
63
|
-
end
|
64
|
-
sleep(time_before_retry.to_f / 1000)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
# Check the status of a task on the server.
|
69
|
-
# All server task are asynchronous and you can check the status of a task with this method.
|
70
|
-
#
|
71
|
-
# @param index_name [String] index used for the calls
|
72
|
-
# @param task_id [Integer] the id of the task returned by server
|
73
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
74
|
-
#
|
75
|
-
# @return [String]
|
76
|
-
#
|
77
|
-
def get_task_status(index_name, task_id, opts = {})
|
78
|
-
res = @transporter.read(:GET, path_encode('/1/indexes/%s/task/%s', index_name, task_id), {}, opts)
|
79
|
-
get_option(res, 'status')
|
80
|
-
end
|
81
|
-
|
82
|
-
# # # # # # # # # # # # # # # # # # # # #
|
83
|
-
# INDEX METHODS
|
84
|
-
# # # # # # # # # # # # # # # # # # # # #
|
85
|
-
|
86
|
-
# Initialize an index with a given name
|
87
|
-
#
|
88
|
-
# @param index_name [String] name of the index to init
|
89
|
-
#
|
90
|
-
# @return [Index] new Index instance
|
91
|
-
#
|
92
|
-
def init_index(index_name)
|
93
|
-
stripped_index_name = index_name.strip
|
94
|
-
if stripped_index_name.empty?
|
95
|
-
raise AlgoliaError, 'Please provide a valid index name'
|
96
|
-
end
|
97
|
-
Index.new(stripped_index_name, @transporter, @config, @logger)
|
98
|
-
end
|
99
|
-
|
100
|
-
# List all indexes of the client
|
101
|
-
#
|
102
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
103
|
-
#
|
104
|
-
# @return [Hash]
|
105
|
-
#
|
106
|
-
def list_indexes(opts = {})
|
107
|
-
@transporter.read(:GET, '/1/indexes', {}, opts)
|
108
|
-
end
|
109
|
-
|
110
|
-
# Retrieve the client logs
|
111
|
-
#
|
112
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
113
|
-
#
|
114
|
-
# @return [Hash]
|
115
|
-
#
|
116
|
-
def get_logs(opts = {})
|
117
|
-
@transporter.read(:GET, '/1/logs', {}, opts)
|
118
|
-
end
|
119
|
-
|
120
|
-
# # # # # # # # # # # # # # # # # # # # #
|
121
|
-
# COPY OPERATIONS
|
122
|
-
# # # # # # # # # # # # # # # # # # # # #
|
123
|
-
|
124
|
-
# Copy the rules from source index to destination index
|
125
|
-
#
|
126
|
-
# @param src_index_name [String] Name of the source index
|
127
|
-
# @param dest_index_name [String] Name of the destination index
|
128
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
129
|
-
#
|
130
|
-
# @return [IndexingResponse]
|
131
|
-
#
|
132
|
-
def copy_rules(src_index_name, dest_index_name, opts = {})
|
133
|
-
request_options = symbolize_hash(opts)
|
134
|
-
request_options[:scope] = ['rules']
|
135
|
-
copy_index(src_index_name, dest_index_name, request_options)
|
136
|
-
end
|
137
|
-
|
138
|
-
# Copy the rules from source index to destination index and wait for the task to complete
|
139
|
-
#
|
140
|
-
# @param src_index_name [String] Name of the source index
|
141
|
-
# @param dest_index_name [String] Name of the destination index
|
142
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
143
|
-
#
|
144
|
-
# @return [IndexingResponse]
|
145
|
-
#
|
146
|
-
def copy_rules!(src_index_name, dest_index_name, opts = {})
|
147
|
-
request_options = symbolize_hash(opts)
|
148
|
-
request_options[:scope] = ['rules']
|
149
|
-
copy_index!(src_index_name, dest_index_name, request_options)
|
150
|
-
end
|
151
|
-
|
152
|
-
# Copy the settings from source index to destination index
|
153
|
-
#
|
154
|
-
# @param src_index_name [String] Name of the source index
|
155
|
-
# @param dest_index_name [String] Name of the destination index
|
156
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
157
|
-
#
|
158
|
-
# @return [IndexingResponse]
|
159
|
-
#
|
160
|
-
def copy_settings(src_index_name, dest_index_name, opts = {})
|
161
|
-
request_options = symbolize_hash(opts)
|
162
|
-
request_options[:scope] = ['settings']
|
163
|
-
copy_index(src_index_name, dest_index_name, request_options)
|
164
|
-
end
|
165
|
-
|
166
|
-
# Copy the settings from source index to destination index and wait for the task to complete
|
167
|
-
#
|
168
|
-
# @param src_index_name [String] Name of the source index
|
169
|
-
# @param dest_index_name [String] Name of the destination index
|
170
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
171
|
-
#
|
172
|
-
# @return [IndexingResponse]
|
173
|
-
#
|
174
|
-
def copy_settings!(src_index_name, dest_index_name, opts = {})
|
175
|
-
request_options = symbolize_hash(opts)
|
176
|
-
request_options[:scope] = ['settings']
|
177
|
-
copy_index!(src_index_name, dest_index_name, request_options)
|
178
|
-
end
|
179
|
-
|
180
|
-
# Copy the synonyms from source index to destination index
|
181
|
-
#
|
182
|
-
# @param src_index_name [String] Name of the source index
|
183
|
-
# @param dest_index_name [String] Name of the destination index
|
184
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
185
|
-
#
|
186
|
-
# @return [IndexingResponse]
|
187
|
-
#
|
188
|
-
def copy_synonyms(src_index_name, dest_index_name, opts = {})
|
189
|
-
request_options = symbolize_hash(opts)
|
190
|
-
request_options[:scope] = ['synonyms']
|
191
|
-
copy_index(src_index_name, dest_index_name, request_options)
|
192
|
-
end
|
193
|
-
|
194
|
-
# Copy the synonyms from source index to destination index and wait for the task to complete
|
195
|
-
#
|
196
|
-
# @param src_index_name [String] Name of the source index
|
197
|
-
# @param dest_index_name [String] Name of the destination index
|
198
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
199
|
-
#
|
200
|
-
# @return [IndexingResponse]
|
201
|
-
#
|
202
|
-
def copy_synonyms!(src_index_name, dest_index_name, opts = {})
|
203
|
-
request_options = symbolize_hash(opts)
|
204
|
-
request_options[:scope] = ['synonyms']
|
205
|
-
copy_index!(src_index_name, dest_index_name, request_options)
|
206
|
-
end
|
207
|
-
|
208
|
-
# Copy the source index to the destination index
|
209
|
-
#
|
210
|
-
# @param src_index_name [String] Name of the source index
|
211
|
-
# @param dest_index_name [String] Name of the destination index
|
212
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
213
|
-
#
|
214
|
-
# @return [IndexingResponse]
|
215
|
-
#
|
216
|
-
def copy_index(src_index_name, dest_index_name, opts = {})
|
217
|
-
response = @transporter.write(:POST, path_encode('/1/indexes/%s/operation', src_index_name), { operation: 'copy', destination: dest_index_name }, opts)
|
218
|
-
|
219
|
-
IndexingResponse.new(init_index(src_index_name), response)
|
220
|
-
end
|
221
|
-
|
222
|
-
# Copy the source index to the destination index and wait for the task to complete
|
223
|
-
#
|
224
|
-
# @param src_index_name [String] Name of the source index
|
225
|
-
# @param dest_index_name [String] Name of the destination index
|
226
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
227
|
-
#
|
228
|
-
# @return [IndexingResponse]
|
229
|
-
#
|
230
|
-
def copy_index!(src_index_name, dest_index_name, opts = {})
|
231
|
-
response = copy_index(src_index_name, dest_index_name, opts)
|
232
|
-
|
233
|
-
response.wait(opts)
|
234
|
-
end
|
235
|
-
|
236
|
-
# # # # # # # # # # # # # # # # # # # # #
|
237
|
-
# MOVE OPERATIONS
|
238
|
-
# # # # # # # # # # # # # # # # # # # # #
|
239
|
-
|
240
|
-
# Move the source index to the destination index
|
241
|
-
#
|
242
|
-
# @param src_index_name [String] Name of the source index
|
243
|
-
# @param dest_index_name [String] Name of the destination index
|
244
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
245
|
-
#
|
246
|
-
# @return [IndexingResponse]
|
247
|
-
#
|
248
|
-
def move_index(src_index_name, dest_index_name, opts = {})
|
249
|
-
response = @transporter.write(:POST, path_encode('/1/indexes/%s/operation', src_index_name), { operation: 'move', destination: dest_index_name }, opts)
|
250
|
-
|
251
|
-
IndexingResponse.new(init_index(src_index_name), response)
|
252
|
-
end
|
253
|
-
|
254
|
-
# Move the source index to the destination index and wait for the task to complete
|
255
|
-
#
|
256
|
-
# @param src_index_name [String] Name of the source index
|
257
|
-
# @param dest_index_name [String] Name of the destination index
|
258
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
259
|
-
#
|
260
|
-
# @return [IndexingResponse]
|
261
|
-
#
|
262
|
-
def move_index!(src_index_name, dest_index_name, opts = {})
|
263
|
-
response = move_index(src_index_name, dest_index_name, opts)
|
264
|
-
|
265
|
-
response.wait(opts)
|
266
|
-
end
|
267
|
-
|
268
|
-
# # # # # # # # # # # # # # # # # # # # #
|
269
|
-
# API KEY METHODS
|
270
|
-
# # # # # # # # # # # # # # # # # # # # #
|
271
|
-
|
272
|
-
# Get the designated API key
|
273
|
-
#
|
274
|
-
# @param key_id [String] API key to retrieve
|
275
|
-
#
|
276
|
-
# @return [Hash]
|
277
|
-
#
|
278
|
-
def get_api_key(key_id, opts = {})
|
279
|
-
@transporter.read(:GET, path_encode('/1/keys/%s', key_id), {}, opts)
|
280
|
-
end
|
281
|
-
|
282
|
-
# Add an API key with the given ACL
|
283
|
-
#
|
284
|
-
# @param acl [Array] API key to retrieve
|
285
|
-
# @param opts [Hash] contains extra parameters to send with your query used for the key
|
286
|
-
#
|
287
|
-
# @return [AddApiKeyResponse]
|
288
|
-
#
|
289
|
-
def add_api_key(acl, opts = {})
|
290
|
-
response = @transporter.write(:POST, '/1/keys', { acl: acl }, opts)
|
291
|
-
|
292
|
-
AddApiKeyResponse.new(self, response)
|
293
|
-
end
|
294
|
-
|
295
|
-
# Add an API key with the given ACL and wait for the task to complete
|
296
|
-
#
|
297
|
-
# @param acl [Array] API key to retrieve
|
298
|
-
# @param opts [Hash] contains extra parameters to send with your query used for the key
|
299
|
-
#
|
300
|
-
# @return [AddApiKeyResponse]
|
301
|
-
#
|
302
|
-
def add_api_key!(acl, opts = {})
|
303
|
-
response = add_api_key(acl, opts)
|
304
|
-
|
305
|
-
response.wait(opts)
|
306
|
-
end
|
307
|
-
|
308
|
-
# Update an API key with the optional parameters
|
309
|
-
#
|
310
|
-
# @param key [String] API key to update
|
311
|
-
# @param opts [Hash] contains extra parameters to send with your query used to update the key
|
312
|
-
#
|
313
|
-
# @return [UpdateApiKeyResponse]
|
314
|
-
#
|
315
|
-
def update_api_key(key, opts = {})
|
316
|
-
request_options = symbolize_hash(opts)
|
317
|
-
|
318
|
-
response = @transporter.write(:PUT, path_encode('/1/keys/%s', key), {}, request_options)
|
319
|
-
|
320
|
-
UpdateApiKeyResponse.new(self, response, request_options)
|
321
|
-
end
|
322
|
-
|
323
|
-
# Update an API key with the optional parameters and wait for the task to complete
|
324
|
-
#
|
325
|
-
# @param key [String] API key to update
|
326
|
-
# @param opts [Hash] contains extra parameters to send with your query used to update the key
|
327
|
-
#
|
328
|
-
# @return [UpdateApiKeyResponse]
|
329
|
-
#
|
330
|
-
def update_api_key!(key, opts = {})
|
331
|
-
response = update_api_key(key, opts)
|
332
|
-
|
333
|
-
response.wait(opts)
|
334
|
-
end
|
335
|
-
|
336
|
-
# Delete the given API key
|
337
|
-
#
|
338
|
-
# @param key [String] API key to delete
|
339
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
340
|
-
#
|
341
|
-
# @return [DeleteApiKeyResponse]
|
342
|
-
#
|
343
|
-
def delete_api_key(key, opts = {})
|
344
|
-
response = @transporter.write(:DELETE, path_encode('/1/keys/%s', key), {}, opts)
|
345
|
-
|
346
|
-
DeleteApiKeyResponse.new(self, response, key)
|
347
|
-
end
|
348
|
-
|
349
|
-
# Delete the given API key and wait for the task to complete
|
350
|
-
#
|
351
|
-
# @param key [String] API key to delete
|
352
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
353
|
-
#
|
354
|
-
# @return [DeleteApiKeyResponse]
|
355
|
-
#
|
356
|
-
def delete_api_key!(key, opts = {})
|
357
|
-
response = delete_api_key(key, opts)
|
358
|
-
|
359
|
-
response.wait(opts)
|
360
|
-
end
|
361
|
-
|
362
|
-
# Restore the given API key
|
363
|
-
#
|
364
|
-
# @param key [String] API key to restore
|
365
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
366
|
-
#
|
367
|
-
# @return [RestoreApiKeyResponse]
|
368
|
-
#
|
369
|
-
def restore_api_key(key, opts = {})
|
370
|
-
@transporter.write(:POST, path_encode('/1/keys/%s/restore', key), {}, opts)
|
371
|
-
|
372
|
-
RestoreApiKeyResponse.new(self, key)
|
373
|
-
end
|
374
|
-
|
375
|
-
# Restore the given API key and wait for the task to complete
|
376
|
-
#
|
377
|
-
# @param key [String] API key to restore
|
378
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
379
|
-
#
|
380
|
-
# @return [RestoreApiKeyResponse]
|
381
|
-
#
|
382
|
-
def restore_api_key!(key, opts = {})
|
383
|
-
response = restore_api_key(key, opts)
|
384
|
-
|
385
|
-
response.wait(opts)
|
386
|
-
end
|
387
|
-
|
388
|
-
# List all keys associated with the current client
|
389
|
-
#
|
390
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
391
|
-
#
|
392
|
-
# @return [Hash]
|
393
|
-
#
|
394
|
-
def list_api_keys(opts = {})
|
395
|
-
@transporter.read(:GET, '/1/keys', {}, opts)
|
396
|
-
end
|
397
|
-
|
398
|
-
# Generate a secured API key from the given parent key with the given restrictions
|
399
|
-
#
|
400
|
-
# @param parent_key [String] Parent API key used the generate the secured key
|
401
|
-
# @param restrictions [Hash] Restrictions to apply on the secured key
|
402
|
-
#
|
403
|
-
# @return [String]
|
404
|
-
#
|
405
|
-
def self.generate_secured_api_key(parent_key, restrictions)
|
406
|
-
url_encoded_restrictions = to_query_string(symbolize_hash(restrictions))
|
407
|
-
hmac = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), parent_key, url_encoded_restrictions)
|
408
|
-
Base64.encode64("#{hmac}#{url_encoded_restrictions}").gsub("\n", '')
|
409
|
-
end
|
410
|
-
|
411
|
-
# Returns the time the given securedAPIKey remains valid in seconds
|
412
|
-
#
|
413
|
-
# @param secured_api_key [String]
|
414
|
-
#
|
415
|
-
# @return [Integer]
|
416
|
-
#
|
417
|
-
def self.get_secured_api_key_remaining_validity(secured_api_key)
|
418
|
-
now = Time.now.to_i
|
419
|
-
decoded_key = Base64.decode64(secured_api_key)
|
420
|
-
regex = 'validUntil=(\d+)'
|
421
|
-
matches = decoded_key.match(regex)
|
422
|
-
|
423
|
-
if matches.nil?
|
424
|
-
raise AlgoliaError, 'The SecuredAPIKey doesn\'t have a validUntil parameter.'
|
425
|
-
end
|
426
|
-
|
427
|
-
valid_until = matches[1].to_i
|
428
|
-
|
429
|
-
valid_until - now
|
430
|
-
end
|
431
|
-
|
432
|
-
# # # # # # # # # # # # # # # # # # # # #
|
433
|
-
# MULTIPLE* METHODS
|
434
|
-
# # # # # # # # # # # # # # # # # # # # #
|
435
|
-
|
436
|
-
# Batch multiple operations
|
437
|
-
#
|
438
|
-
# @param operations [Array] array of operations (addObject, updateObject, ...)
|
439
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
440
|
-
#
|
441
|
-
# @return [MultipleIndexBatchIndexingResponse]
|
442
|
-
#
|
443
|
-
def multiple_batch(operations, opts = {})
|
444
|
-
response = @transporter.write(:POST, '/1/indexes/*/batch', { requests: operations }, opts)
|
445
|
-
|
446
|
-
MultipleIndexBatchIndexingResponse.new(self, response)
|
447
|
-
end
|
448
|
-
|
449
|
-
# Batch multiple operations and wait for the task to complete
|
450
|
-
#
|
451
|
-
# @param operations [Array] array of operations (addObject, updateObject, ...)
|
452
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
453
|
-
#
|
454
|
-
# @return [MultipleIndexBatchIndexingResponse]
|
455
|
-
#
|
456
|
-
def multiple_batch!(operations, opts = {})
|
457
|
-
response = multiple_batch(operations, opts)
|
458
|
-
|
459
|
-
response.wait(opts)
|
460
|
-
end
|
461
|
-
|
462
|
-
# Retrieve multiple objects in one batch request
|
463
|
-
#
|
464
|
-
# @param requests [Array] array of requests
|
465
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
466
|
-
#
|
467
|
-
# @return [Hash]
|
468
|
-
#
|
469
|
-
def multiple_get_objects(requests, opts = {})
|
470
|
-
@transporter.read(:POST, '/1/indexes/*/objects', { requests: requests }, opts)
|
471
|
-
end
|
472
|
-
|
473
|
-
# Search multiple indices
|
474
|
-
#
|
475
|
-
# @param queries [Array] array of queries
|
476
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
477
|
-
#
|
478
|
-
# @return [Hash]
|
479
|
-
#
|
480
|
-
def multiple_queries(queries, opts = {})
|
481
|
-
queries.each do |q|
|
482
|
-
q[:params] = to_query_string(q[:params]) unless q[:params].nil? || q[:params].is_a?(String)
|
483
|
-
end
|
484
|
-
@transporter.read(:POST, '/1/indexes/*/queries', { requests: queries }, opts)
|
485
|
-
end
|
486
|
-
alias_method :search, :multiple_queries
|
487
|
-
|
488
|
-
# # # # # # # # # # # # # # # # # # # # #
|
489
|
-
# MCM METHODS
|
490
|
-
# # # # # # # # # # # # # # # # # # # # #
|
491
|
-
|
492
|
-
# Assign or Move a userID to a cluster.
|
493
|
-
#
|
494
|
-
# @param user_id [String]
|
495
|
-
# @param cluster_name [String]
|
496
|
-
#
|
497
|
-
# @return [Hash]
|
498
|
-
#
|
499
|
-
def assign_user_id(user_id, cluster_name, opts = {})
|
500
|
-
request_options = symbolize_hash(opts)
|
501
|
-
request_options[:headers] = { 'X-Algolia-User-ID': user_id }
|
502
|
-
|
503
|
-
@transporter.write(:POST, '/1/clusters/mapping', { cluster: cluster_name }, request_options)
|
504
|
-
end
|
505
|
-
|
506
|
-
# Assign multiple userIDs to a cluster.
|
507
|
-
#
|
508
|
-
# @param user_ids [Array]
|
509
|
-
# @param cluster_name [String]
|
510
|
-
#
|
511
|
-
# @return [Hash]
|
512
|
-
#
|
513
|
-
def assign_user_ids(user_ids, cluster_name, opts = {})
|
514
|
-
@transporter.write(:POST, '/1/clusters/mapping/batch', { cluster: cluster_name, users: user_ids }, opts)
|
515
|
-
end
|
516
|
-
|
517
|
-
# Get the top 10 userIDs with the highest number of records per cluster.
|
518
|
-
#
|
519
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
520
|
-
#
|
521
|
-
# @return [Hash]
|
522
|
-
#
|
523
|
-
def get_top_user_ids(opts = {})
|
524
|
-
@transporter.read(:GET, '/1/clusters/mapping/top', {}, opts)
|
525
|
-
end
|
526
|
-
|
527
|
-
# Returns the userID data stored in the mapping.
|
528
|
-
#
|
529
|
-
# @param user_id [String]
|
530
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
531
|
-
#
|
532
|
-
# @return [Hash]
|
533
|
-
#
|
534
|
-
def get_user_id(user_id, opts = {})
|
535
|
-
@transporter.read(:GET, path_encode('/1/clusters/mapping/%s', user_id), {}, opts)
|
536
|
-
end
|
537
|
-
|
538
|
-
# List the clusters available in a multi-clusters setup for a single appID
|
539
|
-
#
|
540
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
541
|
-
#
|
542
|
-
# @return [Hash]
|
543
|
-
#
|
544
|
-
def list_clusters(opts = {})
|
545
|
-
@transporter.read(:GET, '/1/clusters', {}, opts)
|
546
|
-
end
|
547
|
-
|
548
|
-
# List the userIDs assigned to a multi-clusters appID
|
549
|
-
#
|
550
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
551
|
-
#
|
552
|
-
# @return [Hash]
|
553
|
-
#
|
554
|
-
def list_user_ids(opts = {})
|
555
|
-
@transporter.read(:GET, '/1/clusters/mapping', {}, opts)
|
556
|
-
end
|
557
|
-
|
558
|
-
# Remove a userID and its associated data from the multi-clusters
|
559
|
-
#
|
560
|
-
# @param user_id [String]
|
561
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
562
|
-
#
|
563
|
-
# @return [Hash]
|
564
|
-
#
|
565
|
-
def remove_user_id(user_id, opts = {})
|
566
|
-
request_options = symbolize_hash(opts)
|
567
|
-
request_options[:headers] = { 'X-Algolia-User-ID': user_id }
|
568
|
-
|
569
|
-
@transporter.write(:DELETE, '/1/clusters/mapping', {}, request_options)
|
570
|
-
end
|
571
|
-
|
572
|
-
# Search for userIDs
|
573
|
-
#
|
574
|
-
# @param query [String]
|
575
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
576
|
-
#
|
577
|
-
# @return [Hash]
|
578
|
-
#
|
579
|
-
def search_user_ids(query, opts = {})
|
580
|
-
@transporter.read(:POST, '/1/clusters/mapping/search', { query: query }, opts)
|
581
|
-
end
|
582
|
-
|
583
|
-
# Get the status of your clusters' migrations or user creations
|
584
|
-
#
|
585
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
586
|
-
#
|
587
|
-
# @return [Hash]
|
588
|
-
#
|
589
|
-
def pending_mappings?(opts = {})
|
590
|
-
retrieve_mappings = false
|
591
|
-
|
592
|
-
request_options = symbolize_hash(opts)
|
593
|
-
if request_options.has_key?(:retrieveMappings)
|
594
|
-
retrieve_mappings = request_options[:retrieveMappings]
|
595
|
-
request_options.delete(:retrieveMappings)
|
596
|
-
end
|
597
|
-
|
598
|
-
@transporter.read(:GET, '/1/clusters/mapping/pending' + handle_params({ getClusters: retrieve_mappings }), {}, request_options)
|
599
|
-
end
|
600
|
-
|
601
|
-
# Aliases the pending_mappings? method
|
602
|
-
#
|
603
|
-
alias_method :has_pending_mappings, :pending_mappings?
|
604
|
-
|
605
|
-
# # # # # # # # # # # # # # # # # # # # #
|
606
|
-
# CUSTOM DICTIONARIES METHODS
|
607
|
-
# # # # # # # # # # # # # # # # # # # # #
|
608
|
-
|
609
|
-
# Save entries for a given dictionary
|
610
|
-
#
|
611
|
-
# @param dictionary [String] dictionary name. Can be either 'stopwords', 'plurals' or 'compounds'
|
612
|
-
# @param dictionary_entries [Array<Hash>] array of dictionary entries
|
613
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
614
|
-
#
|
615
|
-
# @return DictionaryResponse
|
616
|
-
#
|
617
|
-
def save_dictionary_entries(dictionary, dictionary_entries, opts = {})
|
618
|
-
response = @transporter.write(
|
619
|
-
:POST,
|
620
|
-
path_encode('/1/dictionaries/%s/batch', dictionary),
|
621
|
-
{ clearExistingDictionaryEntries: false, requests: chunk('addEntry', dictionary_entries) },
|
622
|
-
opts
|
623
|
-
)
|
624
|
-
|
625
|
-
DictionaryResponse.new(self, response)
|
626
|
-
end
|
627
|
-
|
628
|
-
# Save entries for a given dictionary and wait for the task to finish
|
629
|
-
#
|
630
|
-
# @param dictionary [String] dictionary name. Can be either 'stopwords', 'plurals' or 'compounds'
|
631
|
-
# @param dictionary_entries [Array<Hash>] array of dictionary entries
|
632
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
633
|
-
#
|
634
|
-
def save_dictionary_entries!(dictionary, dictionary_entries, opts = {})
|
635
|
-
response = save_dictionary_entries(dictionary, dictionary_entries, opts)
|
636
|
-
|
637
|
-
response.wait(opts)
|
638
|
-
end
|
639
|
-
|
640
|
-
# Replace entries for a given dictionary
|
641
|
-
#
|
642
|
-
# @param dictionary [String] dictionary name. Can be either 'stopwords', 'plurals' or 'compounds'
|
643
|
-
# @param dictionary_entries [Array<Hash>] array of dictionary entries
|
644
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
645
|
-
#
|
646
|
-
# @return DictionaryResponse
|
647
|
-
#
|
648
|
-
def replace_dictionary_entries(dictionary, dictionary_entries, opts = {})
|
649
|
-
response = @transporter.write(
|
650
|
-
:POST,
|
651
|
-
path_encode('/1/dictionaries/%s/batch', dictionary),
|
652
|
-
{ clearExistingDictionaryEntries: true, requests: chunk('addEntry', dictionary_entries) },
|
653
|
-
opts
|
654
|
-
)
|
655
|
-
|
656
|
-
DictionaryResponse.new(self, response)
|
657
|
-
end
|
658
|
-
|
659
|
-
# Replace entries for a given dictionary and wait for the task to finish
|
660
|
-
#
|
661
|
-
# @param dictionary [String] dictionary name. Can be either 'stopwords', 'plurals' or 'compounds'
|
662
|
-
# @param dictionary_entries [Array<Hash>] array of dictionary entries
|
663
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
664
|
-
#
|
665
|
-
def replace_dictionary_entries!(dictionary, dictionary_entries, opts = {})
|
666
|
-
response = replace_dictionary_entries(dictionary, dictionary_entries, opts)
|
667
|
-
|
668
|
-
response.wait(opts)
|
669
|
-
end
|
670
|
-
|
671
|
-
# Delete entries for a given dictionary
|
672
|
-
#
|
673
|
-
# @param dictionary [String] dictionary name. Can be either 'stopwords', 'plurals' or 'compounds'
|
674
|
-
# @param object_ids [Array<Hash>] array of object ids
|
675
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
676
|
-
#
|
677
|
-
# @return DictionaryResponse
|
678
|
-
#
|
679
|
-
def delete_dictionary_entries(dictionary, object_ids, opts = {})
|
680
|
-
request = object_ids.map do |object_id|
|
681
|
-
{ objectID: object_id }
|
682
|
-
end
|
683
|
-
response = @transporter.write(
|
684
|
-
:POST,
|
685
|
-
path_encode('/1/dictionaries/%s/batch', dictionary),
|
686
|
-
{ clearExistingDictionaryEntries: false, requests: chunk('deleteEntry', request) },
|
687
|
-
opts
|
688
|
-
)
|
689
|
-
|
690
|
-
DictionaryResponse.new(self, response)
|
691
|
-
end
|
692
|
-
|
693
|
-
# Delete entries for a given dictionary and wait for the task to finish
|
694
|
-
#
|
695
|
-
# @param dictionary [String] dictionary name. Can be either 'stopwords', 'plurals' or 'compounds'
|
696
|
-
# @param object_ids [Array<Hash>] array of object ids
|
697
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
698
|
-
#
|
699
|
-
def delete_dictionary_entries!(dictionary, object_ids, opts = {})
|
700
|
-
response = delete_dictionary_entries(dictionary, object_ids, opts)
|
701
|
-
|
702
|
-
response.wait(opts)
|
703
|
-
end
|
704
|
-
|
705
|
-
# Clear all entries for a given dictionary
|
706
|
-
#
|
707
|
-
# @param dictionary [String] dictionary name. Can be either 'stopwords', 'plurals' or 'compounds'
|
708
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
709
|
-
#
|
710
|
-
# @return DictionaryResponse
|
711
|
-
#
|
712
|
-
def clear_dictionary_entries(dictionary, opts = {})
|
713
|
-
replace_dictionary_entries(dictionary, [], opts)
|
714
|
-
end
|
715
|
-
|
716
|
-
# Clear all entries for a given dictionary and wait for the task to finish
|
717
|
-
#
|
718
|
-
# @param dictionary [String] dictionary name. Can be either 'stopwords', 'plurals' or 'compounds'
|
719
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
720
|
-
#
|
721
|
-
def clear_dictionary_entries!(dictionary, opts = {})
|
722
|
-
response = replace_dictionary_entries(dictionary, [], opts)
|
723
|
-
|
724
|
-
response.wait(opts)
|
725
|
-
end
|
726
|
-
|
727
|
-
# Search entries for a given dictionary
|
728
|
-
#
|
729
|
-
# @param dictionary [String] dictionary name. Can be either 'stopwords', 'plurals' or 'compounds'
|
730
|
-
# @param query [String] query to send
|
731
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
732
|
-
#
|
733
|
-
def search_dictionary_entries(dictionary, query, opts = {})
|
734
|
-
@transporter.read(
|
735
|
-
:POST,
|
736
|
-
path_encode('/1/dictionaries/%s/search', dictionary),
|
737
|
-
{ query: query },
|
738
|
-
opts
|
739
|
-
)
|
740
|
-
end
|
741
|
-
|
742
|
-
# Set settings for all the dictionaries
|
743
|
-
#
|
744
|
-
# @param dictionary_settings [Hash]
|
745
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
746
|
-
#
|
747
|
-
# @return DictionaryResponse
|
748
|
-
#
|
749
|
-
def set_dictionary_settings(dictionary_settings, opts = {})
|
750
|
-
response = @transporter.write(:PUT, '/1/dictionaries/*/settings', dictionary_settings, opts)
|
751
|
-
|
752
|
-
DictionaryResponse.new(self, response)
|
753
|
-
end
|
754
|
-
|
755
|
-
# Set settings for all the dictionaries and wait for the task to finish
|
756
|
-
#
|
757
|
-
# @param dictionary_settings [Hash]
|
758
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
759
|
-
#
|
760
|
-
# @return DictionaryResponse
|
761
|
-
#
|
762
|
-
def set_dictionary_settings!(dictionary_settings, opts = {})
|
763
|
-
response = set_dictionary_settings(dictionary_settings, opts)
|
764
|
-
|
765
|
-
response.wait(opts)
|
766
|
-
end
|
767
|
-
|
768
|
-
# Retrieve settings for all the dictionaries
|
769
|
-
#
|
770
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
771
|
-
#
|
772
|
-
def get_dictionary_settings(opts = {})
|
773
|
-
@transporter.read(:GET, '/1/dictionaries/*/settings', {}, opts)
|
774
|
-
end
|
775
|
-
|
776
|
-
# # # # # # # # # # # # # # # # # # # # #
|
777
|
-
# MISC METHODS
|
778
|
-
# # # # # # # # # # # # # # # # # # # # #
|
779
|
-
|
780
|
-
# Method available to make custom requests to the API
|
781
|
-
#
|
782
|
-
def custom_request(data, uri, method, call_type, opts = {})
|
783
|
-
if call_type == WRITE
|
784
|
-
@transporter.write(method.to_sym, uri, data, opts)
|
785
|
-
elsif call_type == READ
|
786
|
-
@transporter.read(method.to_sym, uri, data, opts)
|
787
|
-
end
|
788
|
-
end
|
789
|
-
end
|
790
|
-
end
|
791
|
-
end
|