algolia 3.0.0.beta.8 → 3.0.0.beta.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/release.yml +2 -0
- data/CHANGELOG.md +15 -0
- data/Gemfile.lock +6 -31
- data/Rakefile +0 -2
- data/algolia.gemspec +1 -1
- data/lib/algolia/api/abtesting_client.rb +52 -37
- data/lib/algolia/api/analytics_client.rb +415 -116
- data/lib/algolia/api/ingestion_client.rb +462 -182
- data/lib/algolia/api/insights_client.rb +45 -28
- data/lib/algolia/api/monitoring_client.rb +50 -44
- data/lib/algolia/api/personalization_client.rb +57 -32
- data/lib/algolia/api/query_suggestions_client.rb +59 -40
- data/lib/algolia/api/recommend_client.rb +70 -43
- data/lib/algolia/api/search_client.rb +474 -277
- data/lib/algolia/api/usage_client.rb +48 -28
- data/lib/algolia/api_client.rb +25 -24
- data/lib/algolia/api_error.rb +8 -8
- data/lib/algolia/configuration.rb +17 -6
- data/lib/algolia/error.rb +2 -2
- data/lib/algolia/logger_helper.rb +4 -4
- data/lib/algolia/models/abtesting/ab_test.rb +62 -37
- data/lib/algolia/models/abtesting/ab_test_configuration.rb +35 -20
- data/lib/algolia/models/abtesting/ab_test_response.rb +35 -20
- data/lib/algolia/models/abtesting/ab_tests_variant.rb +38 -23
- data/lib/algolia/models/abtesting/ab_tests_variant_search_params.rb +41 -26
- data/lib/algolia/models/abtesting/add_ab_tests_request.rb +38 -23
- data/lib/algolia/models/abtesting/add_ab_tests_variant.rb +33 -24
- data/lib/algolia/models/abtesting/currency.rb +32 -20
- data/lib/algolia/models/abtesting/custom_search_params.rb +33 -18
- data/lib/algolia/models/abtesting/effect.rb +2 -3
- data/lib/algolia/models/abtesting/empty_search.rb +33 -18
- data/lib/algolia/models/abtesting/error_base.rb +24 -13
- data/lib/algolia/models/abtesting/filter_effects.rb +34 -19
- data/lib/algolia/models/abtesting/filter_effects_empty_search.rb +34 -19
- data/lib/algolia/models/abtesting/filter_effects_outliers.rb +34 -19
- data/lib/algolia/models/abtesting/list_ab_tests_response.rb +37 -22
- data/lib/algolia/models/abtesting/minimum_detectable_effect.rb +37 -22
- data/lib/algolia/models/abtesting/outliers.rb +29 -17
- data/lib/algolia/models/abtesting/status.rb +2 -3
- data/lib/algolia/models/abtesting/variant.rb +83 -51
- data/lib/algolia/models/analytics/click_positions_inner.rb +39 -24
- data/lib/algolia/models/analytics/currencies_value.rb +34 -19
- data/lib/algolia/models/analytics/daily_add_to_cart_rates.rb +42 -27
- data/lib/algolia/models/analytics/daily_average_clicks.rb +40 -25
- data/lib/algolia/models/analytics/daily_click_through_rates.rb +42 -27
- data/lib/algolia/models/analytics/daily_conversion_rates.rb +42 -27
- data/lib/algolia/models/analytics/daily_no_click_rates.rb +41 -26
- data/lib/algolia/models/analytics/daily_no_results_rates.rb +39 -24
- data/lib/algolia/models/analytics/daily_purchase_rates.rb +40 -25
- data/lib/algolia/models/analytics/daily_revenue.rb +34 -19
- data/lib/algolia/models/analytics/daily_searches.rb +34 -19
- data/lib/algolia/models/analytics/daily_searches_no_clicks.rb +37 -22
- data/lib/algolia/models/analytics/daily_searches_no_results.rb +37 -22
- data/lib/algolia/models/analytics/daily_users.rb +34 -19
- data/lib/algolia/models/analytics/direction.rb +2 -3
- data/lib/algolia/models/analytics/error_base.rb +24 -13
- data/lib/algolia/models/analytics/get_add_to_cart_rate_response.rb +42 -27
- data/lib/algolia/models/analytics/get_average_click_position_response.rb +40 -25
- data/lib/algolia/models/analytics/get_click_positions_response.rb +36 -21
- data/lib/algolia/models/analytics/get_click_through_rate_response.rb +42 -27
- data/lib/algolia/models/analytics/get_conversion_rate_response.rb +42 -27
- data/lib/algolia/models/analytics/get_no_click_rate_response.rb +41 -26
- data/lib/algolia/models/analytics/get_no_results_rate_response.rb +39 -24
- data/lib/algolia/models/analytics/get_purchase_rate_response.rb +40 -25
- data/lib/algolia/models/analytics/get_revenue.rb +34 -19
- data/lib/algolia/models/analytics/get_searches_count_response.rb +34 -19
- data/lib/algolia/models/analytics/get_searches_no_clicks_response.rb +33 -18
- data/lib/algolia/models/analytics/get_searches_no_results_response.rb +33 -18
- data/lib/algolia/models/analytics/get_status_response.rb +35 -20
- data/lib/algolia/models/analytics/get_top_countries_response.rb +33 -18
- data/lib/algolia/models/analytics/get_top_filter_attribute.rb +34 -19
- data/lib/algolia/models/analytics/get_top_filter_attributes_response.rb +33 -18
- data/lib/algolia/models/analytics/get_top_filter_for_attribute.rb +36 -21
- data/lib/algolia/models/analytics/get_top_filter_for_attribute_response.rb +33 -18
- data/lib/algolia/models/analytics/get_top_filters_no_results_response.rb +35 -20
- data/lib/algolia/models/analytics/get_top_filters_no_results_value.rb +35 -20
- data/lib/algolia/models/analytics/get_top_filters_no_results_values.rb +34 -19
- data/lib/algolia/models/analytics/get_top_hits_response.rb +34 -25
- data/lib/algolia/models/analytics/get_top_searches_response.rb +34 -25
- data/lib/algolia/models/analytics/get_users_count_response.rb +34 -19
- data/lib/algolia/models/analytics/operator.rb +2 -3
- data/lib/algolia/models/analytics/order_by.rb +2 -3
- data/lib/algolia/models/analytics/top_country.rb +34 -19
- data/lib/algolia/models/analytics/top_hit.rb +30 -18
- data/lib/algolia/models/analytics/top_hit_with_analytics.rb +50 -35
- data/lib/algolia/models/analytics/top_hit_with_revenue_analytics.rb +77 -50
- data/lib/algolia/models/analytics/top_hits_response.rb +33 -18
- data/lib/algolia/models/analytics/top_hits_response_with_analytics.rb +33 -18
- data/lib/algolia/models/analytics/top_hits_response_with_revenue_analytics.rb +33 -18
- data/lib/algolia/models/analytics/top_search.rb +35 -20
- data/lib/algolia/models/analytics/top_search_with_analytics.rb +76 -44
- data/lib/algolia/models/analytics/top_search_with_revenue_analytics.rb +94 -58
- data/lib/algolia/models/analytics/top_searches_response.rb +33 -18
- data/lib/algolia/models/analytics/top_searches_response_with_analytics.rb +33 -18
- data/lib/algolia/models/analytics/top_searches_response_with_revenue_analytics.rb +33 -18
- data/lib/algolia/models/ingestion/action_type.rb +2 -3
- data/lib/algolia/models/ingestion/auth_algolia.rb +34 -19
- data/lib/algolia/models/ingestion/auth_algolia_insights.rb +34 -19
- data/lib/algolia/models/ingestion/auth_algolia_insights_partial.rb +34 -19
- data/lib/algolia/models/ingestion/auth_algolia_partial.rb +34 -19
- data/lib/algolia/models/ingestion/auth_api_key.rb +33 -18
- data/lib/algolia/models/ingestion/auth_api_key_partial.rb +33 -18
- data/lib/algolia/models/ingestion/auth_basic.rb +34 -19
- data/lib/algolia/models/ingestion/auth_basic_partial.rb +34 -19
- data/lib/algolia/models/ingestion/auth_google_service_account.rb +34 -19
- data/lib/algolia/models/ingestion/auth_google_service_account_partial.rb +34 -19
- data/lib/algolia/models/ingestion/auth_input.rb +37 -28
- data/lib/algolia/models/ingestion/auth_input_partial.rb +37 -28
- data/lib/algolia/models/ingestion/auth_o_auth.rb +36 -21
- data/lib/algolia/models/ingestion/auth_o_auth_partial.rb +36 -21
- data/lib/algolia/models/ingestion/authentication.rb +41 -26
- data/lib/algolia/models/ingestion/authentication_create.rb +38 -23
- data/lib/algolia/models/ingestion/authentication_create_response.rb +35 -20
- data/lib/algolia/models/ingestion/authentication_search.rb +33 -18
- data/lib/algolia/models/ingestion/authentication_sort_keys.rb +2 -3
- data/lib/algolia/models/ingestion/authentication_type.rb +2 -3
- data/lib/algolia/models/ingestion/authentication_update.rb +38 -23
- data/lib/algolia/models/ingestion/authentication_update_response.rb +35 -20
- data/lib/algolia/models/ingestion/big_commerce_channel.rb +34 -19
- data/lib/algolia/models/ingestion/big_commerce_metafield.rb +34 -19
- data/lib/algolia/models/ingestion/big_query_data_type.rb +2 -3
- data/lib/algolia/models/ingestion/commercetools_custom_fields.rb +39 -24
- data/lib/algolia/models/ingestion/delete_response.rb +33 -18
- data/lib/algolia/models/ingestion/destination.rb +39 -24
- data/lib/algolia/models/ingestion/destination_create.rb +36 -21
- data/lib/algolia/models/ingestion/destination_create_response.rb +35 -20
- data/lib/algolia/models/ingestion/destination_index_name.rb +35 -20
- data/lib/algolia/models/ingestion/destination_index_prefix.rb +33 -18
- data/lib/algolia/models/ingestion/destination_input.rb +33 -24
- data/lib/algolia/models/ingestion/destination_search.rb +33 -18
- data/lib/algolia/models/ingestion/destination_sort_keys.rb +2 -3
- data/lib/algolia/models/ingestion/destination_type.rb +2 -3
- data/lib/algolia/models/ingestion/destination_update.rb +36 -21
- data/lib/algolia/models/ingestion/destination_update_response.rb +35 -20
- data/lib/algolia/models/ingestion/docker_image_type.rb +2 -3
- data/lib/algolia/models/ingestion/docker_registry.rb +2 -3
- data/lib/algolia/models/ingestion/{on_demand_date_utils_input.rb → docker_streams_input.rb} +41 -49
- data/lib/algolia/models/ingestion/error_base.rb +24 -13
- data/lib/algolia/models/ingestion/event.rb +38 -26
- data/lib/algolia/models/ingestion/event_sort_keys.rb +2 -3
- data/lib/algolia/models/ingestion/event_status.rb +2 -3
- data/lib/algolia/models/ingestion/event_type.rb +2 -3
- data/lib/algolia/models/ingestion/list_authentications_response.rb +34 -19
- data/lib/algolia/models/ingestion/list_destinations_response.rb +34 -19
- data/lib/algolia/models/ingestion/list_events_response.rb +35 -20
- data/lib/algolia/models/ingestion/list_sources_response.rb +34 -19
- data/lib/algolia/models/ingestion/list_tasks_response.rb +34 -19
- data/lib/algolia/models/ingestion/list_transformations_response.rb +34 -19
- data/lib/algolia/models/ingestion/mapping_field_directive.rb +34 -19
- data/lib/algolia/models/ingestion/mapping_format_schema.rb +2 -3
- data/lib/algolia/models/ingestion/mapping_input.rb +34 -19
- data/lib/algolia/models/ingestion/mapping_kit_action.rb +36 -21
- data/lib/algolia/models/ingestion/mapping_type_csv.rb +2 -3
- data/lib/algolia/models/ingestion/method_type.rb +2 -3
- data/lib/algolia/models/ingestion/on_demand_trigger.rb +34 -19
- data/lib/algolia/models/ingestion/on_demand_trigger_input.rb +33 -18
- data/lib/algolia/models/ingestion/on_demand_trigger_type.rb +2 -3
- data/lib/algolia/models/ingestion/order_keys.rb +2 -3
- data/lib/algolia/models/ingestion/pagination.rb +45 -30
- data/lib/algolia/models/ingestion/platform.rb +2 -3
- data/lib/algolia/models/ingestion/platform_none.rb +2 -3
- data/lib/algolia/models/ingestion/platform_with_none.rb +33 -24
- data/lib/algolia/models/ingestion/record_type.rb +2 -3
- data/lib/algolia/models/ingestion/run.rb +59 -33
- data/lib/algolia/models/ingestion/run_list_response.rb +35 -20
- data/lib/algolia/models/ingestion/run_outcome.rb +2 -3
- data/lib/algolia/models/ingestion/run_progress.rb +34 -19
- data/lib/algolia/models/ingestion/run_reason_code.rb +2 -3
- data/lib/algolia/models/ingestion/run_response.rb +34 -19
- data/lib/algolia/models/ingestion/run_sort_keys.rb +2 -3
- data/lib/algolia/models/ingestion/run_status.rb +2 -3
- data/lib/algolia/models/ingestion/run_type.rb +2 -3
- data/lib/algolia/models/ingestion/schedule_trigger.rb +36 -21
- data/lib/algolia/models/ingestion/schedule_trigger_input.rb +34 -19
- data/lib/algolia/models/ingestion/schedule_trigger_type.rb +2 -3
- data/lib/algolia/models/ingestion/shopify_input.rb +34 -19
- data/lib/algolia/models/ingestion/shopify_market.rb +35 -20
- data/lib/algolia/models/ingestion/shopify_metafield.rb +35 -20
- data/lib/algolia/models/ingestion/sort_keys.rb +2 -3
- data/lib/algolia/models/ingestion/source.rb +35 -23
- data/lib/algolia/models/ingestion/source_big_commerce.rb +37 -22
- data/lib/algolia/models/ingestion/source_big_query.rb +39 -24
- data/lib/algolia/models/ingestion/source_commercetools.rb +38 -23
- data/lib/algolia/models/ingestion/source_create.rb +36 -21
- data/lib/algolia/models/ingestion/source_create_response.rb +35 -20
- data/lib/algolia/models/ingestion/source_csv.rb +43 -25
- data/lib/algolia/models/ingestion/source_docker.rb +37 -22
- data/lib/algolia/models/ingestion/source_ga4_big_query_export.rb +35 -20
- data/lib/algolia/models/ingestion/source_input.rb +39 -30
- data/lib/algolia/models/ingestion/source_json.rb +35 -20
- data/lib/algolia/models/ingestion/source_search.rb +33 -18
- data/lib/algolia/models/ingestion/source_shopify.rb +45 -89
- data/lib/algolia/models/ingestion/source_shopify_base.rb +33 -18
- data/lib/algolia/models/ingestion/source_sort_keys.rb +2 -3
- data/lib/algolia/models/ingestion/source_type.rb +2 -3
- data/lib/algolia/models/ingestion/source_update.rb +35 -20
- data/lib/algolia/models/ingestion/source_update_commercetools.rb +37 -22
- data/lib/algolia/models/ingestion/source_update_docker.rb +36 -21
- data/lib/algolia/models/ingestion/source_update_input.rb +38 -29
- data/lib/algolia/models/ingestion/source_update_response.rb +35 -20
- data/lib/algolia/models/ingestion/source_update_shopify.rb +42 -86
- data/lib/algolia/models/ingestion/source_watch_response.rb +36 -21
- data/lib/algolia/models/ingestion/{streaming_utils_input.rb → streaming_input.rb} +34 -19
- data/lib/algolia/models/ingestion/streaming_trigger.rb +33 -18
- data/lib/algolia/models/ingestion/streaming_trigger_type.rb +2 -3
- data/lib/algolia/models/ingestion/subscription_trigger.rb +33 -18
- data/lib/algolia/models/ingestion/subscription_trigger_type.rb +2 -3
- data/lib/algolia/models/ingestion/task.rb +55 -31
- data/lib/algolia/models/ingestion/task_create.rb +43 -28
- data/lib/algolia/models/ingestion/task_create_response.rb +34 -19
- data/lib/algolia/models/ingestion/task_create_trigger.rb +35 -26
- data/lib/algolia/models/ingestion/task_input.rb +34 -26
- data/lib/algolia/models/ingestion/task_search.rb +33 -18
- data/lib/algolia/models/ingestion/task_sort_keys.rb +2 -3
- data/lib/algolia/models/ingestion/task_update.rb +40 -25
- data/lib/algolia/models/ingestion/task_update_response.rb +34 -19
- data/lib/algolia/models/ingestion/transformation.rb +38 -25
- data/lib/algolia/models/ingestion/transformation_create.rb +35 -22
- data/lib/algolia/models/ingestion/transformation_create_response.rb +34 -19
- data/lib/algolia/models/ingestion/transformation_search.rb +33 -18
- data/lib/algolia/models/ingestion/transformation_try.rb +34 -19
- data/lib/algolia/models/ingestion/transformation_try_response.rb +34 -19
- data/lib/algolia/models/ingestion/transformation_try_response_error.rb +34 -19
- data/lib/algolia/models/ingestion/transformation_update_response.rb +34 -19
- data/lib/algolia/models/ingestion/trigger.rb +35 -26
- data/lib/algolia/models/ingestion/trigger_type.rb +2 -3
- data/lib/algolia/models/ingestion/trigger_update_input.rb +33 -18
- data/lib/algolia/models/ingestion/window.rb +30 -18
- data/lib/algolia/models/insights/add_to_cart_event.rb +2 -3
- data/lib/algolia/models/insights/added_to_cart_object_ids.rb +91 -46
- data/lib/algolia/models/insights/added_to_cart_object_ids_after_search.rb +99 -50
- data/lib/algolia/models/insights/click_event.rb +2 -3
- data/lib/algolia/models/insights/clicked_filters.rb +71 -38
- data/lib/algolia/models/insights/clicked_object_ids.rb +71 -38
- data/lib/algolia/models/insights/clicked_object_ids_after_search.rb +93 -47
- data/lib/algolia/models/insights/conversion_event.rb +2 -3
- data/lib/algolia/models/insights/converted_filters.rb +71 -38
- data/lib/algolia/models/insights/converted_object_ids.rb +71 -38
- data/lib/algolia/models/insights/converted_object_ids_after_search.rb +78 -42
- data/lib/algolia/models/insights/discount.rb +33 -24
- data/lib/algolia/models/insights/error_base.rb +24 -13
- data/lib/algolia/models/insights/events_items.rb +43 -34
- data/lib/algolia/models/insights/events_response.rb +34 -19
- data/lib/algolia/models/insights/insights_events.rb +36 -21
- data/lib/algolia/models/insights/object_data.rb +35 -20
- data/lib/algolia/models/insights/object_data_after_search.rb +42 -24
- data/lib/algolia/models/insights/price.rb +33 -24
- data/lib/algolia/models/insights/purchase_event.rb +2 -3
- data/lib/algolia/models/insights/purchased_object_ids.rb +91 -46
- data/lib/algolia/models/insights/purchased_object_ids_after_search.rb +91 -46
- data/lib/algolia/models/insights/value.rb +33 -24
- data/lib/algolia/models/insights/view_event.rb +2 -3
- data/lib/algolia/models/insights/viewed_filters.rb +71 -38
- data/lib/algolia/models/insights/viewed_object_ids.rb +71 -38
- data/lib/algolia/models/monitoring/error_base.rb +24 -13
- data/lib/algolia/models/monitoring/get_servers403_response.rb +33 -18
- data/lib/algolia/models/monitoring/incident.rb +30 -18
- data/lib/algolia/models/monitoring/incidents_inner.rb +34 -19
- data/lib/algolia/models/monitoring/incidents_response.rb +33 -18
- data/lib/algolia/models/monitoring/indexing_time_response.rb +33 -18
- data/lib/algolia/models/monitoring/indexing_time_response_metrics.rb +33 -18
- data/lib/algolia/models/monitoring/infrastructure_response.rb +33 -18
- data/lib/algolia/models/monitoring/infrastructure_response_metrics.rb +37 -22
- data/lib/algolia/models/monitoring/inventory_response.rb +33 -18
- data/lib/algolia/models/monitoring/latency_response.rb +33 -18
- data/lib/algolia/models/monitoring/latency_response_metrics.rb +33 -18
- data/lib/algolia/models/monitoring/metric.rb +2 -3
- data/lib/algolia/models/monitoring/period.rb +2 -3
- data/lib/algolia/models/monitoring/probes_metric.rb +34 -19
- data/lib/algolia/models/monitoring/region.rb +2 -3
- data/lib/algolia/models/monitoring/server.rb +35 -23
- data/lib/algolia/models/monitoring/server_status.rb +2 -3
- data/lib/algolia/models/monitoring/status.rb +2 -3
- data/lib/algolia/models/monitoring/status_response.rb +33 -18
- data/lib/algolia/models/monitoring/time_inner.rb +34 -19
- data/lib/algolia/models/monitoring/type.rb +2 -3
- data/lib/algolia/models/personalization/delete_user_profile_response.rb +34 -19
- data/lib/algolia/models/personalization/error_base.rb +24 -13
- data/lib/algolia/models/personalization/event_scoring.rb +35 -20
- data/lib/algolia/models/personalization/event_type.rb +2 -3
- data/lib/algolia/models/personalization/facet_scoring.rb +34 -19
- data/lib/algolia/models/personalization/get_user_token_response.rb +35 -20
- data/lib/algolia/models/personalization/personalization_strategy_params.rb +38 -23
- data/lib/algolia/models/personalization/set_personalization_strategy_response.rb +33 -18
- data/lib/algolia/models/query-suggestions/app_id.rb +29 -17
- data/lib/algolia/models/query-suggestions/base_query_suggestions_configuration_response.rb +22 -9
- data/lib/algolia/models/query-suggestions/base_query_suggestions_configuration_with_index.rb +22 -9
- data/lib/algolia/models/query-suggestions/base_response.rb +34 -19
- data/lib/algolia/models/query-suggestions/configuration.rb +44 -26
- data/lib/algolia/models/query-suggestions/configuration_response.rb +48 -30
- data/lib/algolia/models/query-suggestions/configuration_with_index.rb +46 -28
- data/lib/algolia/models/query-suggestions/error_base.rb +24 -13
- data/lib/algolia/models/query-suggestions/facet.rb +30 -18
- data/lib/algolia/models/query-suggestions/get_config_status200_response.rb +37 -22
- data/lib/algolia/models/query-suggestions/get_log_file200_response.rb +36 -21
- data/lib/algolia/models/query-suggestions/languages.rb +33 -24
- data/lib/algolia/models/query-suggestions/log_level.rb +2 -3
- data/lib/algolia/models/query-suggestions/query_suggestions_configuration.rb +34 -16
- data/lib/algolia/models/query-suggestions/query_suggestions_configuration_response.rb +34 -16
- data/lib/algolia/models/query-suggestions/query_suggestions_configuration_with_index.rb +34 -16
- data/lib/algolia/models/query-suggestions/source_index.rb +49 -34
- data/lib/algolia/models/recommend/advanced_syntax_features.rb +2 -3
- data/lib/algolia/models/recommend/alternatives_as_exact.rb +2 -3
- data/lib/algolia/models/recommend/around_precision.rb +33 -24
- data/lib/algolia/models/recommend/around_precision_from_value_inner.rb +34 -19
- data/lib/algolia/models/recommend/around_radius.rb +33 -24
- data/lib/algolia/models/recommend/around_radius_all.rb +2 -3
- data/lib/algolia/models/recommend/auto_facet_filter.rb +34 -19
- data/lib/algolia/models/recommend/base_recommend_request.rb +42 -27
- data/lib/algolia/models/recommend/base_search_params.rb +110 -63
- data/lib/algolia/models/recommend/base_search_params_without_query.rb +106 -60
- data/lib/algolia/models/recommend/base_search_response.rb +76 -121
- data/lib/algolia/models/recommend/bought_together_query.rb +46 -31
- data/lib/algolia/models/recommend/condition.rb +35 -20
- data/lib/algolia/models/recommend/consequence.rb +39 -24
- data/lib/algolia/models/recommend/deleted_at_response.rb +34 -19
- data/lib/algolia/models/recommend/distinct.rb +33 -24
- data/lib/algolia/models/recommend/error_base.rb +24 -13
- data/lib/algolia/models/recommend/exact_on_single_word_query.rb +2 -3
- data/lib/algolia/models/recommend/exhaustive.rb +37 -22
- data/lib/algolia/models/recommend/facet_filters.rb +33 -24
- data/lib/algolia/models/recommend/facet_ordering.rb +34 -19
- data/lib/algolia/models/recommend/facets.rb +29 -17
- data/lib/algolia/models/recommend/facets_stats.rb +36 -21
- data/lib/algolia/models/recommend/fallback_params.rb +207 -118
- data/lib/algolia/models/recommend/fbt_model.rb +2 -3
- data/lib/algolia/models/recommend/frequently_bought_together.rb +34 -19
- data/lib/algolia/models/recommend/get_recommend_task_response.rb +33 -18
- data/lib/algolia/models/recommend/get_recommendations_params.rb +33 -18
- data/lib/algolia/models/recommend/get_recommendations_response.rb +35 -18
- data/lib/algolia/models/recommend/hide_consequence_object.rb +33 -18
- data/lib/algolia/models/recommend/highlight_result.rb +34 -25
- data/lib/algolia/models/recommend/highlight_result_option.rb +36 -21
- data/lib/algolia/models/recommend/ignore_plurals.rb +33 -24
- data/lib/algolia/models/recommend/index_settings_as_search_params.rb +134 -75
- data/lib/algolia/models/recommend/looking_similar.rb +35 -20
- data/lib/algolia/models/recommend/looking_similar_model.rb +2 -3
- data/lib/algolia/models/recommend/looking_similar_query.rb +47 -32
- data/lib/algolia/models/recommend/match_level.rb +2 -3
- data/lib/algolia/models/recommend/matched_geo_location.rb +35 -20
- data/lib/algolia/models/recommend/mode.rb +2 -3
- data/lib/algolia/models/recommend/numeric_filters.rb +33 -24
- data/lib/algolia/models/recommend/optional_filters.rb +33 -24
- data/lib/algolia/models/recommend/params_consequence.rb +35 -20
- data/lib/algolia/models/recommend/personalization.rb +35 -20
- data/lib/algolia/models/recommend/promote_consequence_object.rb +36 -21
- data/lib/algolia/models/recommend/query_type.rb +2 -3
- data/lib/algolia/models/recommend/ranking_info.rb +76 -48
- data/lib/algolia/models/recommend/re_ranking_apply_filter.rb +33 -24
- data/lib/algolia/models/recommend/recommend_hit.rb +32 -21
- data/lib/algolia/models/recommend/recommend_models.rb +2 -3
- data/lib/algolia/models/recommend/recommend_rule.rb +38 -23
- data/lib/algolia/models/recommend/recommend_rule_metadata.rb +33 -18
- data/lib/algolia/models/recommend/recommendations_hit.rb +33 -24
- data/lib/algolia/models/recommend/recommendations_hits.rb +33 -18
- data/lib/algolia/models/recommend/recommendations_request.rb +37 -28
- data/lib/algolia/models/recommend/recommendations_results.rb +159 -114
- data/lib/algolia/models/recommend/recommended_for_you.rb +34 -19
- data/lib/algolia/models/recommend/recommended_for_you_model.rb +2 -3
- data/lib/algolia/models/recommend/recommended_for_you_query.rb +46 -31
- data/lib/algolia/models/recommend/redirect.rb +29 -17
- data/lib/algolia/models/recommend/redirect_rule_index_metadata.rb +37 -22
- data/lib/algolia/models/recommend/redirect_rule_index_metadata_data.rb +33 -18
- data/lib/algolia/models/recommend/redirect_url.rb +33 -18
- data/lib/algolia/models/recommend/related_model.rb +2 -3
- data/lib/algolia/models/recommend/related_products.rb +35 -20
- data/lib/algolia/models/recommend/related_query.rb +47 -32
- data/lib/algolia/models/recommend/remove_stop_words.rb +33 -24
- data/lib/algolia/models/recommend/remove_words_if_no_results.rb +2 -3
- data/lib/algolia/models/recommend/rendering_content.rb +34 -19
- data/lib/algolia/models/recommend/search_pagination.rb +282 -0
- data/lib/algolia/models/recommend/search_params.rb +207 -118
- data/lib/algolia/models/recommend/search_params_object.rb +208 -119
- data/lib/algolia/models/recommend/search_params_query.rb +33 -18
- data/lib/algolia/models/recommend/search_recommend_rules_params.rb +48 -33
- data/lib/algolia/models/recommend/search_recommend_rules_response.rb +38 -23
- data/lib/algolia/models/recommend/semantic_search.rb +35 -20
- data/lib/algolia/models/recommend/snippet_result.rb +34 -25
- data/lib/algolia/models/recommend/snippet_result_option.rb +34 -19
- data/lib/algolia/models/recommend/sort_remaining_by.rb +2 -3
- data/lib/algolia/models/recommend/supported_language.rb +72 -5
- data/lib/algolia/models/recommend/tag_filters.rb +33 -24
- data/lib/algolia/models/recommend/task_status.rb +2 -3
- data/lib/algolia/models/recommend/trending_facet_hit.rb +38 -23
- data/lib/algolia/models/recommend/trending_facets.rb +37 -22
- data/lib/algolia/models/recommend/trending_facets_model.rb +2 -3
- data/lib/algolia/models/recommend/trending_facets_query.rb +49 -34
- data/lib/algolia/models/recommend/trending_items.rb +36 -25
- data/lib/algolia/models/recommend/trending_items_model.rb +2 -3
- data/lib/algolia/models/recommend/trending_items_query.rb +58 -38
- data/lib/algolia/models/recommend/typo_tolerance.rb +33 -24
- data/lib/algolia/models/recommend/typo_tolerance_enum.rb +2 -3
- data/lib/algolia/models/recommend/value.rb +31 -19
- data/lib/algolia/models/search/acl.rb +19 -5
- data/lib/algolia/models/search/action.rb +11 -4
- data/lib/algolia/models/search/add_api_key_response.rb +34 -19
- data/lib/algolia/models/search/advanced_syntax_features.rb +2 -3
- data/lib/algolia/models/search/alternatives_as_exact.rb +2 -3
- data/lib/algolia/models/search/anchoring.rb +2 -3
- data/lib/algolia/models/search/api_key.rb +46 -25
- data/lib/algolia/models/search/api_key_operation.rb +2 -3
- data/lib/algolia/models/search/around_precision.rb +33 -24
- data/lib/algolia/models/search/around_precision_from_value_inner.rb +34 -19
- data/lib/algolia/models/search/around_radius.rb +33 -24
- data/lib/algolia/models/search/around_radius_all.rb +2 -3
- data/lib/algolia/models/search/assign_user_id_params.rb +33 -18
- data/lib/algolia/models/search/attribute_to_update.rb +33 -24
- data/lib/algolia/models/search/automatic_facet_filter.rb +35 -20
- data/lib/algolia/models/search/automatic_facet_filters.rb +33 -24
- data/lib/algolia/models/search/base_get_api_key_response.rb +34 -19
- data/lib/algolia/models/search/base_index_settings.rb +71 -39
- data/lib/algolia/models/search/base_search_params.rb +110 -63
- data/lib/algolia/models/search/base_search_params_without_query.rb +106 -60
- data/lib/algolia/models/search/base_search_response.rb +76 -121
- data/lib/algolia/models/search/batch_assign_user_ids_params.rb +34 -19
- data/lib/algolia/models/search/batch_dictionary_entries_params.rb +34 -19
- data/lib/algolia/models/search/batch_dictionary_entries_request.rb +34 -19
- data/lib/algolia/models/search/batch_params.rb +33 -18
- data/lib/algolia/models/search/batch_request.rb +34 -19
- data/lib/algolia/models/search/batch_response.rb +34 -19
- data/lib/algolia/models/search/batch_write_params.rb +33 -18
- data/lib/algolia/models/{ingestion/schedule_date_utils_input.rb → search/browse_pagination.rb} +92 -45
- data/lib/algolia/models/search/browse_params.rb +33 -24
- data/lib/algolia/models/search/browse_params_object.rb +210 -120
- data/lib/algolia/models/search/browse_response.rb +158 -118
- data/lib/algolia/models/search/built_in_operation.rb +34 -19
- data/lib/algolia/models/search/built_in_operation_type.rb +2 -3
- data/lib/algolia/models/search/condition.rb +38 -23
- data/lib/algolia/models/search/consequence.rb +43 -28
- data/lib/algolia/models/search/consequence_hide.rb +33 -18
- data/lib/algolia/models/search/consequence_params.rb +213 -122
- data/lib/algolia/models/search/consequence_query.rb +33 -24
- data/lib/algolia/models/search/consequence_query_object.rb +34 -19
- data/lib/algolia/models/search/created_at_response.rb +33 -18
- data/lib/algolia/models/search/cursor.rb +29 -17
- data/lib/algolia/models/search/delete_api_key_response.rb +33 -18
- data/lib/algolia/models/search/delete_by_params.rb +50 -26
- data/lib/algolia/models/search/delete_source_response.rb +33 -18
- data/lib/algolia/models/search/deleted_at_response.rb +34 -19
- data/lib/algolia/models/search/dictionary_action.rb +2 -3
- data/lib/algolia/models/search/dictionary_entry.rb +29 -18
- data/lib/algolia/models/search/dictionary_entry_state.rb +2 -3
- data/lib/algolia/models/search/dictionary_language.rb +33 -18
- data/lib/algolia/models/search/dictionary_settings_params.rb +33 -18
- data/lib/algolia/models/search/dictionary_type.rb +2 -3
- data/lib/algolia/models/search/distinct.rb +33 -24
- data/lib/algolia/models/search/edit.rb +31 -19
- data/lib/algolia/models/search/edit_type.rb +2 -3
- data/lib/algolia/models/search/error_base.rb +24 -13
- data/lib/algolia/models/search/exact_on_single_word_query.rb +2 -3
- data/lib/algolia/models/search/exhaustive.rb +37 -22
- data/lib/algolia/models/search/facet_filters.rb +33 -24
- data/lib/algolia/models/search/facet_hits.rb +35 -20
- data/lib/algolia/models/search/facet_ordering.rb +34 -19
- data/lib/algolia/models/search/facets.rb +29 -17
- data/lib/algolia/models/search/facets_stats.rb +36 -21
- data/lib/algolia/models/search/fetched_index.rb +58 -30
- data/lib/algolia/models/search/get_api_key_response.rb +56 -30
- data/lib/algolia/models/search/get_dictionary_settings_response.rb +33 -18
- data/lib/algolia/models/search/get_logs_response.rb +33 -18
- data/lib/algolia/models/search/get_objects_params.rb +33 -18
- data/lib/algolia/models/search/get_objects_request.rb +35 -20
- data/lib/algolia/models/search/get_objects_response.rb +33 -18
- data/lib/algolia/models/search/get_task_response.rb +33 -18
- data/lib/algolia/models/search/get_top_user_ids_response.rb +33 -18
- data/lib/algolia/models/search/has_pending_mappings_response.rb +34 -19
- data/lib/algolia/models/search/highlight_result.rb +34 -25
- data/lib/algolia/models/search/highlight_result_option.rb +36 -21
- data/lib/algolia/models/search/hit.rb +24 -16
- data/lib/algolia/models/search/ignore_plurals.rb +33 -24
- data/lib/algolia/models/search/index_settings.rb +171 -97
- data/lib/algolia/models/search/index_settings_as_search_params.rb +134 -75
- data/lib/algolia/models/search/languages.rb +39 -24
- data/lib/algolia/models/search/list_api_keys_response.rb +33 -18
- data/lib/algolia/models/search/list_clusters_response.rb +33 -18
- data/lib/algolia/models/search/list_indices_response.rb +34 -19
- data/lib/algolia/models/search/list_user_ids_response.rb +33 -18
- data/lib/algolia/models/search/log.rb +70 -37
- data/lib/algolia/models/search/log_query.rb +31 -19
- data/lib/algolia/models/search/log_type.rb +2 -3
- data/lib/algolia/models/search/match_level.rb +2 -3
- data/lib/algolia/models/search/matched_geo_location.rb +35 -20
- data/lib/algolia/models/search/mode.rb +2 -3
- data/lib/algolia/models/search/multiple_batch_request.rb +35 -20
- data/lib/algolia/models/search/multiple_batch_response.rb +34 -19
- data/lib/algolia/models/search/numeric_filters.rb +33 -24
- data/lib/algolia/models/search/operation_index_params.rb +35 -20
- data/lib/algolia/models/search/operation_type.rb +2 -3
- data/lib/algolia/models/search/optional_filters.rb +33 -24
- data/lib/algolia/models/search/params.rb +32 -20
- data/lib/algolia/models/search/personalization.rb +35 -20
- data/lib/algolia/models/search/promote.rb +33 -24
- data/lib/algolia/models/search/promote_object_id.rb +34 -19
- data/lib/algolia/models/search/promote_object_ids.rb +36 -21
- data/lib/algolia/models/search/query_type.rb +2 -3
- data/lib/algolia/models/search/ranking_info.rb +76 -48
- data/lib/algolia/models/search/re_ranking_apply_filter.rb +33 -24
- data/lib/algolia/models/search/redirect.rb +29 -17
- data/lib/algolia/models/search/redirect_rule_index_metadata.rb +37 -22
- data/lib/algolia/models/search/redirect_rule_index_metadata_data.rb +33 -18
- data/lib/algolia/models/search/redirect_url.rb +33 -18
- data/lib/algolia/models/search/remove_stop_words.rb +33 -24
- data/lib/algolia/models/search/remove_user_id_response.rb +33 -18
- data/lib/algolia/models/search/remove_words_if_no_results.rb +2 -3
- data/lib/algolia/models/search/rendering_content.rb +34 -19
- data/lib/algolia/models/search/replace_all_objects_response.rb +35 -20
- data/lib/algolia/models/search/replace_source_response.rb +33 -18
- data/lib/algolia/models/search/rule.rb +37 -25
- data/lib/algolia/models/search/save_object_response.rb +35 -20
- data/lib/algolia/models/search/save_synonym_response.rb +35 -20
- data/lib/algolia/models/search/scope_type.rb +2 -3
- data/lib/algolia/models/search/search_dictionary_entries_params.rb +41 -26
- data/lib/algolia/models/search/search_dictionary_entries_response.rb +38 -23
- data/lib/algolia/models/search/search_for_facet_values_request.rb +37 -22
- data/lib/algolia/models/search/search_for_facet_values_response.rb +35 -20
- data/lib/algolia/models/search/search_for_facets.rb +218 -124
- data/lib/algolia/models/search/search_for_facets_options.rb +39 -24
- data/lib/algolia/models/search/search_for_hits.rb +214 -122
- data/lib/algolia/models/search/search_for_hits_options.rb +34 -19
- data/lib/algolia/models/search/search_hits.rb +26 -15
- data/lib/algolia/models/search/search_method_params.rb +34 -19
- data/lib/algolia/models/search/search_pagination.rb +282 -0
- data/lib/algolia/models/search/search_params.rb +33 -24
- data/lib/algolia/models/search/search_params_object.rb +208 -119
- data/lib/algolia/models/search/search_params_query.rb +33 -18
- data/lib/algolia/models/search/search_params_string.rb +33 -18
- data/lib/algolia/models/search/search_query.rb +33 -24
- data/lib/algolia/models/search/search_response.rb +154 -111
- data/lib/algolia/models/search/search_responses.rb +33 -18
- data/lib/algolia/models/search/search_result.rb +33 -24
- data/lib/algolia/models/search/search_rules_params.rb +45 -30
- data/lib/algolia/models/search/search_rules_response.rb +36 -21
- data/lib/algolia/models/search/search_strategy.rb +2 -3
- data/lib/algolia/models/search/search_synonyms_params.rb +41 -26
- data/lib/algolia/models/search/search_synonyms_response.rb +25 -14
- data/lib/algolia/models/search/search_type_default.rb +2 -3
- data/lib/algolia/models/search/search_type_facet.rb +2 -3
- data/lib/algolia/models/search/search_user_ids_params.rb +41 -26
- data/lib/algolia/models/search/search_user_ids_response.rb +42 -27
- data/lib/algolia/models/search/secured_api_key_restrictions.rb +38 -23
- data/lib/algolia/models/search/semantic_search.rb +35 -20
- data/lib/algolia/models/search/snippet_result.rb +34 -25
- data/lib/algolia/models/search/snippet_result_option.rb +34 -19
- data/lib/algolia/models/search/sort_remaining_by.rb +2 -3
- data/lib/algolia/models/search/source.rb +30 -18
- data/lib/algolia/models/search/standard_entries.rb +39 -24
- data/lib/algolia/models/search/supported_language.rb +72 -5
- data/lib/algolia/models/search/synonym_hit.rb +40 -25
- data/lib/algolia/models/search/synonym_type.rb +2 -3
- data/lib/algolia/models/search/tag_filters.rb +33 -24
- data/lib/algolia/models/search/task_status.rb +2 -3
- data/lib/algolia/models/search/time_range.rb +34 -19
- data/lib/algolia/models/search/typo_tolerance.rb +33 -24
- data/lib/algolia/models/search/typo_tolerance_enum.rb +2 -3
- data/lib/algolia/models/search/update_api_key_response.rb +34 -19
- data/lib/algolia/models/search/updated_at_response.rb +34 -19
- data/lib/algolia/models/search/updated_at_with_object_id_response.rb +35 -20
- data/lib/algolia/models/search/updated_rule_response.rb +35 -20
- data/lib/algolia/models/search/user_highlight_result.rb +34 -19
- data/lib/algolia/models/search/user_hit.rb +35 -23
- data/lib/algolia/models/search/user_id.rb +33 -21
- data/lib/algolia/models/search/value.rb +31 -19
- data/lib/algolia/models/usage/error_base.rb +24 -13
- data/lib/algolia/models/usage/get_usage200_response.rb +33 -18
- data/lib/algolia/models/usage/get_usage200_response_statistics_inner.rb +34 -19
- data/lib/algolia/models/usage/get_usage400_response.rb +33 -18
- data/lib/algolia/models/usage/get_usage400_response_error.rb +35 -20
- data/lib/algolia/models/usage/get_usage400_response_error_errors_inner.rb +36 -21
- data/lib/algolia/models/usage/granularity.rb +2 -3
- data/lib/algolia/models/usage/statistic.rb +88 -5
- data/lib/algolia/models/usage/statistic_value.rb +33 -24
- data/lib/algolia/transport/call_type.rb +1 -1
- data/lib/algolia/transport/echo_requester.rb +11 -2
- data/lib/algolia/transport/http/http_requester.rb +23 -15
- data/lib/algolia/transport/http/response.rb +8 -8
- data/lib/algolia/transport/request_options.rb +6 -4
- data/lib/algolia/transport/retry_outcome_type.rb +3 -3
- data/lib/algolia/transport/retry_strategy.rb +8 -7
- data/lib/algolia/transport/stateful_host.rb +6 -6
- data/lib/algolia/transport/transport.rb +28 -21
- data/lib/algolia/user_agent.rb +1 -1
- data/lib/algolia/version.rb +1 -1
- data/lib/algolia.rb +16 -16
- metadata +20 -13
- data/.rubocop.yml +0 -99
@@ -2,8 +2,17 @@ module Algolia
|
|
2
2
|
module Transport
|
3
3
|
class EchoRequester
|
4
4
|
def send_request(host, method, path, body, query_params, headers, timeout, connect_timeout)
|
5
|
-
Http::Response.new(
|
6
|
-
|
5
|
+
Http::Response.new(
|
6
|
+
host: host,
|
7
|
+
status: 200,
|
8
|
+
body: body,
|
9
|
+
query_params: query_params,
|
10
|
+
headers: headers,
|
11
|
+
method: method,
|
12
|
+
path: path,
|
13
|
+
timeout: timeout,
|
14
|
+
connect_timeout: connect_timeout
|
15
|
+
)
|
7
16
|
end
|
8
17
|
end
|
9
18
|
end
|
@@ -8,8 +8,8 @@ module Algolia
|
|
8
8
|
# @param logger [Object] logger used to log requests. Defaults to Algolia::LoggerHelper
|
9
9
|
#
|
10
10
|
def initialize(adapter, logger)
|
11
|
-
@adapter
|
12
|
-
@logger
|
11
|
+
@adapter = adapter
|
12
|
+
@logger = logger
|
13
13
|
@connections = {}
|
14
14
|
end
|
15
15
|
|
@@ -25,27 +25,33 @@ module Algolia
|
|
25
25
|
# @return [Http::Response]
|
26
26
|
#
|
27
27
|
def send_request(host, method, path, body, query_params, headers, timeout, connect_timeout)
|
28
|
-
connection
|
29
|
-
connection.options.timeout
|
28
|
+
connection = connection(host)
|
29
|
+
connection.options.timeout = timeout / 1000
|
30
30
|
connection.options.open_timeout = connect_timeout / 1000
|
31
31
|
path += handle_query_params(query_params)
|
32
32
|
|
33
|
-
@logger.info("Sending #{method.to_s.upcase!} request to #{path} with body #{body}") if ENV[
|
33
|
+
@logger.info("Sending #{method.to_s.upcase!} request to #{path} with body #{body}") if ENV["ALGOLIA_DEBUG"]
|
34
34
|
|
35
35
|
response = connection.run_request(method, path, body, headers)
|
36
36
|
|
37
37
|
if response.success?
|
38
|
-
|
38
|
+
if ENV["ALGOLIA_DEBUG"]
|
39
|
+
@logger.info("Request succeeded. Response status: #{response.status}, body: #{response.body}")
|
40
|
+
end
|
41
|
+
|
39
42
|
return Http::Response.new(status: response.status, body: response.body, headers: response.headers)
|
40
43
|
end
|
41
44
|
|
42
|
-
|
45
|
+
if ENV["ALGOLIA_DEBUG"]
|
46
|
+
@logger.info("Request failed. Response status: #{response.status}, error: #{response.body}")
|
47
|
+
end
|
48
|
+
|
43
49
|
Http::Response.new(status: response.status, error: response.body, headers: response.headers)
|
44
50
|
rescue Faraday::TimeoutError => e
|
45
|
-
@logger.info("Request timed out. Error: #{e.message}") if ENV[
|
51
|
+
@logger.info("Request timed out. Error: #{e.message}") if ENV["ALGOLIA_DEBUG"]
|
46
52
|
Http::Response.new(error: e.message, has_timed_out: true)
|
47
53
|
rescue ::StandardError => e
|
48
|
-
@logger.info("Request failed. Error: #{e.message}") if ENV[
|
54
|
+
@logger.info("Request failed. Error: #{e.message}") if ENV["ALGOLIA_DEBUG"]
|
49
55
|
Http::Response.new(error: e.message, network_failure: true)
|
50
56
|
end
|
51
57
|
|
@@ -58,7 +64,7 @@ module Algolia
|
|
58
64
|
def connection(host)
|
59
65
|
url = build_url(host)
|
60
66
|
@connections[url] ||= Faraday.new(url) do |f|
|
61
|
-
f.adapter
|
67
|
+
f.adapter(@adapter.to_sym)
|
62
68
|
end
|
63
69
|
end
|
64
70
|
|
@@ -69,21 +75,23 @@ module Algolia
|
|
69
75
|
# @return [String]
|
70
76
|
#
|
71
77
|
def build_url(host)
|
72
|
-
host.protocol + host.url + (host.port.nil? ?
|
78
|
+
host.protocol + host.url + (host.port.nil? ? "" : ":#{host.port}")
|
73
79
|
end
|
74
80
|
|
75
81
|
# Convert query_params to a full query string
|
76
82
|
#
|
77
83
|
def handle_query_params(query_params)
|
78
|
-
query_params.nil? || query_params.empty? ?
|
84
|
+
query_params.nil? || query_params.empty? ? "" : "?#{to_query_string(query_params)}"
|
79
85
|
end
|
80
86
|
|
81
87
|
# Create a query string from query_params
|
82
88
|
#
|
83
89
|
def to_query_string(query_params)
|
84
|
-
query_params
|
85
|
-
|
86
|
-
|
90
|
+
query_params
|
91
|
+
.map do |key, value|
|
92
|
+
"#{key}=#{value}"
|
93
|
+
end
|
94
|
+
.join("&")
|
87
95
|
end
|
88
96
|
end
|
89
97
|
end
|
@@ -14,16 +14,16 @@ module Algolia
|
|
14
14
|
# @option has_timed_out [String] If the request has timed out
|
15
15
|
#
|
16
16
|
def initialize(opts = {})
|
17
|
-
@status
|
18
|
-
@body
|
19
|
-
@error
|
20
|
-
@headers
|
21
|
-
@has_timed_out
|
17
|
+
@status = opts[:status]
|
18
|
+
@body = opts[:body]
|
19
|
+
@error = opts[:error] || ""
|
20
|
+
@headers = opts[:headers] || ""
|
21
|
+
@has_timed_out = opts[:has_timed_out] || false
|
22
22
|
@network_failure = opts[:network_failure] || false
|
23
23
|
|
24
|
-
@method = opts[:method] ||
|
25
|
-
@path = opts[:path] ||
|
26
|
-
@host = opts[:host] ||
|
24
|
+
@method = opts[:method] || ""
|
25
|
+
@path = opts[:path] || ""
|
26
|
+
@host = opts[:host] || ""
|
27
27
|
@timeout = opts[:timeout] || 0
|
28
28
|
@connect_timeout = opts[:connect_timeout] || 0
|
29
29
|
@query_params = opts[:query_params] || {}
|
@@ -6,10 +6,10 @@ module Algolia
|
|
6
6
|
# @param [Search::Config] config
|
7
7
|
#
|
8
8
|
def initialize(config)
|
9
|
-
@header_params
|
10
|
-
@query_params
|
11
|
-
@timeout
|
12
|
-
@connect_timeout
|
9
|
+
@header_params = {}
|
10
|
+
@query_params = {}
|
11
|
+
@timeout = nil
|
12
|
+
@connect_timeout = nil
|
13
13
|
@compression_type = config.compression_type
|
14
14
|
end
|
15
15
|
|
@@ -35,6 +35,7 @@ module Algolia
|
|
35
35
|
opts[:header_params].each do |opt, value|
|
36
36
|
@header_params[opt.to_s] = value
|
37
37
|
end
|
38
|
+
|
38
39
|
opts.delete(:header_params)
|
39
40
|
end
|
40
41
|
|
@@ -48,6 +49,7 @@ module Algolia
|
|
48
49
|
opts[:query_params].each do |opt, value|
|
49
50
|
@query_params[opt.to_sym] = value
|
50
51
|
end
|
52
|
+
|
51
53
|
opts.delete(:query_params)
|
52
54
|
end
|
53
55
|
|
@@ -7,7 +7,7 @@ module Algolia
|
|
7
7
|
#
|
8
8
|
def initialize(hosts)
|
9
9
|
@hosts = hosts
|
10
|
-
@lock
|
10
|
+
@lock = Mutex.new
|
11
11
|
end
|
12
12
|
|
13
13
|
# Retrieves the tryable hosts
|
@@ -26,6 +26,7 @@ module Algolia
|
|
26
26
|
@hosts.each do |host|
|
27
27
|
reset(host) if flag?(host.accept, call_type)
|
28
28
|
end
|
29
|
+
|
29
30
|
@hosts
|
30
31
|
end
|
31
32
|
end
|
@@ -42,16 +43,16 @@ module Algolia
|
|
42
43
|
def decide(tryable_host, http_response_code: nil, is_timed_out: false, network_failure: false)
|
43
44
|
@lock.synchronize do
|
44
45
|
if !is_timed_out && success?(http_response_code)
|
45
|
-
tryable_host.up
|
46
|
+
tryable_host.up = true
|
46
47
|
tryable_host.last_use = Time.now.utc
|
47
48
|
SUCCESS
|
48
49
|
elsif !is_timed_out && retryable?(http_response_code, network_failure)
|
49
|
-
tryable_host.up
|
50
|
+
tryable_host.up = false
|
50
51
|
tryable_host.last_use = Time.now.utc
|
51
52
|
RETRY
|
52
53
|
elsif is_timed_out
|
53
|
-
tryable_host.up
|
54
|
-
tryable_host.last_use
|
54
|
+
tryable_host.up = true
|
55
|
+
tryable_host.last_use = Time.now.utc
|
55
56
|
tryable_host.retry_count += 1
|
56
57
|
RETRY
|
57
58
|
else
|
@@ -94,9 +95,9 @@ module Algolia
|
|
94
95
|
# @param host [StatefulHost]
|
95
96
|
#
|
96
97
|
def reset(host)
|
97
|
-
host.up
|
98
|
+
host.up = true
|
98
99
|
host.retry_count = 0
|
99
|
-
host.last_use
|
100
|
+
host.last_use = Time.now.utc
|
100
101
|
end
|
101
102
|
|
102
103
|
# Make a binary check to know whether the item contains the flag
|
@@ -13,13 +13,13 @@ module Algolia
|
|
13
13
|
# @option options [Boolean] :up host status
|
14
14
|
#
|
15
15
|
def initialize(url, opts = {})
|
16
|
-
@url
|
17
|
-
@protocol
|
18
|
-
@port
|
19
|
-
@accept
|
20
|
-
@last_use
|
16
|
+
@url = url
|
17
|
+
@protocol = opts[:protocol] || "https://"
|
18
|
+
@port = opts[:port]
|
19
|
+
@accept = opts[:accept] || (READ | WRITE)
|
20
|
+
@last_use = opts[:last_use] || Time.now.utc
|
21
21
|
@retry_count = opts[:retry_count] || 0
|
22
|
-
@up
|
22
|
+
@up = opts.key?(:up) ? opts[:up] : true
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
@@ -1,17 +1,18 @@
|
|
1
|
-
require
|
1
|
+
require "faraday"
|
2
|
+
|
2
3
|
# this is the default adapter and it needs to be required to be registered.
|
3
|
-
require
|
4
|
-
require
|
4
|
+
require "faraday/net_http_persistent" unless Faraday::VERSION < "1"
|
5
|
+
require "zlib"
|
5
6
|
|
6
7
|
module Algolia
|
7
8
|
module Transport
|
8
9
|
def self.encode_uri(uri)
|
9
|
-
CGI.escape(uri).gsub(
|
10
|
+
CGI.escape(uri).gsub("+", "%20")
|
10
11
|
end
|
11
12
|
|
12
13
|
def self.stringify_query_params(query_params)
|
13
14
|
query_params.to_h do |key, value|
|
14
|
-
value = value.join(
|
15
|
+
value = value.join(",") if value.is_a?(Array)
|
15
16
|
[encode_uri(key.to_s).to_sym, encode_uri(value.to_s)]
|
16
17
|
end
|
17
18
|
end
|
@@ -39,7 +40,7 @@ module Algolia
|
|
39
40
|
#
|
40
41
|
def request(call_type, method, path, body, opts = {})
|
41
42
|
@retry_strategy.get_tryable_hosts(call_type).each do |host|
|
42
|
-
opts[:timeout]
|
43
|
+
opts[:timeout] ||= get_timeout(call_type) * (host.retry_count + 1)
|
43
44
|
opts[:connect_timeout] ||= @config.connect_timeout * (host.retry_count + 1)
|
44
45
|
|
45
46
|
request_options = RequestOptions.new(@config)
|
@@ -47,7 +48,7 @@ module Algolia
|
|
47
48
|
# TODO: what is this merge for ?
|
48
49
|
# request_options.query_params.merge!(request_options.data) if method == :GET
|
49
50
|
|
50
|
-
request
|
51
|
+
request = build_request(method, path, body, request_options)
|
51
52
|
response = @requester.send_request(
|
52
53
|
host,
|
53
54
|
request[:method],
|
@@ -59,15 +60,21 @@ module Algolia
|
|
59
60
|
request[:connect_timeout]
|
60
61
|
)
|
61
62
|
|
62
|
-
outcome = @retry_strategy.decide(
|
63
|
+
outcome = @retry_strategy.decide(
|
64
|
+
host,
|
65
|
+
http_response_code: response.status,
|
66
|
+
is_timed_out: response.has_timed_out,
|
67
|
+
network_failure: response.network_failure
|
68
|
+
)
|
63
69
|
if outcome == FAILURE
|
64
70
|
decoded_error = JSON.parse(response.error, :symbolize_names => true)
|
65
|
-
raise Algolia::AlgoliaHttpError.new(
|
71
|
+
raise Algolia::AlgoliaHttpError.new(response.status, decoded_error[:message])
|
66
72
|
end
|
73
|
+
|
67
74
|
return response unless outcome == RETRY
|
68
75
|
end
|
69
76
|
|
70
|
-
raise Algolia::AlgoliaUnreachableHostError,
|
77
|
+
raise Algolia::AlgoliaUnreachableHostError, "Unreachable hosts"
|
71
78
|
end
|
72
79
|
|
73
80
|
private
|
@@ -82,13 +89,13 @@ module Algolia
|
|
82
89
|
# @return [Hash]
|
83
90
|
#
|
84
91
|
def build_request(method, path, body, request_options)
|
85
|
-
request
|
86
|
-
request[:method]
|
87
|
-
request[:path]
|
88
|
-
request[:body]
|
89
|
-
request[:query_params]
|
90
|
-
request[:header_params]
|
91
|
-
request[:timeout]
|
92
|
+
request = {}
|
93
|
+
request[:method] = method.downcase
|
94
|
+
request[:path] = path
|
95
|
+
request[:body] = build_body(body, request_options)
|
96
|
+
request[:query_params] = Algolia::Transport.stringify_query_params(request_options.query_params)
|
97
|
+
request[:header_params] = generate_header_params(body, request_options)
|
98
|
+
request[:timeout] = request_options.timeout
|
92
99
|
request[:connect_timeout] = request_options.connect_timeout
|
93
100
|
request
|
94
101
|
end
|
@@ -97,7 +104,7 @@ module Algolia
|
|
97
104
|
def build_body(body, request_options)
|
98
105
|
return nil if body.nil?
|
99
106
|
|
100
|
-
if request_options.compression_type ==
|
107
|
+
if request_options.compression_type == "gzip"
|
101
108
|
body = Zlib.gzip(body)
|
102
109
|
end
|
103
110
|
|
@@ -113,9 +120,9 @@ module Algolia
|
|
113
120
|
def generate_header_params(body, request_options)
|
114
121
|
header_params = request_options.header_params.transform_keys(&:downcase)
|
115
122
|
header_params = @config.header_params.merge(header_params)
|
116
|
-
header_params[
|
117
|
-
if request_options.compression_type ==
|
118
|
-
header_params[
|
123
|
+
header_params["accept-encoding"] = "gzip" if request_options.compression_type == "gzip"
|
124
|
+
if request_options.compression_type == "gzip" && body.is_a?(String) && !body.to_s.strip.empty?
|
125
|
+
header_params["content-encoding"] = "gzip"
|
119
126
|
end
|
120
127
|
|
121
128
|
header_params
|
data/lib/algolia/user_agent.rb
CHANGED
@@ -9,7 +9,7 @@ module Algolia
|
|
9
9
|
# Adds a segment to the UserAgent
|
10
10
|
#
|
11
11
|
def add(segment, version)
|
12
|
-
@value += format(
|
12
|
+
@value += format("; %<segment>s (%<version>s)", segment: segment, version: version)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
data/lib/algolia/version.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
|
2
2
|
|
3
3
|
module Algolia
|
4
|
-
VERSION =
|
4
|
+
VERSION = "3.0.0.beta.10".freeze
|
5
5
|
end
|
data/lib/algolia.rb
CHANGED
@@ -3,22 +3,22 @@
|
|
3
3
|
# Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
|
4
4
|
|
5
5
|
# Common files
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require
|
11
|
-
require
|
12
|
-
require
|
13
|
-
require
|
14
|
-
require
|
15
|
-
require
|
16
|
-
require
|
17
|
-
require
|
18
|
-
require
|
19
|
-
require
|
20
|
-
require
|
21
|
-
require
|
6
|
+
require "algolia/api_client"
|
7
|
+
require "algolia/api_error"
|
8
|
+
require "algolia/error"
|
9
|
+
require "algolia/version"
|
10
|
+
require "algolia/configuration"
|
11
|
+
require "algolia/user_agent"
|
12
|
+
require "algolia/logger_helper"
|
13
|
+
require "algolia/transport/http/http_requester"
|
14
|
+
require "algolia/transport/http/response"
|
15
|
+
require "algolia/transport/echo_requester"
|
16
|
+
require "algolia/transport/call_type"
|
17
|
+
require "algolia/transport/retry_outcome_type"
|
18
|
+
require "algolia/transport/stateful_host"
|
19
|
+
require "algolia/transport/retry_strategy"
|
20
|
+
require "algolia/transport/request_options"
|
21
|
+
require "algolia/transport/transport"
|
22
22
|
|
23
23
|
# Models
|
24
24
|
Dir["#{File.dirname(__FILE__)}/algolia/models/**/*.rb"].sort.each { |file| require file }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: algolia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.0.beta.
|
4
|
+
version: 3.0.0.beta.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- https://alg.li/support
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-07-
|
11
|
+
date: 2024-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -51,27 +51,33 @@ dependencies:
|
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: '3'
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
|
-
name:
|
54
|
+
name: base64
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
57
|
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version:
|
59
|
+
version: 0.2.0
|
60
|
+
- - "<"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '1'
|
60
63
|
type: :runtime
|
61
64
|
prerelease: false
|
62
65
|
version_requirements: !ruby/object:Gem::Requirement
|
63
66
|
requirements:
|
64
67
|
- - ">="
|
65
68
|
- !ruby/object:Gem::Version
|
66
|
-
version:
|
69
|
+
version: 0.2.0
|
70
|
+
- - "<"
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '1'
|
67
73
|
- !ruby/object:Gem::Dependency
|
68
|
-
name:
|
74
|
+
name: net-http-persistent
|
69
75
|
requirement: !ruby/object:Gem::Requirement
|
70
76
|
requirements:
|
71
77
|
- - ">="
|
72
78
|
- !ruby/object:Gem::Version
|
73
79
|
version: '0'
|
74
|
-
type: :
|
80
|
+
type: :runtime
|
75
81
|
prerelease: false
|
76
82
|
version_requirements: !ruby/object:Gem::Requirement
|
77
83
|
requirements:
|
@@ -79,7 +85,7 @@ dependencies:
|
|
79
85
|
- !ruby/object:Gem::Version
|
80
86
|
version: '0'
|
81
87
|
- !ruby/object:Gem::Dependency
|
82
|
-
name:
|
88
|
+
name: bundler
|
83
89
|
requirement: !ruby/object:Gem::Requirement
|
84
90
|
requirements:
|
85
91
|
- - ">="
|
@@ -93,7 +99,7 @@ dependencies:
|
|
93
99
|
- !ruby/object:Gem::Version
|
94
100
|
version: '0'
|
95
101
|
- !ruby/object:Gem::Dependency
|
96
|
-
name:
|
102
|
+
name: rake
|
97
103
|
requirement: !ruby/object:Gem::Requirement
|
98
104
|
requirements:
|
99
105
|
- - ">="
|
@@ -114,7 +120,6 @@ extra_rdoc_files: []
|
|
114
120
|
files:
|
115
121
|
- ".github/workflows/release.yml"
|
116
122
|
- ".gitignore"
|
117
|
-
- ".rubocop.yml"
|
118
123
|
- CHANGELOG.md
|
119
124
|
- Gemfile
|
120
125
|
- Gemfile.lock
|
@@ -254,6 +259,7 @@ files:
|
|
254
259
|
- lib/algolia/models/ingestion/destination_update_response.rb
|
255
260
|
- lib/algolia/models/ingestion/docker_image_type.rb
|
256
261
|
- lib/algolia/models/ingestion/docker_registry.rb
|
262
|
+
- lib/algolia/models/ingestion/docker_streams_input.rb
|
257
263
|
- lib/algolia/models/ingestion/error_base.rb
|
258
264
|
- lib/algolia/models/ingestion/event.rb
|
259
265
|
- lib/algolia/models/ingestion/event_sort_keys.rb
|
@@ -271,7 +277,6 @@ files:
|
|
271
277
|
- lib/algolia/models/ingestion/mapping_kit_action.rb
|
272
278
|
- lib/algolia/models/ingestion/mapping_type_csv.rb
|
273
279
|
- lib/algolia/models/ingestion/method_type.rb
|
274
|
-
- lib/algolia/models/ingestion/on_demand_date_utils_input.rb
|
275
280
|
- lib/algolia/models/ingestion/on_demand_trigger.rb
|
276
281
|
- lib/algolia/models/ingestion/on_demand_trigger_input.rb
|
277
282
|
- lib/algolia/models/ingestion/on_demand_trigger_type.rb
|
@@ -290,7 +295,6 @@ files:
|
|
290
295
|
- lib/algolia/models/ingestion/run_sort_keys.rb
|
291
296
|
- lib/algolia/models/ingestion/run_status.rb
|
292
297
|
- lib/algolia/models/ingestion/run_type.rb
|
293
|
-
- lib/algolia/models/ingestion/schedule_date_utils_input.rb
|
294
298
|
- lib/algolia/models/ingestion/schedule_trigger.rb
|
295
299
|
- lib/algolia/models/ingestion/schedule_trigger_input.rb
|
296
300
|
- lib/algolia/models/ingestion/schedule_trigger_type.rb
|
@@ -321,9 +325,9 @@ files:
|
|
321
325
|
- lib/algolia/models/ingestion/source_update_response.rb
|
322
326
|
- lib/algolia/models/ingestion/source_update_shopify.rb
|
323
327
|
- lib/algolia/models/ingestion/source_watch_response.rb
|
328
|
+
- lib/algolia/models/ingestion/streaming_input.rb
|
324
329
|
- lib/algolia/models/ingestion/streaming_trigger.rb
|
325
330
|
- lib/algolia/models/ingestion/streaming_trigger_type.rb
|
326
|
-
- lib/algolia/models/ingestion/streaming_utils_input.rb
|
327
331
|
- lib/algolia/models/ingestion/subscription_trigger.rb
|
328
332
|
- lib/algolia/models/ingestion/subscription_trigger_type.rb
|
329
333
|
- lib/algolia/models/ingestion/task.rb
|
@@ -489,6 +493,7 @@ files:
|
|
489
493
|
- lib/algolia/models/recommend/remove_stop_words.rb
|
490
494
|
- lib/algolia/models/recommend/remove_words_if_no_results.rb
|
491
495
|
- lib/algolia/models/recommend/rendering_content.rb
|
496
|
+
- lib/algolia/models/recommend/search_pagination.rb
|
492
497
|
- lib/algolia/models/recommend/search_params.rb
|
493
498
|
- lib/algolia/models/recommend/search_params_object.rb
|
494
499
|
- lib/algolia/models/recommend/search_params_query.rb
|
@@ -539,6 +544,7 @@ files:
|
|
539
544
|
- lib/algolia/models/search/batch_request.rb
|
540
545
|
- lib/algolia/models/search/batch_response.rb
|
541
546
|
- lib/algolia/models/search/batch_write_params.rb
|
547
|
+
- lib/algolia/models/search/browse_pagination.rb
|
542
548
|
- lib/algolia/models/search/browse_params.rb
|
543
549
|
- lib/algolia/models/search/browse_params_object.rb
|
544
550
|
- lib/algolia/models/search/browse_response.rb
|
@@ -638,6 +644,7 @@ files:
|
|
638
644
|
- lib/algolia/models/search/search_for_hits_options.rb
|
639
645
|
- lib/algolia/models/search/search_hits.rb
|
640
646
|
- lib/algolia/models/search/search_method_params.rb
|
647
|
+
- lib/algolia/models/search/search_pagination.rb
|
641
648
|
- lib/algolia/models/search/search_params.rb
|
642
649
|
- lib/algolia/models/search/search_params_object.rb
|
643
650
|
- lib/algolia/models/search/search_params_query.rb
|
data/.rubocop.yml
DELETED
@@ -1,99 +0,0 @@
|
|
1
|
-
AllCops:
|
2
|
-
DisabledByDefault: false
|
3
|
-
NewCops: enable
|
4
|
-
|
5
|
-
Style/HashSyntax:
|
6
|
-
Enabled: false
|
7
|
-
|
8
|
-
Style/FrozenStringLiteralComment:
|
9
|
-
Enabled: false
|
10
|
-
EnforcedStyle: always
|
11
|
-
|
12
|
-
Style/WordArray:
|
13
|
-
Enabled: false
|
14
|
-
|
15
|
-
Style/SymbolArray:
|
16
|
-
Enabled: false
|
17
|
-
|
18
|
-
Style/Documentation:
|
19
|
-
Enabled: false
|
20
|
-
|
21
|
-
Layout/LineLength:
|
22
|
-
Max: 180
|
23
|
-
|
24
|
-
Metrics/PerceivedComplexity:
|
25
|
-
Enabled: false
|
26
|
-
|
27
|
-
Metrics/CyclomaticComplexity:
|
28
|
-
Enabled: false
|
29
|
-
|
30
|
-
Metrics/AbcSize:
|
31
|
-
Enabled: false
|
32
|
-
|
33
|
-
Metrics/MethodLength:
|
34
|
-
Enabled: false
|
35
|
-
|
36
|
-
Metrics/ClassLength:
|
37
|
-
Enabled: false
|
38
|
-
|
39
|
-
Gemspec/DevelopmentDependencies:
|
40
|
-
Exclude:
|
41
|
-
- 'algolia.gemspec'
|
42
|
-
|
43
|
-
Gemspec/RequiredRubyVersion:
|
44
|
-
Exclude:
|
45
|
-
- 'algolia.gemspec'
|
46
|
-
|
47
|
-
Lint/DuplicateMethods:
|
48
|
-
Enabled: false
|
49
|
-
|
50
|
-
Lint/SymbolConversion:
|
51
|
-
Enabled: false
|
52
|
-
|
53
|
-
Lint/UnderscorePrefixedVariableName:
|
54
|
-
Enabled: false
|
55
|
-
|
56
|
-
Naming/PredicateName:
|
57
|
-
Enabled: false
|
58
|
-
|
59
|
-
Style/AccessorGrouping:
|
60
|
-
Enabled: false
|
61
|
-
|
62
|
-
Style/ClassVars:
|
63
|
-
Enabled: false
|
64
|
-
|
65
|
-
Style/ConditionalAssignment:
|
66
|
-
Enabled: false
|
67
|
-
|
68
|
-
Style/GuardClause:
|
69
|
-
Enabled: false
|
70
|
-
|
71
|
-
Style/HashTransformValues:
|
72
|
-
Enabled: false
|
73
|
-
|
74
|
-
Style/IfUnlessModifier:
|
75
|
-
Enabled: false
|
76
|
-
|
77
|
-
Style/NumericPredicate:
|
78
|
-
Enabled: false
|
79
|
-
|
80
|
-
Style/RescueStandardError:
|
81
|
-
Enabled: false
|
82
|
-
|
83
|
-
Style/SoleNestedConditional:
|
84
|
-
Enabled: false
|
85
|
-
|
86
|
-
Style/StringLiterals:
|
87
|
-
Enabled: false
|
88
|
-
|
89
|
-
Lint/SuppressedException:
|
90
|
-
Enabled: false
|
91
|
-
|
92
|
-
Metrics/BlockNesting:
|
93
|
-
Max: 4
|
94
|
-
|
95
|
-
Metrics/ParameterLists:
|
96
|
-
Max: 7
|
97
|
-
|
98
|
-
Security/CompoundHash:
|
99
|
-
Enabled: false
|