algolia 2.3.4 → 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 -93
- 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 +522 -217
- 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 -92
- 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
data/lib/algolia/defaults.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
module Defaults
|
2
|
-
REQUESTER_CLASS = Algolia::Http::HttpRequester
|
3
|
-
ADAPTER = 'net_http_persistent'
|
4
|
-
TTL = 300
|
5
|
-
# The version of the REST API implemented by this module.
|
6
|
-
VERSION = 1
|
7
|
-
|
8
|
-
# HTTP Headers
|
9
|
-
# ----------------------------------------
|
10
|
-
|
11
|
-
# The HTTP header used for passing your application ID to the Algolia API.
|
12
|
-
HEADER_APP_ID = 'X-Algolia-Application-Id'.freeze
|
13
|
-
|
14
|
-
# The HTTP header used for passing your API key to the Algolia API.
|
15
|
-
HEADER_API_KEY = 'X-Algolia-API-Key'.freeze
|
16
|
-
|
17
|
-
# HTTP ERROR CODES
|
18
|
-
# ----------------------------------------
|
19
|
-
|
20
|
-
ERROR_BAD_REQUEST = 400
|
21
|
-
ERROR_FORBIDDEN = 403
|
22
|
-
ERROR_NOT_FOUND = 404
|
23
|
-
ERROR_TIMED_OUT = 408
|
24
|
-
|
25
|
-
BATCH_SIZE = 1000
|
26
|
-
CONNECT_TIMEOUT = 2
|
27
|
-
READ_TIMEOUT = 5
|
28
|
-
WRITE_TIMEOUT = 30
|
29
|
-
USER_AGENT = "Algolia for Ruby (#{Algolia::VERSION}), Ruby (#{RUBY_VERSION})"
|
30
|
-
|
31
|
-
WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY = 100
|
32
|
-
|
33
|
-
GZIP_ENCODING = 'gzip'
|
34
|
-
NONE_ENCODING = 'none'
|
35
|
-
end
|
data/lib/algolia/helpers.rb
DELETED
@@ -1,134 +0,0 @@
|
|
1
|
-
require 'multi_json'
|
2
|
-
|
3
|
-
module Helpers
|
4
|
-
# Convert an Hash to json
|
5
|
-
#
|
6
|
-
def to_json(body)
|
7
|
-
body.is_a?(String) ? body : MultiJson.dump(body)
|
8
|
-
end
|
9
|
-
|
10
|
-
# Converts each key of a hash to symbols
|
11
|
-
#
|
12
|
-
def symbolize_hash(hash)
|
13
|
-
hash.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
14
|
-
end
|
15
|
-
|
16
|
-
# Convert params to a full query string
|
17
|
-
#
|
18
|
-
def handle_params(params)
|
19
|
-
params.nil? || params.empty? ? '' : "?#{to_query_string(params)}"
|
20
|
-
end
|
21
|
-
|
22
|
-
# Create a query string from params
|
23
|
-
#
|
24
|
-
def to_query_string(params)
|
25
|
-
params.map do |key, value|
|
26
|
-
"#{CGI.escape(key.to_s)}=#{CGI.escape(value.to_s)}"
|
27
|
-
end.join('&')
|
28
|
-
end
|
29
|
-
|
30
|
-
# Convert a json object to an hash
|
31
|
-
#
|
32
|
-
def json_to_hash(json, symbolize_keys)
|
33
|
-
MultiJson.load(json, symbolize_keys: symbolize_keys)
|
34
|
-
end
|
35
|
-
|
36
|
-
# Retrieve the given value associated with a key, in string or symbol format
|
37
|
-
#
|
38
|
-
def get_option(hash, key)
|
39
|
-
hash[key.to_sym] || hash[key] || nil
|
40
|
-
end
|
41
|
-
|
42
|
-
# Build a path with the given arguments
|
43
|
-
#
|
44
|
-
def path_encode(path, *args)
|
45
|
-
arguments = []
|
46
|
-
args.each do |arg|
|
47
|
-
arguments.push(CGI.escape(arg.to_s))
|
48
|
-
end
|
49
|
-
|
50
|
-
format(path, *arguments)
|
51
|
-
end
|
52
|
-
|
53
|
-
# Support to convert old settings to their new names
|
54
|
-
#
|
55
|
-
def deserialize_settings(data, symbolize_keys)
|
56
|
-
settings = data
|
57
|
-
keys = {
|
58
|
-
attributesToIndex: 'searchableAttributes',
|
59
|
-
numericAttributesToIndex: 'numericAttributesForFiltering',
|
60
|
-
slaves: 'replicas'
|
61
|
-
}
|
62
|
-
|
63
|
-
keys.each do |deprecated_key, current_key|
|
64
|
-
deprecated_key = symbolize_keys ? deprecated_key : deprecated_key.to_s
|
65
|
-
if settings.has_key?(deprecated_key)
|
66
|
-
key = symbolize_keys ? current_key.to_sym : current_key.to_s
|
67
|
-
settings[key] = settings.delete(deprecated_key)
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
settings
|
72
|
-
end
|
73
|
-
|
74
|
-
def self.included(base)
|
75
|
-
base.extend(Helpers)
|
76
|
-
end
|
77
|
-
|
78
|
-
def hash_includes_subset?(hash, subset)
|
79
|
-
res = true
|
80
|
-
subset.each do |k, v|
|
81
|
-
res &&= hash[k] == v
|
82
|
-
end
|
83
|
-
res
|
84
|
-
end
|
85
|
-
|
86
|
-
# Check the passed object to determine if it's an array
|
87
|
-
#
|
88
|
-
# @param object [Object]
|
89
|
-
#
|
90
|
-
def check_array(object)
|
91
|
-
raise Algolia::AlgoliaError, 'argument must be an array of objects' unless object.is_a?(Array)
|
92
|
-
end
|
93
|
-
|
94
|
-
# Check the passed object
|
95
|
-
#
|
96
|
-
# @param object [Object]
|
97
|
-
# @param in_array [Boolean] whether the object is an array or not
|
98
|
-
#
|
99
|
-
def check_object(object, in_array = false)
|
100
|
-
case object
|
101
|
-
when Array
|
102
|
-
raise Algolia::AlgoliaError, in_array ? 'argument must be an array of objects' : 'argument must not be an array'
|
103
|
-
when String, Integer, Float, TrueClass, FalseClass, NilClass
|
104
|
-
raise Algolia::AlgoliaError, "argument must be an #{'array of' if in_array} object, got: #{object.inspect}"
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
# Check if passed object has a objectID
|
109
|
-
#
|
110
|
-
# @param object [Object]
|
111
|
-
# @param object_id [String]
|
112
|
-
#
|
113
|
-
def get_object_id(object, object_id = nil)
|
114
|
-
check_object(object)
|
115
|
-
object_id ||= object[:objectID] || object['objectID']
|
116
|
-
raise Algolia::AlgoliaError, "Missing 'objectID'" if object_id.nil?
|
117
|
-
object_id
|
118
|
-
end
|
119
|
-
|
120
|
-
# Build a batch request
|
121
|
-
#
|
122
|
-
# @param action [String] action to perform on the engine
|
123
|
-
# @param objects [Array] objects on which build the action
|
124
|
-
# @param with_object_id [Boolean] if set to true, check if each object has an objectID set
|
125
|
-
#
|
126
|
-
def chunk(action, objects, with_object_id = false)
|
127
|
-
objects.map do |object|
|
128
|
-
check_object(object, true)
|
129
|
-
request = { action: action, body: object }
|
130
|
-
request[:objectID] = get_object_id(object).to_s if with_object_id
|
131
|
-
request
|
132
|
-
end
|
133
|
-
end
|
134
|
-
end
|
@@ -1,238 +0,0 @@
|
|
1
|
-
module Algolia
|
2
|
-
module Insights
|
3
|
-
class Client
|
4
|
-
include Helpers
|
5
|
-
|
6
|
-
# Initializes the Insights client
|
7
|
-
#
|
8
|
-
# @param insights_config [Insights::Config] an Insights::Config object which contains your APP_ID and API_KEY
|
9
|
-
# @option adapter [Object] adapter object used for the connection
|
10
|
-
# @option logger [Object]
|
11
|
-
# @option http_requester [Object] http_requester object used for the connection
|
12
|
-
#
|
13
|
-
def initialize(insights_config, opts = {})
|
14
|
-
@config = insights_config
|
15
|
-
adapter = opts[:adapter] || Defaults::ADAPTER
|
16
|
-
logger = opts[:logger] || LoggerHelper.create
|
17
|
-
requester = opts[:http_requester] || Defaults::REQUESTER_CLASS.new(adapter, logger)
|
18
|
-
@transporter = Transport::Transport.new(@config, requester)
|
19
|
-
end
|
20
|
-
|
21
|
-
# Create a new client providing only app ID and API key
|
22
|
-
#
|
23
|
-
# @param app_id [String] Algolia application ID
|
24
|
-
# @param api_key [String] Algolia API key
|
25
|
-
#
|
26
|
-
# @return self
|
27
|
-
#
|
28
|
-
def self.create(app_id, api_key)
|
29
|
-
config = Insights::Config.new(application_id: app_id, api_key: api_key)
|
30
|
-
create_with_config(config)
|
31
|
-
end
|
32
|
-
|
33
|
-
# Create a new client providing only an Analytics::Config object
|
34
|
-
#
|
35
|
-
# @param config [Insights::Config]
|
36
|
-
#
|
37
|
-
# @return self
|
38
|
-
#
|
39
|
-
def self.create_with_config(config)
|
40
|
-
new(config)
|
41
|
-
end
|
42
|
-
|
43
|
-
# Create a new Insight User Client
|
44
|
-
#
|
45
|
-
# @param user_token [String]
|
46
|
-
#
|
47
|
-
# @return [UserClient]
|
48
|
-
#
|
49
|
-
def user(user_token)
|
50
|
-
UserClient.new(self, user_token)
|
51
|
-
end
|
52
|
-
|
53
|
-
# Push an event to the Insights API.
|
54
|
-
#
|
55
|
-
# @param event [Hash]
|
56
|
-
#
|
57
|
-
# @return [Hash]
|
58
|
-
#
|
59
|
-
def send_event(event, opts = {})
|
60
|
-
send_events([event], opts)
|
61
|
-
end
|
62
|
-
|
63
|
-
# Push an array of events to the Insights API.
|
64
|
-
#
|
65
|
-
# @param events [Array]
|
66
|
-
#
|
67
|
-
# @return [Hash]
|
68
|
-
#
|
69
|
-
def send_events(events, opts = {})
|
70
|
-
@transporter.write(:POST, '/1/events', { events: events }, opts)
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
class UserClient
|
75
|
-
# Initializes the Insights userClient
|
76
|
-
#
|
77
|
-
# @param insights_client [Insights::Client] Insights Client used to make API calls
|
78
|
-
# @param user_token [String] user token used to build the client
|
79
|
-
#
|
80
|
-
def initialize(insights_client, user_token)
|
81
|
-
@insights_client = insights_client
|
82
|
-
@user_token = user_token
|
83
|
-
end
|
84
|
-
|
85
|
-
# Send a click event to capture clicked items.
|
86
|
-
#
|
87
|
-
# @param event_name [String] Name of the event.
|
88
|
-
# @param index_name [String] Name of the index related to the click.
|
89
|
-
# @param object_ids [Array] A list of objectIDs (limited to 20)
|
90
|
-
#
|
91
|
-
# @return [Hash]
|
92
|
-
#
|
93
|
-
def clicked_object_ids(event_name, index_name, object_ids, opts = {})
|
94
|
-
@insights_client.send_event({
|
95
|
-
eventType: 'click',
|
96
|
-
eventName: event_name,
|
97
|
-
index: index_name,
|
98
|
-
userToken: @user_token,
|
99
|
-
objectIds: object_ids
|
100
|
-
}, opts)
|
101
|
-
end
|
102
|
-
|
103
|
-
# Send a click event to capture a query and its clicked items and positions.
|
104
|
-
#
|
105
|
-
# @param event_name [String] Name of the event.
|
106
|
-
# @param index_name [String] Name of the index related to the click.
|
107
|
-
# @param object_ids [Array] A list of objectIDs (limited to 20)
|
108
|
-
# @param positions [Array] Position of the click in the list of Algolia search results.
|
109
|
-
# @param query_id [String] Algolia queryID that can be found in the search response when using clickAnalytics
|
110
|
-
#
|
111
|
-
# @return [Hash]
|
112
|
-
#
|
113
|
-
def clicked_object_ids_after_search(event_name, index_name,
|
114
|
-
object_ids, positions, query_id, opts = {})
|
115
|
-
@insights_client.send_event({
|
116
|
-
eventType: 'click',
|
117
|
-
eventName: event_name,
|
118
|
-
index: index_name,
|
119
|
-
userToken: @user_token,
|
120
|
-
objectIds: object_ids,
|
121
|
-
positions: positions,
|
122
|
-
queryId: query_id
|
123
|
-
}, opts)
|
124
|
-
end
|
125
|
-
|
126
|
-
# Send a click event to capture the filters a user clicks on.
|
127
|
-
#
|
128
|
-
# @param event_name [String] Name of the event.
|
129
|
-
# @param index_name [String] Name of the index related to the click.
|
130
|
-
# @param filters [Array] A list of filters (limited to 10)
|
131
|
-
#
|
132
|
-
# @return [Hash]
|
133
|
-
#
|
134
|
-
def clicked_filters(event_name, index_name, filters, opts = {})
|
135
|
-
@insights_client.send_event({
|
136
|
-
eventType: 'click',
|
137
|
-
eventName: event_name,
|
138
|
-
index: index_name,
|
139
|
-
userToken: @user_token,
|
140
|
-
filters: filters
|
141
|
-
}, opts)
|
142
|
-
end
|
143
|
-
|
144
|
-
# Send a conversion event to capture clicked items.
|
145
|
-
#
|
146
|
-
# @param event_name [String] Name of the event.
|
147
|
-
# @param index_name [String] Name of the index related to the click.
|
148
|
-
# @param object_ids [Array] A list of objectIDs (limited to 20)
|
149
|
-
#
|
150
|
-
# @return [Hash]
|
151
|
-
#
|
152
|
-
def converted_object_ids(event_name, index_name, object_ids, opts = {})
|
153
|
-
@insights_client.send_event({
|
154
|
-
eventType: 'conversion',
|
155
|
-
eventName: event_name,
|
156
|
-
index: index_name,
|
157
|
-
userToken: @user_token,
|
158
|
-
objectIds: object_ids
|
159
|
-
}, opts)
|
160
|
-
end
|
161
|
-
|
162
|
-
# Send a conversion event to capture a query and its clicked items.
|
163
|
-
#
|
164
|
-
# @param event_name [String] Name of the event.
|
165
|
-
# @param index_name [String] Name of the index related to the click.
|
166
|
-
# @param object_ids [Array] A list of objectIDs (limited to 20)
|
167
|
-
# @param query_id [String] Algolia queryID, format: [a-z1-9]{32}.
|
168
|
-
#
|
169
|
-
# @return [Hash]
|
170
|
-
#
|
171
|
-
def converted_object_ids_after_search(event_name, index_name,
|
172
|
-
object_ids, query_id, opts = {})
|
173
|
-
@insights_client.send_event({
|
174
|
-
eventType: 'conversion',
|
175
|
-
eventName: event_name,
|
176
|
-
index: index_name,
|
177
|
-
userToken: @user_token,
|
178
|
-
objectIds: object_ids,
|
179
|
-
queryId: query_id
|
180
|
-
}, opts)
|
181
|
-
end
|
182
|
-
|
183
|
-
# Send a conversion event to capture the filters a user uses when converting.
|
184
|
-
#
|
185
|
-
# @param event_name [String] Name of the event.
|
186
|
-
# @param index_name [String] Name of the index related to the click.
|
187
|
-
# @param filters [Array] A list of filters (limited to 10)
|
188
|
-
#
|
189
|
-
# @return [Hash]
|
190
|
-
#
|
191
|
-
def converted_filters(event_name, index_name, filters, opts = {})
|
192
|
-
@insights_client.send_event({
|
193
|
-
eventType: 'conversion',
|
194
|
-
eventName: event_name,
|
195
|
-
index: index_name,
|
196
|
-
userToken: @user_token,
|
197
|
-
filters: filters
|
198
|
-
}, opts)
|
199
|
-
end
|
200
|
-
|
201
|
-
# Send a view event to capture clicked items.
|
202
|
-
#
|
203
|
-
# @param event_name [String] Name of the event.
|
204
|
-
# @param index_name [String] Name of the index related to the click.
|
205
|
-
# @param object_ids [Array] A list of objectIDs (limited to 20)
|
206
|
-
#
|
207
|
-
# @return [Hash]
|
208
|
-
#
|
209
|
-
def viewed_object_ids(event_name, index_name, object_ids, opts = {})
|
210
|
-
@insights_client.send_event({
|
211
|
-
eventType: 'view',
|
212
|
-
eventName: event_name,
|
213
|
-
index: index_name,
|
214
|
-
userToken: @user_token,
|
215
|
-
objectIds: object_ids
|
216
|
-
}, opts)
|
217
|
-
end
|
218
|
-
|
219
|
-
# Send a view event to capture the filters a user uses when viewing.
|
220
|
-
#
|
221
|
-
# @param event_name [String] Name of the event.
|
222
|
-
# @param index_name [String] Name of the index related to the click.
|
223
|
-
# @param filters [Array] A list of filters (limited to 10)
|
224
|
-
#
|
225
|
-
# @return [Hash]
|
226
|
-
#
|
227
|
-
def viewed_filters(event_name, index_name, filters, opts = {})
|
228
|
-
@insights_client.send_event({
|
229
|
-
eventType: 'view',
|
230
|
-
eventName: event_name,
|
231
|
-
index: index_name,
|
232
|
-
userToken: @user_token,
|
233
|
-
filters: filters
|
234
|
-
}, opts)
|
235
|
-
end
|
236
|
-
end
|
237
|
-
end
|
238
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module Algolia
|
2
|
-
class BaseIterator
|
3
|
-
include Helpers
|
4
|
-
include Enumerable
|
5
|
-
|
6
|
-
attr_reader :transporter, :index_name, :opts
|
7
|
-
|
8
|
-
# @param transporter [Transport::Transport] transporter used for requests
|
9
|
-
# @param index_name [String] Name of the index
|
10
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
11
|
-
#
|
12
|
-
def initialize(transporter, index_name, opts)
|
13
|
-
@transporter = transporter
|
14
|
-
@index_name = index_name
|
15
|
-
@opts = opts
|
16
|
-
@response = nil
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
module Algolia
|
2
|
-
class ObjectIterator < BaseIterator
|
3
|
-
# Custom each function to iterate through the objects
|
4
|
-
#
|
5
|
-
def each
|
6
|
-
loop do
|
7
|
-
data = {}
|
8
|
-
|
9
|
-
if @response
|
10
|
-
parsed_response = symbolize_hash(@response)
|
11
|
-
if parsed_response[:hits].length
|
12
|
-
parsed_response[:hits].each do |hit|
|
13
|
-
yield hit
|
14
|
-
end
|
15
|
-
|
16
|
-
if parsed_response[:cursor].nil?
|
17
|
-
@response = nil
|
18
|
-
raise StopIteration
|
19
|
-
else
|
20
|
-
data[:cursor] = parsed_response[:cursor]
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
@response = @transporter.read(:POST, path_encode('1/indexes/%s/browse', @index_name), data, @opts)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
module Algolia
|
2
|
-
class PaginatorIterator < BaseIterator
|
3
|
-
# @param transporter [Transport::Transport] transporter used for requests
|
4
|
-
# @param index_name [String] Name of the index
|
5
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
6
|
-
#
|
7
|
-
def initialize(transporter, index_name, opts)
|
8
|
-
super(transporter, index_name, opts)
|
9
|
-
|
10
|
-
@data = {
|
11
|
-
hitsPerPage: 1000,
|
12
|
-
page: 0
|
13
|
-
}
|
14
|
-
end
|
15
|
-
|
16
|
-
def each
|
17
|
-
loop do
|
18
|
-
if @response
|
19
|
-
parsed_response = symbolize_hash(@response)
|
20
|
-
parsed_data = symbolize_hash(@data)
|
21
|
-
if parsed_response[:hits].length
|
22
|
-
parsed_response[:hits].each do |hit|
|
23
|
-
hit.delete(:_highlightResult)
|
24
|
-
yield hit
|
25
|
-
end
|
26
|
-
|
27
|
-
if parsed_response[:nbHits] < parsed_data[:hitsPerPage]
|
28
|
-
@response = nil
|
29
|
-
@data = {
|
30
|
-
hitsPerPage: 1000,
|
31
|
-
page: 0
|
32
|
-
}
|
33
|
-
raise StopIteration
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
@response = @transporter.read(:POST, get_endpoint, @data, @opts)
|
38
|
-
@data[:page] += 1
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def get_endpoint
|
43
|
-
raise AlgoliaError, 'Method must be implemented'
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
@@ -1,60 +0,0 @@
|
|
1
|
-
module Algolia
|
2
|
-
module Personalization
|
3
|
-
class Client
|
4
|
-
# Initializes the Personalization client
|
5
|
-
#
|
6
|
-
# @param personalization_config [Personalization::Config] a Personalization::Config object which contains your APP_ID and API_KEY
|
7
|
-
# @option adapter [Object] adapter object used for the connection
|
8
|
-
# @option logger [Object]
|
9
|
-
# @option http_requester [Object] http_requester object used for the connection
|
10
|
-
#
|
11
|
-
def initialize(personalization_config, opts = {})
|
12
|
-
@config = personalization_config
|
13
|
-
adapter = opts[:adapter] || Defaults::ADAPTER
|
14
|
-
logger = opts[:logger] || LoggerHelper.create
|
15
|
-
requester = opts[:http_requester] || Defaults::REQUESTER_CLASS.new(adapter, logger)
|
16
|
-
@transporter = Transport::Transport.new(@config, requester)
|
17
|
-
end
|
18
|
-
|
19
|
-
# Create a new client providing only app ID and API key
|
20
|
-
#
|
21
|
-
# @param app_id [String] Algolia application ID
|
22
|
-
# @param api_key [String] Algolia API key
|
23
|
-
#
|
24
|
-
# @return self
|
25
|
-
#
|
26
|
-
def self.create(app_id, api_key)
|
27
|
-
config = Personalization::Config.new(application_id: app_id, api_key: api_key)
|
28
|
-
create_with_config(config)
|
29
|
-
end
|
30
|
-
|
31
|
-
# Create a new client providing only an Personalization::Config object
|
32
|
-
#
|
33
|
-
# @param config [Personalization::Config]
|
34
|
-
#
|
35
|
-
# @return self
|
36
|
-
#
|
37
|
-
def self.create_with_config(config)
|
38
|
-
new(config)
|
39
|
-
end
|
40
|
-
|
41
|
-
# Set the personalization strategy.
|
42
|
-
#
|
43
|
-
# @param personalization_strategy [Hash] A strategy object.
|
44
|
-
#
|
45
|
-
# @return [Hash]
|
46
|
-
#
|
47
|
-
def set_personalization_strategy(personalization_strategy, opts = {})
|
48
|
-
@transporter.write(:POST, '1/strategies/personalization', personalization_strategy, opts)
|
49
|
-
end
|
50
|
-
|
51
|
-
# Get the personalization strategy.
|
52
|
-
#
|
53
|
-
# @return [Hash]
|
54
|
-
#
|
55
|
-
def get_personalization_strategy(opts = {})
|
56
|
-
@transporter.read(:GET, '1/strategies/personalization', {}, opts)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|