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
@@ -0,0 +1,226 @@
|
|
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
|
+
|
3
|
+
require 'date'
|
4
|
+
require 'time'
|
5
|
+
|
6
|
+
module Algolia
|
7
|
+
module Search
|
8
|
+
class Value
|
9
|
+
# Pinned order of facet lists.
|
10
|
+
attr_accessor :order
|
11
|
+
|
12
|
+
attr_accessor :sort_remaining_by
|
13
|
+
|
14
|
+
class EnumAttributeValidator
|
15
|
+
attr_reader :datatype
|
16
|
+
attr_reader :allowable_values
|
17
|
+
|
18
|
+
def initialize(datatype, allowable_values)
|
19
|
+
@allowable_values = allowable_values.map do |value|
|
20
|
+
case datatype.to_s
|
21
|
+
when /Integer/i
|
22
|
+
value.to_i
|
23
|
+
when /Float/i
|
24
|
+
value.to_f
|
25
|
+
else
|
26
|
+
value
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def valid?(value)
|
32
|
+
!value || allowable_values.include?(value)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
37
|
+
def self.attribute_map
|
38
|
+
{
|
39
|
+
:order => :order,
|
40
|
+
:sort_remaining_by => :sortRemainingBy
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
44
|
+
# Returns all the JSON keys this model knows about
|
45
|
+
def self.acceptable_attributes
|
46
|
+
attribute_map.values
|
47
|
+
end
|
48
|
+
|
49
|
+
# Attribute type mapping.
|
50
|
+
def self.types_mapping
|
51
|
+
{
|
52
|
+
:order => :'Array<String>',
|
53
|
+
:sort_remaining_by => :SortRemainingBy
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
57
|
+
# List of attributes with nullable: true
|
58
|
+
def self.openapi_nullable
|
59
|
+
Set.new([])
|
60
|
+
end
|
61
|
+
|
62
|
+
# Initializes the object
|
63
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
64
|
+
def initialize(attributes = {})
|
65
|
+
unless attributes.is_a?(Hash)
|
66
|
+
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::Value` initialize method"
|
67
|
+
end
|
68
|
+
|
69
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
70
|
+
attributes = attributes.each_with_object({}) do |(k, v), h|
|
71
|
+
unless self.class.attribute_map.key?(k.to_sym)
|
72
|
+
raise ArgumentError,
|
73
|
+
"`#{k}` is not a valid attribute in `Algolia::Value`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
74
|
+
end
|
75
|
+
|
76
|
+
h[k.to_sym] = v
|
77
|
+
end
|
78
|
+
|
79
|
+
if attributes.key?(:order)
|
80
|
+
if (value = attributes[:order]).is_a?(Array)
|
81
|
+
self.order = value
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
if attributes.key?(:sort_remaining_by)
|
86
|
+
self.sort_remaining_by = attributes[:sort_remaining_by]
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
# Checks equality by comparing each attribute.
|
91
|
+
# @param [Object] Object to be compared
|
92
|
+
def ==(other)
|
93
|
+
return true if equal?(other)
|
94
|
+
|
95
|
+
self.class == other.class &&
|
96
|
+
order == other.order &&
|
97
|
+
sort_remaining_by == other.sort_remaining_by
|
98
|
+
end
|
99
|
+
|
100
|
+
# @see the `==` method
|
101
|
+
# @param [Object] Object to be compared
|
102
|
+
def eql?(other)
|
103
|
+
self == other
|
104
|
+
end
|
105
|
+
|
106
|
+
# Calculates hash code according to all attributes.
|
107
|
+
# @return [Integer] Hash code
|
108
|
+
def hash
|
109
|
+
[order, sort_remaining_by].hash
|
110
|
+
end
|
111
|
+
|
112
|
+
# Builds the object from hash
|
113
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
114
|
+
# @return [Object] Returns the model itself
|
115
|
+
def self.build_from_hash(attributes)
|
116
|
+
return nil unless attributes.is_a?(Hash)
|
117
|
+
|
118
|
+
attributes = attributes.transform_keys(&:to_sym)
|
119
|
+
transformed_hash = {}
|
120
|
+
types_mapping.each_pair do |key, type|
|
121
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
122
|
+
transformed_hash[key.to_s] = nil
|
123
|
+
elsif type =~ /\AArray<(.*)>/i
|
124
|
+
# check to ensure the input is an array given that the attribute
|
125
|
+
# is documented as an array but the input is not
|
126
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
127
|
+
transformed_hash[key.to_s] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }
|
128
|
+
end
|
129
|
+
elsif !attributes[attribute_map[key]].nil?
|
130
|
+
transformed_hash[key.to_s] = _deserialize(type, attributes[attribute_map[key]])
|
131
|
+
end
|
132
|
+
end
|
133
|
+
new(transformed_hash)
|
134
|
+
end
|
135
|
+
|
136
|
+
# Deserializes the data based on type
|
137
|
+
# @param string type Data type
|
138
|
+
# @param string value Value to be deserialized
|
139
|
+
# @return [Object] Deserialized data
|
140
|
+
def self._deserialize(type, value)
|
141
|
+
case type.to_sym
|
142
|
+
when :Time
|
143
|
+
Time.parse(value)
|
144
|
+
when :Date
|
145
|
+
Date.parse(value)
|
146
|
+
when :String
|
147
|
+
value.to_s
|
148
|
+
when :Integer
|
149
|
+
value.to_i
|
150
|
+
when :Float
|
151
|
+
value.to_f
|
152
|
+
when :Boolean
|
153
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
154
|
+
true
|
155
|
+
else
|
156
|
+
false
|
157
|
+
end
|
158
|
+
when :Object
|
159
|
+
# generic object (usually a Hash), return directly
|
160
|
+
value
|
161
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
162
|
+
inner_type = Regexp.last_match[:inner_type]
|
163
|
+
value.map { |v| _deserialize(inner_type, v) }
|
164
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
165
|
+
k_type = Regexp.last_match[:k_type]
|
166
|
+
v_type = Regexp.last_match[:v_type]
|
167
|
+
{}.tap do |hash|
|
168
|
+
value.each do |k, v|
|
169
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
else # model
|
173
|
+
# models (e.g. Pet) or oneOf
|
174
|
+
klass = Algolia::Search.const_get(type)
|
175
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
# Returns the string representation of the object
|
180
|
+
# @return [String] String presentation of the object
|
181
|
+
def to_s
|
182
|
+
to_hash.to_s
|
183
|
+
end
|
184
|
+
|
185
|
+
# to_body is an alias to to_hash (backward compatibility)
|
186
|
+
# @return [Hash] Returns the object in the form of hash
|
187
|
+
def to_body
|
188
|
+
to_hash
|
189
|
+
end
|
190
|
+
|
191
|
+
# Returns the object in the form of hash
|
192
|
+
# @return [Hash] Returns the object in the form of hash
|
193
|
+
def to_hash
|
194
|
+
hash = {}
|
195
|
+
self.class.attribute_map.each_pair do |attr, param|
|
196
|
+
value = send(attr)
|
197
|
+
if value.nil?
|
198
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
199
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
200
|
+
end
|
201
|
+
|
202
|
+
hash[param] = _to_hash(value)
|
203
|
+
end
|
204
|
+
hash
|
205
|
+
end
|
206
|
+
|
207
|
+
# Outputs non-array value in the form of hash
|
208
|
+
# For object, use to_hash. Otherwise, just return the value
|
209
|
+
# @param [Object] value Any valid value
|
210
|
+
# @return [Hash] Returns the value in the form of hash
|
211
|
+
def _to_hash(value)
|
212
|
+
if value.is_a?(Array)
|
213
|
+
value.compact.map { |v| _to_hash(v) }
|
214
|
+
elsif value.is_a?(Hash)
|
215
|
+
{}.tap do |hash|
|
216
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
217
|
+
end
|
218
|
+
elsif value.respond_to? :to_hash
|
219
|
+
value.to_hash
|
220
|
+
else
|
221
|
+
value
|
222
|
+
end
|
223
|
+
end
|
224
|
+
end
|
225
|
+
end
|
226
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module Algolia
|
2
|
+
module Transport
|
3
|
+
class EchoRequester
|
4
|
+
def send_request(host, method, path, body, query_params, headers, timeout, connect_timeout)
|
5
|
+
Http::Response.new(host: host, status: 200, body: body, query_params: query_params, headers: headers, method: method, path: path, timeout: timeout,
|
6
|
+
connect_timeout: connect_timeout)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module Algolia
|
2
2
|
module Http
|
3
3
|
class HttpRequester
|
4
|
-
include Helpers
|
5
4
|
attr_accessor :adapter, :logger
|
6
5
|
|
7
6
|
#
|
@@ -20,41 +19,33 @@ module Algolia
|
|
20
19
|
# @param method [Symbol]
|
21
20
|
# @param path [String]
|
22
21
|
# @param body [JSON]
|
22
|
+
# @param query_params [Hash]
|
23
23
|
# @param headers [Hash]
|
24
24
|
#
|
25
25
|
# @return [Http::Response]
|
26
26
|
#
|
27
|
-
def send_request(host, method, path, body, headers, timeout, connect_timeout)
|
27
|
+
def send_request(host, method, path, body, query_params, headers, timeout, connect_timeout)
|
28
28
|
connection = connection(host)
|
29
|
-
connection.options.timeout = timeout
|
30
|
-
connection.options.open_timeout = connect_timeout
|
29
|
+
connection.options.timeout = timeout / 1000
|
30
|
+
connection.options.open_timeout = connect_timeout / 1000
|
31
|
+
path += handle_query_params(query_params)
|
31
32
|
|
32
|
-
if ENV['ALGOLIA_DEBUG']
|
33
|
-
@logger.info("Sending #{method.to_s.upcase!} request to #{path} with body #{body}")
|
34
|
-
end
|
33
|
+
@logger.info("Sending #{method.to_s.upcase!} request to #{path} with body #{body}") if ENV['ALGOLIA_DEBUG']
|
35
34
|
|
36
35
|
response = connection.run_request(method, path, body, headers)
|
37
36
|
|
38
37
|
if response.success?
|
39
|
-
if ENV['ALGOLIA_DEBUG']
|
40
|
-
@logger.info("Request succeeded. Response status: #{response.status}, body: #{response.body}")
|
41
|
-
end
|
38
|
+
@logger.info("Request succeeded. Response status: #{response.status}, body: #{response.body}") if ENV['ALGOLIA_DEBUG']
|
42
39
|
return Http::Response.new(status: response.status, body: response.body, headers: response.headers)
|
43
40
|
end
|
44
41
|
|
45
|
-
if ENV['ALGOLIA_DEBUG']
|
46
|
-
@logger.info("Request failed. Response status: #{response.status}, error: #{response.body}")
|
47
|
-
end
|
42
|
+
@logger.info("Request failed. Response status: #{response.status}, error: #{response.body}") if ENV['ALGOLIA_DEBUG']
|
48
43
|
Http::Response.new(status: response.status, error: response.body, headers: response.headers)
|
49
44
|
rescue Faraday::TimeoutError => e
|
50
|
-
if ENV['ALGOLIA_DEBUG']
|
51
|
-
@logger.info("Request timed out. Error: #{e.message}")
|
52
|
-
end
|
45
|
+
@logger.info("Request timed out. Error: #{e.message}") if ENV['ALGOLIA_DEBUG']
|
53
46
|
Http::Response.new(error: e.message, has_timed_out: true)
|
54
47
|
rescue ::StandardError => e
|
55
|
-
if ENV['ALGOLIA_DEBUG']
|
56
|
-
@logger.info("Request failed. Error: #{e.message}")
|
57
|
-
end
|
48
|
+
@logger.info("Request failed. Error: #{e.message}") if ENV['ALGOLIA_DEBUG']
|
58
49
|
Http::Response.new(error: e.message, network_failure: true)
|
59
50
|
end
|
60
51
|
|
@@ -79,6 +70,20 @@ module Algolia
|
|
79
70
|
def build_url(host)
|
80
71
|
host.protocol + host.url
|
81
72
|
end
|
73
|
+
|
74
|
+
# Convert query_params to a full query string
|
75
|
+
#
|
76
|
+
def handle_query_params(query_params)
|
77
|
+
query_params.nil? || query_params.empty? ? '' : "?#{to_query_string(query_params)}"
|
78
|
+
end
|
79
|
+
|
80
|
+
# Create a query string from query_params
|
81
|
+
#
|
82
|
+
def to_query_string(query_params)
|
83
|
+
query_params.map do |key, value|
|
84
|
+
"#{key}=#{value}"
|
85
|
+
end.join('&')
|
86
|
+
end
|
82
87
|
end
|
83
88
|
end
|
84
89
|
end
|
@@ -3,6 +3,9 @@ module Algolia
|
|
3
3
|
class Response
|
4
4
|
attr_reader :status, :body, :error, :headers, :has_timed_out, :network_failure
|
5
5
|
|
6
|
+
# used for the echo requester
|
7
|
+
attr_reader :method, :path, :query_params, :host, :timeout, :connect_timeout
|
8
|
+
|
6
9
|
#
|
7
10
|
# @option status [String] Response status
|
8
11
|
# @option body [String] Response body
|
@@ -12,11 +15,18 @@ module Algolia
|
|
12
15
|
#
|
13
16
|
def initialize(opts = {})
|
14
17
|
@status = opts[:status]
|
15
|
-
@body = opts[:body]
|
18
|
+
@body = opts[:body]
|
16
19
|
@error = opts[:error] || ''
|
17
20
|
@headers = opts[:headers] || ''
|
18
21
|
@has_timed_out = opts[:has_timed_out] || false
|
19
22
|
@network_failure = opts[:network_failure] || false
|
23
|
+
|
24
|
+
@method = opts[:method] || ''
|
25
|
+
@path = opts[:path] || ''
|
26
|
+
@host = opts[:host] || ''
|
27
|
+
@timeout = opts[:timeout] || 0
|
28
|
+
@connect_timeout = opts[:connect_timeout] || 0
|
29
|
+
@query_params = opts[:query_params] || {}
|
20
30
|
end
|
21
31
|
end
|
22
32
|
end
|
@@ -1,56 +1,54 @@
|
|
1
1
|
module Algolia
|
2
2
|
module Transport
|
3
3
|
class RequestOptions
|
4
|
-
attr_accessor :
|
4
|
+
attr_accessor :header_params, :query_params, :data, :timeout, :connect_timeout, :compression_type
|
5
5
|
|
6
6
|
# @param [Search::Config] config
|
7
7
|
#
|
8
8
|
def initialize(config)
|
9
|
-
@
|
10
|
-
@
|
11
|
-
@data = {}
|
9
|
+
@header_params = {}
|
10
|
+
@query_params = {}
|
12
11
|
@timeout = nil
|
13
12
|
@connect_timeout = nil
|
14
13
|
@compression_type = config.compression_type
|
15
14
|
end
|
16
15
|
|
17
|
-
# Create and format headers and params from request options
|
16
|
+
# Create and format headers and query params from request options
|
18
17
|
#
|
19
18
|
# @param opts [Hash]
|
20
19
|
#
|
21
20
|
def create(opts = {})
|
22
|
-
|
23
|
-
|
21
|
+
add_header_params(opts)
|
22
|
+
add_query_params(opts)
|
24
23
|
add_timeout(opts)
|
25
24
|
add_connect_timeout(opts)
|
26
25
|
add_compression_type(opts)
|
27
|
-
add_data_body(opts)
|
28
26
|
end
|
29
27
|
|
30
|
-
# Add or update
|
28
|
+
# Add or update header_params
|
31
29
|
#
|
32
30
|
# @param opts [Hash]
|
33
31
|
#
|
34
|
-
def
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
opts.delete(:headers)
|
32
|
+
def add_header_params(opts = {})
|
33
|
+
return if opts[:header_params].nil?
|
34
|
+
|
35
|
+
opts[:header_params].each do |opt, value|
|
36
|
+
@header_params[opt.to_s] = value
|
40
37
|
end
|
38
|
+
opts.delete(:header_params)
|
41
39
|
end
|
42
40
|
|
43
41
|
# Add or update query parameters
|
44
42
|
#
|
45
43
|
# @param opts [Hash]
|
46
44
|
#
|
47
|
-
def
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
opts.delete(:params)
|
45
|
+
def add_query_params(opts = {})
|
46
|
+
return if opts[:query_params].nil?
|
47
|
+
|
48
|
+
opts[:query_params].each do |opt, value|
|
49
|
+
@query_params[opt.to_sym] = value
|
53
50
|
end
|
51
|
+
opts.delete(:query_params)
|
54
52
|
end
|
55
53
|
|
56
54
|
# Add or update timeout
|
@@ -79,16 +77,6 @@ module Algolia
|
|
79
77
|
@compression_type = opts[:compression_type] || @compression_type
|
80
78
|
opts.delete(:compression_type)
|
81
79
|
end
|
82
|
-
|
83
|
-
# @param opts [Hash]
|
84
|
-
#
|
85
|
-
def add_data_body(opts = {})
|
86
|
-
unless opts.empty?
|
87
|
-
opts.each do |key, value|
|
88
|
-
@data[key.to_sym] = value
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
80
|
end
|
93
81
|
end
|
94
82
|
end
|
@@ -1,13 +1,12 @@
|
|
1
1
|
module Algolia
|
2
2
|
module Transport
|
3
|
-
# Class RetryStatregy
|
4
3
|
class RetryStrategy
|
5
4
|
include RetryOutcomeType
|
6
5
|
|
7
|
-
# @param
|
6
|
+
# @param hosts [StatefulHost]
|
8
7
|
#
|
9
|
-
def initialize(
|
10
|
-
@hosts =
|
8
|
+
def initialize(hosts)
|
9
|
+
@hosts = hosts
|
11
10
|
@lock = Mutex.new
|
12
11
|
end
|
13
12
|
|
@@ -76,9 +75,7 @@ module Algolia
|
|
76
75
|
# @return [Boolean]
|
77
76
|
#
|
78
77
|
def retryable?(http_response_code, network_failure)
|
79
|
-
if network_failure
|
80
|
-
return true
|
81
|
-
end
|
78
|
+
return true if network_failure
|
82
79
|
|
83
80
|
!http_response_code.nil? && (http_response_code.to_i / 100).floor != 2 && (http_response_code.to_i / 100).floor != 4
|
84
81
|
end
|
@@ -110,7 +107,7 @@ module Algolia
|
|
110
107
|
# @return [Boolean]
|
111
108
|
#
|
112
109
|
def flag?(item, flag)
|
113
|
-
(item & (1 << (flag - 1)))
|
110
|
+
(item & (1 << (flag - 1))).positive?
|
114
111
|
end
|
115
112
|
end
|
116
113
|
end
|
@@ -1,6 +1,5 @@
|
|
1
1
|
module Algolia
|
2
2
|
module Transport
|
3
|
-
# Class StatefulHost
|
4
3
|
class StatefulHost
|
5
4
|
include CallType
|
6
5
|
|
@@ -19,7 +18,7 @@ module Algolia
|
|
19
18
|
@accept = opts[:accept] || (READ | WRITE)
|
20
19
|
@last_use = opts[:last_use] || Time.now.utc
|
21
20
|
@retry_count = opts[:retry_count] || 0
|
22
|
-
@up = opts.
|
21
|
+
@up = opts.key?(:up) ? opts[:up] : true
|
23
22
|
end
|
24
23
|
end
|
25
24
|
end
|
@@ -7,37 +7,14 @@ module Algolia
|
|
7
7
|
class Transport
|
8
8
|
include RetryOutcomeType
|
9
9
|
include CallType
|
10
|
-
include Helpers
|
11
10
|
|
12
|
-
# @param config [
|
11
|
+
# @param config [Configuration]
|
13
12
|
# @param requester [Object] requester used for sending requests. Uses Algolia::Http::HttpRequester by default
|
14
13
|
#
|
15
14
|
def initialize(config, requester)
|
16
|
-
@config
|
17
|
-
@
|
18
|
-
@retry_strategy
|
19
|
-
end
|
20
|
-
|
21
|
-
# Build a request with call type READ
|
22
|
-
#
|
23
|
-
# @param method [Symbol] method used for request
|
24
|
-
# @param path [String] path of the request
|
25
|
-
# @param body [Hash] request body
|
26
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
27
|
-
#
|
28
|
-
def read(method, path, body = {}, opts = {})
|
29
|
-
request(READ, method, path, body, opts)
|
30
|
-
end
|
31
|
-
|
32
|
-
# Build a request with call type WRITE
|
33
|
-
#
|
34
|
-
# @param method [Symbol] method used for request
|
35
|
-
# @param path [String] path of the request
|
36
|
-
# @param body [Hash] request body
|
37
|
-
# @param opts [Hash] contains extra parameters to send with your query
|
38
|
-
#
|
39
|
-
def write(method, path, body = {}, opts = {})
|
40
|
-
request(WRITE, method, path, body, opts)
|
15
|
+
@config = config
|
16
|
+
@requester = requester
|
17
|
+
@retry_strategy = RetryStrategy.new(config.hosts)
|
41
18
|
end
|
42
19
|
|
43
20
|
# @param call_type [Binary] READ or WRITE operation
|
@@ -48,35 +25,38 @@ module Algolia
|
|
48
25
|
#
|
49
26
|
# @return [Response] response of the request
|
50
27
|
#
|
51
|
-
def request(call_type, method, path, body
|
28
|
+
def request(call_type, method, path, body, opts = {})
|
52
29
|
@retry_strategy.get_tryable_hosts(call_type).each do |host|
|
53
30
|
opts[:timeout] ||= get_timeout(call_type) * (host.retry_count + 1)
|
54
31
|
opts[:connect_timeout] ||= @config.connect_timeout * (host.retry_count + 1)
|
55
32
|
|
56
33
|
request_options = RequestOptions.new(@config)
|
57
34
|
request_options.create(opts)
|
58
|
-
|
35
|
+
# TODO: what is this merge for ?
|
36
|
+
# request_options.query_params.merge!(request_options.data) if method == :GET
|
59
37
|
|
60
38
|
request = build_request(method, path, body, request_options)
|
61
|
-
response = @
|
39
|
+
response = @requester.send_request(
|
62
40
|
host,
|
63
41
|
request[:method],
|
64
42
|
request[:path],
|
65
43
|
request[:body],
|
66
|
-
request[:
|
44
|
+
request[:query_params],
|
45
|
+
request[:header_params],
|
67
46
|
request[:timeout],
|
68
47
|
request[:connect_timeout]
|
69
48
|
)
|
70
49
|
|
71
|
-
outcome
|
50
|
+
outcome = @retry_strategy.decide(host, http_response_code: response.status, is_timed_out: response.has_timed_out, network_failure: response.network_failure)
|
72
51
|
if outcome == FAILURE
|
73
|
-
decoded_error =
|
74
|
-
|
52
|
+
decoded_error = JSON.parse(response.error, :symbolize_names => true)
|
53
|
+
puts decoded_error
|
54
|
+
raise AlgoliaHttpError.new(decoded_error[:status], decoded_error[:message])
|
75
55
|
end
|
76
|
-
return
|
56
|
+
return response unless outcome == RETRY
|
77
57
|
end
|
78
58
|
|
79
|
-
raise AlgoliaUnreachableHostError
|
59
|
+
raise AlgoliaUnreachableHostError('Unreachable hosts')
|
80
60
|
end
|
81
61
|
|
82
62
|
private
|
@@ -93,54 +73,27 @@ module Algolia
|
|
93
73
|
def build_request(method, path, body, request_options)
|
94
74
|
request = {}
|
95
75
|
request[:method] = method.downcase
|
96
|
-
request[:path] =
|
97
|
-
request[:body] =
|
98
|
-
request[:
|
76
|
+
request[:path] = path
|
77
|
+
request[:body] = body
|
78
|
+
request[:query_params] = stringify_query_params(request_options.query_params)
|
79
|
+
request[:header_params] = generate_header_params(request_options)
|
99
80
|
request[:timeout] = request_options.timeout
|
100
81
|
request[:connect_timeout] = request_options.connect_timeout
|
101
82
|
request
|
102
83
|
end
|
103
84
|
|
104
|
-
# Build the uri from path and additional params
|
105
|
-
#
|
106
|
-
# @param [Object] path
|
107
|
-
# @param [Object] params
|
108
|
-
#
|
109
|
-
# @return [String]
|
110
|
-
#
|
111
|
-
def build_uri_path(path, params)
|
112
|
-
path + handle_params(params)
|
113
|
-
end
|
114
|
-
|
115
|
-
# Build the body of the request
|
116
|
-
#
|
117
|
-
# @param [Hash] body
|
118
|
-
#
|
119
|
-
# @return [Hash]
|
120
|
-
#
|
121
|
-
def build_body(body, request_options, method)
|
122
|
-
if method == :GET && body.empty?
|
123
|
-
return nil
|
124
|
-
end
|
125
|
-
|
126
|
-
# merge optional special request options to the body when it
|
127
|
-
# doesn't have to be in the array format
|
128
|
-
body.merge!(request_options.data) if body.is_a?(Hash) && method != :GET
|
129
|
-
to_json(body)
|
130
|
-
end
|
131
|
-
|
132
85
|
# Generates headers from config headers and optional parameters
|
133
86
|
#
|
134
87
|
# @param request_options [RequestOptions]
|
135
88
|
#
|
136
89
|
# @return [Hash] merged headers
|
137
90
|
#
|
138
|
-
def
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
91
|
+
def generate_header_params(request_options = {})
|
92
|
+
header_params = request_options.header_params.transform_keys(&:downcase)
|
93
|
+
header_params = @config.header_params.merge(header_params)
|
94
|
+
header_params['accept-encoding'] = 'gzip' if request_options.compression_type == 'gzip'
|
95
|
+
|
96
|
+
header_params
|
144
97
|
end
|
145
98
|
|
146
99
|
# Retrieves a timeout according to call_type
|
@@ -157,6 +110,13 @@ module Algolia
|
|
157
110
|
@config.write_timeout
|
158
111
|
end
|
159
112
|
end
|
113
|
+
|
114
|
+
def stringify_query_params(query_params)
|
115
|
+
query_params.map do |key, value|
|
116
|
+
value = value.join(',') if value.is_a?(Array)
|
117
|
+
[key, value.to_s]
|
118
|
+
end.to_h
|
119
|
+
end
|
160
120
|
end
|
161
121
|
end
|
162
122
|
end
|
data/lib/algolia/user_agent.rb
CHANGED
@@ -2,24 +2,14 @@ module Algolia
|
|
2
2
|
class UserAgent
|
3
3
|
attr_accessor :value
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
# Set the value of the UserAgent
|
8
|
-
#
|
9
|
-
def self.value
|
10
|
-
@@value
|
11
|
-
end
|
12
|
-
|
13
|
-
# Resets the value of the UserAgent
|
14
|
-
#
|
15
|
-
def self.reset_to_default
|
16
|
-
@@value = Defaults::USER_AGENT
|
5
|
+
def initialize
|
6
|
+
@value = "Algolia for Ruby (#{VERSION}); Ruby (#{RUBY_VERSION})"
|
17
7
|
end
|
18
8
|
|
19
9
|
# Adds a segment to the UserAgent
|
20
10
|
#
|
21
|
-
def
|
22
|
-
|
11
|
+
def add(segment, version)
|
12
|
+
@value += format('; %<segment>s (%<version>s)', segment: segment, version: version)
|
23
13
|
end
|
24
14
|
end
|
25
15
|
end
|