algolia 2.3.3 → 3.0.0.alpha.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -89
- data/Gemfile +1 -14
- data/Gemfile.lock +64 -0
- data/README.md +4 -6
- data/Rakefile +0 -39
- data/algolia.gemspec +24 -39
- data/lib/algolia/api/abtesting_client.rb +418 -0
- data/lib/algolia/api/analytics_client.rb +1294 -0
- data/lib/algolia/api/ingestion_client.rb +1659 -0
- data/lib/algolia/api/insights_client.rb +252 -0
- data/lib/algolia/api/monitoring_client.rb +555 -0
- data/lib/algolia/api/personalization_client.rb +365 -0
- data/lib/algolia/api/query_suggestions_client.rb +491 -0
- data/lib/algolia/api/recommend_client.rb +460 -0
- data/lib/algolia/api/search_client.rb +2723 -0
- data/lib/algolia/api_client.rb +153 -0
- data/lib/algolia/api_error.rb +48 -0
- data/lib/algolia/configuration.rb +41 -0
- data/lib/algolia/logger_helper.rb +1 -1
- data/lib/algolia/models/abtesting/ab_test.rb +332 -0
- data/lib/algolia/models/abtesting/ab_test_response.rb +219 -0
- data/lib/algolia/models/abtesting/ab_tests_variant.rb +217 -0
- data/lib/algolia/models/abtesting/ab_tests_variant_search_params.rb +236 -0
- data/lib/algolia/models/abtesting/add_ab_tests_request.rb +239 -0
- data/lib/algolia/models/abtesting/add_ab_tests_variant.rb +96 -0
- data/lib/algolia/models/abtesting/currencies_value.rb +223 -0
- data/lib/algolia/models/abtesting/custom_search_params.rb +195 -0
- data/lib/algolia/models/abtesting/error_base.rb +196 -0
- data/lib/algolia/models/abtesting/filter_effects.rb +202 -0
- data/lib/algolia/models/abtesting/filter_effects_empty_search.rb +204 -0
- data/lib/algolia/models/abtesting/filter_effects_outliers.rb +204 -0
- data/lib/algolia/models/abtesting/list_ab_tests_response.rb +221 -0
- data/lib/algolia/models/abtesting/variant.rb +399 -0
- data/lib/algolia/models/analytics/average_click_event.rb +219 -0
- data/lib/algolia/models/analytics/click_position.rb +209 -0
- data/lib/algolia/models/analytics/click_through_rate_event.rb +249 -0
- data/lib/algolia/models/analytics/conversion_rate_event.rb +249 -0
- data/lib/algolia/models/analytics/direction.rb +33 -0
- data/lib/algolia/models/analytics/error_base.rb +196 -0
- data/lib/algolia/models/analytics/get_average_click_position_response.rb +221 -0
- data/lib/algolia/models/analytics/get_click_positions_response.rb +215 -0
- data/lib/algolia/models/analytics/get_click_through_rate_response.rb +251 -0
- data/lib/algolia/models/analytics/get_conversation_rate_response.rb +251 -0
- data/lib/algolia/models/analytics/get_no_click_rate_response.rb +251 -0
- data/lib/algolia/models/analytics/get_no_results_rate_response.rb +251 -0
- data/lib/algolia/models/analytics/get_searches_count_response.rb +209 -0
- data/lib/algolia/models/analytics/get_searches_no_clicks_response.rb +197 -0
- data/lib/algolia/models/analytics/get_searches_no_results_response.rb +197 -0
- data/lib/algolia/models/analytics/get_status_response.rb +195 -0
- data/lib/algolia/models/analytics/get_top_countries_response.rb +197 -0
- data/lib/algolia/models/analytics/get_top_filter_attribute.rb +207 -0
- data/lib/algolia/models/analytics/get_top_filter_attributes_response.rb +197 -0
- data/lib/algolia/models/analytics/get_top_filter_for_attribute.rb +231 -0
- data/lib/algolia/models/analytics/get_top_filter_for_attribute_response.rb +197 -0
- data/lib/algolia/models/analytics/get_top_filters_no_results_response.rb +197 -0
- data/lib/algolia/models/analytics/get_top_filters_no_results_value.rb +219 -0
- data/lib/algolia/models/analytics/get_top_filters_no_results_values.rb +209 -0
- data/lib/algolia/models/analytics/get_top_hits_response.rb +96 -0
- data/lib/algolia/models/analytics/get_top_searches_response.rb +96 -0
- data/lib/algolia/models/analytics/get_users_count_response.rb +209 -0
- data/lib/algolia/models/analytics/no_click_rate_event.rb +249 -0
- data/lib/algolia/models/analytics/no_results_rate_event.rb +249 -0
- data/lib/algolia/models/analytics/order_by.rb +35 -0
- data/lib/algolia/models/analytics/search_event.rb +207 -0
- data/lib/algolia/models/analytics/search_no_click_event.rb +219 -0
- data/lib/algolia/models/analytics/search_no_result_event.rb +219 -0
- data/lib/algolia/models/analytics/top_country.rb +207 -0
- data/lib/algolia/models/analytics/top_hit.rb +207 -0
- data/lib/algolia/models/analytics/top_hit_with_analytics.rb +285 -0
- data/lib/algolia/models/analytics/top_hits_response.rb +197 -0
- data/lib/algolia/models/analytics/top_hits_response_with_analytics.rb +197 -0
- data/lib/algolia/models/analytics/top_search.rb +219 -0
- data/lib/algolia/models/analytics/top_search_with_analytics.rb +309 -0
- data/lib/algolia/models/analytics/top_searches_response.rb +197 -0
- data/lib/algolia/models/analytics/top_searches_response_with_analytics.rb +197 -0
- data/lib/algolia/models/analytics/user_with_date.rb +207 -0
- data/lib/algolia/models/ingestion/action_type.rb +34 -0
- data/lib/algolia/models/ingestion/auth_algolia.rb +207 -0
- data/lib/algolia/models/ingestion/auth_algolia_partial.rb +203 -0
- data/lib/algolia/models/ingestion/auth_api_key.rb +195 -0
- data/lib/algolia/models/ingestion/auth_api_key_partial.rb +193 -0
- data/lib/algolia/models/ingestion/auth_basic.rb +206 -0
- data/lib/algolia/models/ingestion/auth_basic_partial.rb +202 -0
- data/lib/algolia/models/ingestion/auth_google_service_account.rb +208 -0
- data/lib/algolia/models/ingestion/auth_google_service_account_partial.rb +204 -0
- data/lib/algolia/models/ingestion/auth_input.rb +99 -0
- data/lib/algolia/models/ingestion/auth_input_partial.rb +99 -0
- data/lib/algolia/models/ingestion/auth_o_auth.rb +220 -0
- data/lib/algolia/models/ingestion/auth_o_auth_partial.rb +214 -0
- data/lib/algolia/models/ingestion/authentication.rb +283 -0
- data/lib/algolia/models/ingestion/authentication_create.rb +249 -0
- data/lib/algolia/models/ingestion/authentication_create_response.rb +220 -0
- data/lib/algolia/models/ingestion/authentication_search.rb +197 -0
- data/lib/algolia/models/ingestion/authentication_sort_keys.rb +36 -0
- data/lib/algolia/models/ingestion/authentication_type.rb +36 -0
- data/lib/algolia/models/ingestion/authentication_update.rb +243 -0
- data/lib/algolia/models/ingestion/authentication_update_response.rb +220 -0
- data/lib/algolia/models/ingestion/big_commerce_channel.rb +207 -0
- data/lib/algolia/models/ingestion/big_commerce_metafield.rb +207 -0
- data/lib/algolia/models/ingestion/big_query_data_type.rb +33 -0
- data/lib/algolia/models/ingestion/delete_response.rb +195 -0
- data/lib/algolia/models/ingestion/destination.rb +283 -0
- data/lib/algolia/models/ingestion/destination_create.rb +250 -0
- data/lib/algolia/models/ingestion/destination_create_response.rb +220 -0
- data/lib/algolia/models/ingestion/destination_index_name.rb +238 -0
- data/lib/algolia/models/ingestion/destination_index_prefix.rb +195 -0
- data/lib/algolia/models/ingestion/destination_input.rb +96 -0
- data/lib/algolia/models/ingestion/destination_search.rb +197 -0
- data/lib/algolia/models/ingestion/destination_sort_keys.rb +35 -0
- data/lib/algolia/models/ingestion/destination_type.rb +34 -0
- data/lib/algolia/models/ingestion/destination_update.rb +243 -0
- data/lib/algolia/models/ingestion/destination_update_response.rb +220 -0
- data/lib/algolia/models/ingestion/docker_image_type.rb +34 -0
- data/lib/algolia/models/ingestion/docker_registry.rb +33 -0
- data/lib/algolia/models/ingestion/docker_source_discover.rb +207 -0
- data/lib/algolia/models/ingestion/docker_source_streams.rb +196 -0
- data/lib/algolia/models/ingestion/error_base.rb +196 -0
- data/lib/algolia/models/ingestion/event.rb +311 -0
- data/lib/algolia/models/ingestion/event_sort_keys.rb +34 -0
- data/lib/algolia/models/ingestion/event_status.rb +37 -0
- data/lib/algolia/models/ingestion/event_type.rb +35 -0
- data/lib/algolia/models/ingestion/list_authentications_response.rb +207 -0
- data/lib/algolia/models/ingestion/list_destinations_response.rb +207 -0
- data/lib/algolia/models/ingestion/list_events_response.rb +218 -0
- data/lib/algolia/models/ingestion/list_sources_response.rb +207 -0
- data/lib/algolia/models/ingestion/list_tasks_response.rb +208 -0
- data/lib/algolia/models/ingestion/mapping_type_csv.rb +36 -0
- data/lib/algolia/models/ingestion/method_type.rb +33 -0
- data/lib/algolia/models/ingestion/on_demand_date_utils_input.rb +208 -0
- data/lib/algolia/models/ingestion/on_demand_trigger.rb +227 -0
- data/lib/algolia/models/ingestion/on_demand_trigger_input.rb +217 -0
- data/lib/algolia/models/ingestion/on_demand_trigger_type.rb +32 -0
- data/lib/algolia/models/ingestion/order_keys.rb +33 -0
- data/lib/algolia/models/ingestion/pagination.rb +227 -0
- data/lib/algolia/models/ingestion/platform.rb +33 -0
- data/lib/algolia/models/ingestion/platform_none.rb +32 -0
- data/lib/algolia/models/ingestion/platform_with_none.rb +96 -0
- data/lib/algolia/models/ingestion/record_type.rb +33 -0
- data/lib/algolia/models/ingestion/run.rb +359 -0
- data/lib/algolia/models/ingestion/run_list_response.rb +218 -0
- data/lib/algolia/models/ingestion/run_outcome.rb +34 -0
- data/lib/algolia/models/ingestion/run_progress.rb +201 -0
- data/lib/algolia/models/ingestion/run_reason_code.rb +38 -0
- data/lib/algolia/models/ingestion/run_response.rb +208 -0
- data/lib/algolia/models/ingestion/run_sort_keys.rb +34 -0
- data/lib/algolia/models/ingestion/run_status.rb +36 -0
- data/lib/algolia/models/ingestion/run_type.rb +34 -0
- data/lib/algolia/models/ingestion/schedule_date_utils_input.rb +214 -0
- data/lib/algolia/models/ingestion/schedule_trigger.rb +251 -0
- data/lib/algolia/models/ingestion/schedule_trigger_input.rb +229 -0
- data/lib/algolia/models/ingestion/schedule_trigger_type.rb +32 -0
- data/lib/algolia/models/ingestion/source.rb +282 -0
- data/lib/algolia/models/ingestion/source_big_commerce.rb +235 -0
- data/lib/algolia/models/ingestion/source_big_query.rb +278 -0
- data/lib/algolia/models/ingestion/source_commercetools.rb +238 -0
- data/lib/algolia/models/ingestion/source_create.rb +248 -0
- data/lib/algolia/models/ingestion/source_create_response.rb +218 -0
- data/lib/algolia/models/ingestion/source_csv.rb +276 -0
- data/lib/algolia/models/ingestion/source_docker.rb +261 -0
- data/lib/algolia/models/ingestion/source_input.rb +100 -0
- data/lib/algolia/models/ingestion/source_json.rb +236 -0
- data/lib/algolia/models/ingestion/source_search.rb +196 -0
- data/lib/algolia/models/ingestion/source_sort_keys.rb +35 -0
- data/lib/algolia/models/ingestion/source_type.rb +37 -0
- data/lib/algolia/models/ingestion/source_update.rb +211 -0
- data/lib/algolia/models/ingestion/source_update_commercetools.rb +207 -0
- data/lib/algolia/models/ingestion/source_update_docker.rb +246 -0
- data/lib/algolia/models/ingestion/source_update_input.rb +99 -0
- data/lib/algolia/models/ingestion/source_update_response.rb +218 -0
- data/lib/algolia/models/ingestion/subscription_trigger.rb +217 -0
- data/lib/algolia/models/ingestion/subscription_trigger_type.rb +32 -0
- data/lib/algolia/models/ingestion/task.rb +334 -0
- data/lib/algolia/models/ingestion/task_create.rb +299 -0
- data/lib/algolia/models/ingestion/task_create_response.rb +208 -0
- data/lib/algolia/models/ingestion/task_create_trigger.rb +97 -0
- data/lib/algolia/models/ingestion/task_input.rb +96 -0
- data/lib/algolia/models/ingestion/task_search.rb +196 -0
- data/lib/algolia/models/ingestion/task_sort_keys.rb +36 -0
- data/lib/algolia/models/ingestion/task_update.rb +250 -0
- data/lib/algolia/models/ingestion/task_update_response.rb +208 -0
- data/lib/algolia/models/ingestion/trigger.rb +97 -0
- data/lib/algolia/models/ingestion/trigger_type.rb +34 -0
- data/lib/algolia/models/ingestion/trigger_update_input.rb +196 -0
- data/lib/algolia/models/ingestion/window.rb +208 -0
- data/lib/algolia/models/insights/add_to_cart_event.rb +32 -0
- data/lib/algolia/models/insights/added_to_cart_object_ids.rb +384 -0
- data/lib/algolia/models/insights/added_to_cart_object_ids_after_search.rb +419 -0
- data/lib/algolia/models/insights/click_event.rb +32 -0
- data/lib/algolia/models/insights/clicked_filters.rb +351 -0
- data/lib/algolia/models/insights/clicked_object_ids.rb +341 -0
- data/lib/algolia/models/insights/clicked_object_ids_after_search.rb +418 -0
- data/lib/algolia/models/insights/conversion_event.rb +32 -0
- data/lib/algolia/models/insights/converted_filters.rb +350 -0
- data/lib/algolia/models/insights/converted_object_ids.rb +351 -0
- data/lib/algolia/models/insights/converted_object_ids_after_search.rb +386 -0
- data/lib/algolia/models/insights/discount.rb +97 -0
- data/lib/algolia/models/insights/error_base.rb +196 -0
- data/lib/algolia/models/insights/events_items.rb +106 -0
- data/lib/algolia/models/insights/events_response.rb +204 -0
- data/lib/algolia/models/insights/insights_events.rb +215 -0
- data/lib/algolia/models/insights/object_data.rb +211 -0
- data/lib/algolia/models/insights/object_data_after_search.rb +221 -0
- data/lib/algolia/models/insights/price.rb +97 -0
- data/lib/algolia/models/insights/purchase_event.rb +32 -0
- data/lib/algolia/models/insights/purchased_object_ids.rb +384 -0
- data/lib/algolia/models/insights/purchased_object_ids_after_search.rb +419 -0
- data/lib/algolia/models/insights/view_event.rb +32 -0
- data/lib/algolia/models/insights/viewed_filters.rb +351 -0
- data/lib/algolia/models/insights/viewed_object_ids.rb +351 -0
- data/lib/algolia/models/monitoring/error_base.rb +196 -0
- data/lib/algolia/models/monitoring/get_inventory403_response.rb +192 -0
- data/lib/algolia/models/monitoring/incident.rb +225 -0
- data/lib/algolia/models/monitoring/incidents_inner.rb +202 -0
- data/lib/algolia/models/monitoring/incidents_response.rb +194 -0
- data/lib/algolia/models/monitoring/indexing_time_response.rb +192 -0
- data/lib/algolia/models/monitoring/indexing_time_response_metrics.rb +194 -0
- data/lib/algolia/models/monitoring/infrastructure_response.rb +192 -0
- data/lib/algolia/models/monitoring/infrastructure_response_metrics.rb +243 -0
- data/lib/algolia/models/monitoring/inventory_response.rb +194 -0
- data/lib/algolia/models/monitoring/latency_response.rb +192 -0
- data/lib/algolia/models/monitoring/latency_response_metrics.rb +194 -0
- data/lib/algolia/models/monitoring/metric.rb +37 -0
- data/lib/algolia/models/monitoring/period.rb +36 -0
- data/lib/algolia/models/monitoring/probes_metric.rb +203 -0
- data/lib/algolia/models/monitoring/region.rb +46 -0
- data/lib/algolia/models/monitoring/server.rb +272 -0
- data/lib/algolia/models/monitoring/server_status.rb +32 -0
- data/lib/algolia/models/monitoring/status.rb +35 -0
- data/lib/algolia/models/monitoring/status_response.rb +194 -0
- data/lib/algolia/models/monitoring/time_inner.rb +203 -0
- data/lib/algolia/models/monitoring/type.rb +32 -0
- data/lib/algolia/models/personalization/delete_user_profile_response.rb +207 -0
- data/lib/algolia/models/personalization/error_base.rb +196 -0
- data/lib/algolia/models/personalization/event_scoring.rb +219 -0
- data/lib/algolia/models/personalization/facet_scoring.rb +207 -0
- data/lib/algolia/models/personalization/get_user_token_response.rb +219 -0
- data/lib/algolia/models/personalization/personalization_strategy_params.rb +223 -0
- data/lib/algolia/models/personalization/set_personalization_strategy_response.rb +195 -0
- data/lib/algolia/models/query-suggestions/base_query_suggestions_configuration_response.rb +223 -0
- data/lib/algolia/models/query-suggestions/base_query_suggestions_configuration_with_index.rb +195 -0
- data/lib/algolia/models/query-suggestions/base_response.rb +203 -0
- data/lib/algolia/models/query-suggestions/error_base.rb +196 -0
- data/lib/algolia/models/query-suggestions/facet.rb +204 -0
- data/lib/algolia/models/query-suggestions/get_config_status200_response.rb +233 -0
- data/lib/algolia/models/query-suggestions/get_log_file200_response.rb +244 -0
- data/lib/algolia/models/query-suggestions/languages.rb +97 -0
- data/lib/algolia/models/query-suggestions/log_level.rb +34 -0
- data/lib/algolia/models/query-suggestions/query_suggestions_configuration.rb +255 -0
- data/lib/algolia/models/query-suggestions/query_suggestions_configuration_response.rb +315 -0
- data/lib/algolia/models/query-suggestions/query_suggestions_configuration_with_index.rb +275 -0
- data/lib/algolia/models/query-suggestions/source_index.rb +305 -0
- data/lib/algolia/models/recommend/advanced_syntax_features.rb +33 -0
- data/lib/algolia/models/recommend/alternatives_as_exact.rb +34 -0
- data/lib/algolia/models/recommend/anchoring.rb +35 -0
- data/lib/algolia/models/recommend/around_precision.rb +97 -0
- data/lib/algolia/models/recommend/around_precision_from_value_inner.rb +201 -0
- data/lib/algolia/models/recommend/around_radius.rb +97 -0
- data/lib/algolia/models/recommend/around_radius_all.rb +32 -0
- data/lib/algolia/models/recommend/automatic_facet_filter.rb +216 -0
- data/lib/algolia/models/recommend/automatic_facet_filters.rb +97 -0
- data/lib/algolia/models/recommend/base_recommend_request.rb +233 -0
- data/lib/algolia/models/recommend/base_recommendations_query.rb +246 -0
- data/lib/algolia/models/recommend/base_recommended_for_you_query.rb +234 -0
- data/lib/algolia/models/recommend/base_recommended_for_you_query_parameters.rb +195 -0
- data/lib/algolia/models/recommend/base_search_params.rb +564 -0
- data/lib/algolia/models/recommend/base_search_params_without_query.rb +546 -0
- data/lib/algolia/models/recommend/base_search_response.rb +517 -0
- data/lib/algolia/models/recommend/base_trending_facets_query.rb +226 -0
- data/lib/algolia/models/recommend/base_trending_items_query.rb +252 -0
- data/lib/algolia/models/recommend/condition.rb +244 -0
- data/lib/algolia/models/recommend/consequence.rb +239 -0
- data/lib/algolia/models/recommend/consequence_hide.rb +196 -0
- data/lib/algolia/models/recommend/consequence_params.rb +1121 -0
- data/lib/algolia/models/recommend/consequence_query.rb +97 -0
- data/lib/algolia/models/recommend/consequence_query_object.rb +207 -0
- data/lib/algolia/models/recommend/deleted_at_response.rb +208 -0
- data/lib/algolia/models/recommend/distinct.rb +97 -0
- data/lib/algolia/models/recommend/edit.rb +234 -0
- data/lib/algolia/models/recommend/edit_type.rb +33 -0
- data/lib/algolia/models/recommend/error_base.rb +196 -0
- data/lib/algolia/models/recommend/exact_on_single_word_query.rb +34 -0
- data/lib/algolia/models/recommend/exhaustive.rb +234 -0
- data/lib/algolia/models/recommend/facet_filters.rb +97 -0
- data/lib/algolia/models/recommend/facet_ordering.rb +205 -0
- data/lib/algolia/models/recommend/facets.rb +196 -0
- data/lib/algolia/models/recommend/facets_stats.rb +223 -0
- data/lib/algolia/models/recommend/get_recommend_task_response.rb +216 -0
- data/lib/algolia/models/recommend/get_recommendations_params.rb +198 -0
- data/lib/algolia/models/recommend/get_recommendations_response.rb +194 -0
- data/lib/algolia/models/recommend/highlight_result.rb +96 -0
- data/lib/algolia/models/recommend/highlight_result_option.rb +253 -0
- data/lib/algolia/models/recommend/ignore_plurals.rb +97 -0
- data/lib/algolia/models/recommend/index_settings_as_search_params.rb +723 -0
- data/lib/algolia/models/recommend/match_level.rb +34 -0
- data/lib/algolia/models/recommend/matched_geo_location.rb +213 -0
- data/lib/algolia/models/recommend/mixed_search_filters.rb +96 -0
- data/lib/algolia/models/recommend/mode.rb +33 -0
- data/lib/algolia/models/recommend/numeric_filters.rb +97 -0
- data/lib/algolia/models/recommend/optional_filters.rb +97 -0
- data/lib/algolia/models/recommend/params.rb +220 -0
- data/lib/algolia/models/recommend/personalization.rb +213 -0
- data/lib/algolia/models/recommend/promote.rb +96 -0
- data/lib/algolia/models/recommend/promote_object_id.rb +208 -0
- data/lib/algolia/models/recommend/promote_object_ids.rb +210 -0
- data/lib/algolia/models/recommend/query_type.rb +34 -0
- data/lib/algolia/models/recommend/ranking_info.rb +328 -0
- data/lib/algolia/models/recommend/re_ranking_apply_filter.rb +97 -0
- data/lib/algolia/models/recommend/recommend_hit.rb +271 -0
- data/lib/algolia/models/recommend/recommend_models.rb +35 -0
- data/lib/algolia/models/recommend/recommendation_models.rb +33 -0
- data/lib/algolia/models/recommend/recommendations_hit.rb +96 -0
- data/lib/algolia/models/recommend/recommendations_hits.rb +216 -0
- data/lib/algolia/models/recommend/recommendations_query.rb +304 -0
- data/lib/algolia/models/recommend/recommendations_request.rb +98 -0
- data/lib/algolia/models/recommend/recommendations_results.rb +553 -0
- data/lib/algolia/models/recommend/recommended_for_you_model.rb +32 -0
- data/lib/algolia/models/recommend/recommended_for_you_query.rb +292 -0
- data/lib/algolia/models/recommend/recommended_for_you_query_parameters.rb +1105 -0
- data/lib/algolia/models/recommend/redirect.rb +195 -0
- data/lib/algolia/models/recommend/redirect_rule_index_metadata.rb +242 -0
- data/lib/algolia/models/recommend/redirect_rule_index_metadata_data.rb +195 -0
- data/lib/algolia/models/recommend/remove_stop_words.rb +97 -0
- data/lib/algolia/models/recommend/remove_words_if_no_results.rb +35 -0
- data/lib/algolia/models/recommend/rendering_content.rb +193 -0
- data/lib/algolia/models/recommend/rule_response.rb +246 -0
- data/lib/algolia/models/recommend/rule_response_metadata.rb +193 -0
- data/lib/algolia/models/recommend/search_params_object.rb +1103 -0
- data/lib/algolia/models/recommend/search_params_query.rb +193 -0
- data/lib/algolia/models/recommend/search_recommend_rules_params.rb +268 -0
- data/lib/algolia/models/recommend/search_recommend_rules_response.rb +233 -0
- data/lib/algolia/models/recommend/semantic_search.rb +198 -0
- data/lib/algolia/models/recommend/snippet_result.rb +96 -0
- data/lib/algolia/models/recommend/snippet_result_option.rb +229 -0
- data/lib/algolia/models/recommend/sort_remaining_by.rb +34 -0
- data/lib/algolia/models/recommend/tag_filters.rb +97 -0
- data/lib/algolia/models/recommend/task_status.rb +33 -0
- data/lib/algolia/models/recommend/trending_facet_hit.rb +238 -0
- data/lib/algolia/models/recommend/trending_facets_model.rb +32 -0
- data/lib/algolia/models/recommend/trending_facets_query.rb +284 -0
- data/lib/algolia/models/recommend/trending_items_model.rb +32 -0
- data/lib/algolia/models/recommend/trending_items_query.rb +310 -0
- data/lib/algolia/models/recommend/typo_tolerance.rb +97 -0
- data/lib/algolia/models/recommend/typo_tolerance_enum.rb +33 -0
- data/lib/algolia/models/recommend/value.rb +226 -0
- data/lib/algolia/models/search/acl.rb +47 -0
- data/lib/algolia/models/search/action.rb +38 -0
- data/lib/algolia/models/search/add_api_key_response.rb +207 -0
- data/lib/algolia/models/search/advanced_syntax_features.rb +33 -0
- data/lib/algolia/models/search/alternatives_as_exact.rb +34 -0
- data/lib/algolia/models/search/anchoring.rb +35 -0
- data/lib/algolia/models/search/api_key.rb +272 -0
- data/lib/algolia/models/search/around_precision.rb +97 -0
- data/lib/algolia/models/search/around_precision_from_value_inner.rb +201 -0
- data/lib/algolia/models/search/around_radius.rb +97 -0
- data/lib/algolia/models/search/around_radius_all.rb +32 -0
- data/lib/algolia/models/search/assign_user_id_params.rb +196 -0
- data/lib/algolia/models/search/attribute_to_update.rb +96 -0
- data/lib/algolia/models/search/automatic_facet_filter.rb +216 -0
- data/lib/algolia/models/search/automatic_facet_filters.rb +97 -0
- data/lib/algolia/models/search/base_get_api_key_response.rb +205 -0
- data/lib/algolia/models/search/base_index_settings.rb +366 -0
- data/lib/algolia/models/search/base_search_params.rb +564 -0
- data/lib/algolia/models/search/base_search_params_without_query.rb +546 -0
- data/lib/algolia/models/search/base_search_response.rb +517 -0
- data/lib/algolia/models/search/batch_assign_user_ids_params.rb +210 -0
- data/lib/algolia/models/search/batch_dictionary_entries_params.rb +208 -0
- data/lib/algolia/models/search/batch_dictionary_entries_request.rb +227 -0
- data/lib/algolia/models/search/batch_params.rb +197 -0
- data/lib/algolia/models/search/batch_request.rb +228 -0
- data/lib/algolia/models/search/batch_response.rb +209 -0
- data/lib/algolia/models/search/batch_write_params.rb +197 -0
- data/lib/algolia/models/search/browse_params.rb +96 -0
- data/lib/algolia/models/search/browse_params_object.rb +1113 -0
- data/lib/algolia/models/search/browse_response.rb +568 -0
- data/lib/algolia/models/search/built_in_operation.rb +229 -0
- data/lib/algolia/models/search/built_in_operation_type.rb +38 -0
- data/lib/algolia/models/search/condition.rb +244 -0
- data/lib/algolia/models/search/consequence.rb +239 -0
- data/lib/algolia/models/search/consequence_hide.rb +196 -0
- data/lib/algolia/models/search/consequence_params.rb +1121 -0
- data/lib/algolia/models/search/consequence_query.rb +97 -0
- data/lib/algolia/models/search/consequence_query_object.rb +207 -0
- data/lib/algolia/models/search/created_at_response.rb +196 -0
- data/lib/algolia/models/search/cursor.rb +193 -0
- data/lib/algolia/models/search/delete_api_key_response.rb +195 -0
- data/lib/algolia/models/search/delete_by_params.rb +263 -0
- data/lib/algolia/models/search/delete_source_response.rb +195 -0
- data/lib/algolia/models/search/deleted_at_response.rb +208 -0
- data/lib/algolia/models/search/dictionary_action.rb +33 -0
- data/lib/algolia/models/search/dictionary_entry.rb +276 -0
- data/lib/algolia/models/search/dictionary_entry_state.rb +33 -0
- data/lib/algolia/models/search/dictionary_language.rb +194 -0
- data/lib/algolia/models/search/dictionary_settings_params.rb +195 -0
- data/lib/algolia/models/search/dictionary_type.rb +34 -0
- data/lib/algolia/models/search/distinct.rb +97 -0
- data/lib/algolia/models/search/edit.rb +234 -0
- data/lib/algolia/models/search/edit_type.rb +33 -0
- data/lib/algolia/models/search/error_base.rb +196 -0
- data/lib/algolia/models/search/exact_on_single_word_query.rb +34 -0
- data/lib/algolia/models/search/exhaustive.rb +234 -0
- data/lib/algolia/models/search/facet_filters.rb +97 -0
- data/lib/algolia/models/search/facet_hits.rb +219 -0
- data/lib/algolia/models/search/facet_ordering.rb +205 -0
- data/lib/algolia/models/search/facets.rb +196 -0
- data/lib/algolia/models/search/facets_stats.rb +223 -0
- data/lib/algolia/models/search/fetched_index.rb +313 -0
- data/lib/algolia/models/search/get_api_key_response.rb +301 -0
- data/lib/algolia/models/search/get_dictionary_settings_response.rb +194 -0
- data/lib/algolia/models/search/get_logs_response.rb +196 -0
- data/lib/algolia/models/search/get_objects_params.rb +197 -0
- data/lib/algolia/models/search/get_objects_request.rb +220 -0
- data/lib/algolia/models/search/get_objects_response.rb +197 -0
- data/lib/algolia/models/search/get_task_response.rb +216 -0
- data/lib/algolia/models/search/get_top_user_ids_response.rb +198 -0
- data/lib/algolia/models/search/has_pending_mappings_response.rb +207 -0
- data/lib/algolia/models/search/highlight_result.rb +96 -0
- data/lib/algolia/models/search/highlight_result_option.rb +253 -0
- data/lib/algolia/models/search/hit.rb +241 -0
- data/lib/algolia/models/search/ignore_plurals.rb +97 -0
- data/lib/algolia/models/search/index_settings.rb +912 -0
- data/lib/algolia/models/search/index_settings_as_search_params.rb +723 -0
- data/lib/algolia/models/search/languages.rb +221 -0
- data/lib/algolia/models/search/list_api_keys_response.rb +197 -0
- data/lib/algolia/models/search/list_clusters_response.rb +198 -0
- data/lib/algolia/models/search/list_indices_response.rb +207 -0
- data/lib/algolia/models/search/list_user_ids_response.rb +198 -0
- data/lib/algolia/models/search/log.rb +358 -0
- data/lib/algolia/models/search/log_query.rb +213 -0
- data/lib/algolia/models/search/log_type.rb +35 -0
- data/lib/algolia/models/search/match_level.rb +34 -0
- data/lib/algolia/models/search/matched_geo_location.rb +213 -0
- data/lib/algolia/models/search/mixed_search_filters.rb +96 -0
- data/lib/algolia/models/search/mode.rb +33 -0
- data/lib/algolia/models/search/multiple_batch_request.rb +240 -0
- data/lib/algolia/models/search/multiple_batch_response.rb +211 -0
- data/lib/algolia/models/search/numeric_filters.rb +97 -0
- data/lib/algolia/models/search/operation_index_params.rb +240 -0
- data/lib/algolia/models/search/operation_type.rb +33 -0
- data/lib/algolia/models/search/optional_filters.rb +97 -0
- data/lib/algolia/models/search/params.rb +220 -0
- data/lib/algolia/models/search/personalization.rb +213 -0
- data/lib/algolia/models/search/promote.rb +96 -0
- data/lib/algolia/models/search/promote_object_id.rb +208 -0
- data/lib/algolia/models/search/promote_object_ids.rb +210 -0
- data/lib/algolia/models/search/query_type.rb +34 -0
- data/lib/algolia/models/search/ranking_info.rb +328 -0
- data/lib/algolia/models/search/re_ranking_apply_filter.rb +97 -0
- data/lib/algolia/models/search/redirect.rb +195 -0
- data/lib/algolia/models/search/redirect_rule_index_metadata.rb +242 -0
- data/lib/algolia/models/search/redirect_rule_index_metadata_data.rb +195 -0
- data/lib/algolia/models/search/remove_stop_words.rb +97 -0
- data/lib/algolia/models/search/remove_user_id_response.rb +195 -0
- data/lib/algolia/models/search/remove_words_if_no_results.rb +35 -0
- data/lib/algolia/models/search/rendering_content.rb +193 -0
- data/lib/algolia/models/search/replace_source_response.rb +195 -0
- data/lib/algolia/models/search/rule.rb +249 -0
- data/lib/algolia/models/search/save_object_response.rb +217 -0
- data/lib/algolia/models/search/save_synonym_response.rb +219 -0
- data/lib/algolia/models/search/scope_type.rb +34 -0
- data/lib/algolia/models/search/search_dictionary_entries_params.rb +244 -0
- data/lib/algolia/models/search/search_for_facet_values_request.rb +227 -0
- data/lib/algolia/models/search/search_for_facet_values_response.rb +218 -0
- data/lib/algolia/models/search/search_for_facets.rb +1158 -0
- data/lib/algolia/models/search/search_for_facets_options.rb +274 -0
- data/lib/algolia/models/search/search_for_hits.rb +1134 -0
- data/lib/algolia/models/search/search_for_hits_options.rb +226 -0
- data/lib/algolia/models/search/search_hits.rb +223 -0
- data/lib/algolia/models/search/search_method_params.rb +227 -0
- data/lib/algolia/models/search/search_params.rb +96 -0
- data/lib/algolia/models/search/search_params_object.rb +1103 -0
- data/lib/algolia/models/search/search_params_query.rb +193 -0
- data/lib/algolia/models/search/search_params_string.rb +193 -0
- data/lib/algolia/models/search/search_query.rb +96 -0
- data/lib/algolia/models/search/search_response.rb +560 -0
- data/lib/algolia/models/search/search_responses.rb +196 -0
- data/lib/algolia/models/search/search_result.rb +96 -0
- data/lib/algolia/models/search/search_rules_params.rb +311 -0
- data/lib/algolia/models/search/search_rules_response.rb +233 -0
- data/lib/algolia/models/search/search_strategy.rb +33 -0
- data/lib/algolia/models/search/search_synonyms_params.rb +193 -0
- data/lib/algolia/models/search/search_synonyms_response.rb +212 -0
- data/lib/algolia/models/search/search_type_default.rb +32 -0
- data/lib/algolia/models/search/search_type_facet.rb +32 -0
- data/lib/algolia/models/search/search_user_ids_params.rb +244 -0
- data/lib/algolia/models/search/search_user_ids_response.rb +264 -0
- data/lib/algolia/models/search/semantic_search.rb +198 -0
- data/lib/algolia/models/search/snippet_result.rb +96 -0
- data/lib/algolia/models/search/snippet_result_option.rb +229 -0
- data/lib/algolia/models/search/sort_remaining_by.rb +34 -0
- data/lib/algolia/models/search/source.rb +206 -0
- data/lib/algolia/models/search/standard_entries.rb +224 -0
- data/lib/algolia/models/search/synonym_hit.rb +295 -0
- data/lib/algolia/models/search/synonym_type.rb +36 -0
- data/lib/algolia/models/search/tag_filters.rb +97 -0
- data/lib/algolia/models/search/task_status.rb +33 -0
- data/lib/algolia/models/search/time_range.rb +207 -0
- data/lib/algolia/models/search/typo_tolerance.rb +97 -0
- data/lib/algolia/models/search/typo_tolerance_enum.rb +33 -0
- data/lib/algolia/models/search/update_api_key_response.rb +207 -0
- data/lib/algolia/models/search/updated_at_response.rb +208 -0
- data/lib/algolia/models/search/updated_at_with_object_id_response.rb +214 -0
- data/lib/algolia/models/search/updated_rule_response.rb +219 -0
- data/lib/algolia/models/search/user_highlight_result.rb +205 -0
- data/lib/algolia/models/search/user_hit.rb +269 -0
- data/lib/algolia/models/search/user_id.rb +247 -0
- data/lib/algolia/models/search/value.rb +226 -0
- data/lib/algolia/transport/echo_requester.rb +10 -0
- data/lib/algolia/{http → transport/http}/http_requester.rb +24 -19
- data/lib/algolia/{http → transport/http}/response.rb +11 -1
- data/lib/algolia/transport/request_options.rb +19 -31
- data/lib/algolia/transport/retry_strategy.rb +5 -8
- data/lib/algolia/transport/stateful_host.rb +1 -2
- data/lib/algolia/transport/transport.rb +33 -73
- data/lib/algolia/user_agent.rb +4 -14
- data/lib/algolia/version.rb +3 -1
- data/lib/algolia.rb +23 -40
- metadata +523 -218
- data/.circleci/config.yml +0 -155
- data/.dockerignore +0 -38
- data/.github/ISSUE_TEMPLATE.md +0 -20
- data/.github/PULL_REQUEST_TEMPLATE.md +0 -22
- data/.gitignore +0 -40
- data/.rubocop.yml +0 -189
- data/.rubocop_todo.yml +0 -14
- data/CODE_OF_CONDUCT.md +0 -74
- data/CONTRIBUTING.MD +0 -184
- data/DOCKER_README.MD +0 -89
- data/Dockerfile +0 -7
- data/LICENSE +0 -21
- data/SECURITY.md +0 -3
- data/Steepfile +0 -6
- data/bin/console +0 -21
- data/bin/setup +0 -8
- data/lib/algolia/account_client.rb +0 -65
- data/lib/algolia/analytics_client.rb +0 -105
- data/lib/algolia/config/analytics_config.rb +0 -20
- data/lib/algolia/config/base_config.rb +0 -43
- data/lib/algolia/config/insights_config.rb +0 -20
- data/lib/algolia/config/personalization_config.rb +0 -20
- data/lib/algolia/config/recommend_config.rb +0 -6
- data/lib/algolia/config/recommendation_config.rb +0 -7
- data/lib/algolia/config/search_config.rb +0 -40
- data/lib/algolia/defaults.rb +0 -35
- data/lib/algolia/helpers.rb +0 -134
- data/lib/algolia/insights_client.rb +0 -238
- data/lib/algolia/iterators/base_iterator.rb +0 -19
- data/lib/algolia/iterators/object_iterator.rb +0 -28
- data/lib/algolia/iterators/paginator_iterator.rb +0 -46
- data/lib/algolia/iterators/rule_iterator.rb +0 -9
- data/lib/algolia/iterators/synonym_iterator.rb +0 -9
- data/lib/algolia/personalization_client.rb +0 -60
- data/lib/algolia/recommend_client.rb +0 -134
- data/lib/algolia/recommendation_client.rb +0 -7
- data/lib/algolia/responses/add_api_key_response.rb +0 -38
- data/lib/algolia/responses/base_response.rb +0 -9
- data/lib/algolia/responses/delete_api_key_response.rb +0 -40
- data/lib/algolia/responses/dictionary_response.rb +0 -33
- data/lib/algolia/responses/indexing_response.rb +0 -28
- data/lib/algolia/responses/multiple_batch_indexing_response.rb +0 -29
- data/lib/algolia/responses/multiple_response.rb +0 -45
- data/lib/algolia/responses/restore_api_key_response.rb +0 -36
- data/lib/algolia/responses/update_api_key_response.rb +0 -39
- data/lib/algolia/search_client.rb +0 -791
- data/lib/algolia/search_index.rb +0 -1059
- data/renovate.json +0 -5
- data/sig/config/algolia_config.rbs +0 -24
- data/sig/config/analytics_config.rbs +0 -11
- data/sig/config/insights_config.rbs +0 -11
- data/sig/config/recommendation_config.rbs +0 -11
- data/sig/config/search_config.rbs +0 -11
- data/sig/enums/call_type.rbs +0 -5
- data/sig/helpers.rbs +0 -12
- data/sig/http/http_requester.rbs +0 -17
- data/sig/http/response.rbs +0 -14
- data/sig/interfaces/_connection.rbs +0 -16
- data/sig/iterators/base_iterator.rbs +0 -15
- data/sig/iterators/object_iterator.rbs +0 -6
- data/sig/iterators/paginator_iterator.rbs +0 -8
- data/sig/iterators/rule_iterator.rbs +0 -5
- data/sig/iterators/synonym_iterator.rbs +0 -5
- data/sig/transport/request_options.rbs +0 -33
- data/sig/transport/stateful_host.rbs +0 -21
- data/test/algolia/integration/account_client_test.rb +0 -47
- data/test/algolia/integration/analytics_client_test.rb +0 -117
- data/test/algolia/integration/base_test.rb +0 -9
- data/test/algolia/integration/insights_client_test.rb +0 -80
- data/test/algolia/integration/mocks/mock_requester.rb +0 -47
- data/test/algolia/integration/personalization_client_test.rb +0 -30
- data/test/algolia/integration/recommend_client_test.rb +0 -70
- data/test/algolia/integration/recommendation_client_test.rb +0 -30
- data/test/algolia/integration/search_client_test.rb +0 -465
- data/test/algolia/integration/search_index_test.rb +0 -729
- data/test/algolia/unit/algolia_config_test.rb +0 -16
- data/test/algolia/unit/helpers_test.rb +0 -88
- data/test/algolia/unit/http_requester_test.rb +0 -27
- data/test/algolia/unit/retry_strategy_test.rb +0 -139
- data/test/algolia/unit/user_agent_test.rb +0 -16
- data/test/test_helper.rb +0 -121
- data/upgrade_guide.md +0 -603
- /data/lib/algolia/{enums → transport}/call_type.rb +0 -0
- /data/lib/algolia/{enums → transport}/retry_outcome_type.rb +0 -0
@@ -0,0 +1,350 @@
|
|
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 Insights
|
8
|
+
class ConvertedFilters
|
9
|
+
# Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework.
|
10
|
+
attr_accessor :event_name
|
11
|
+
|
12
|
+
attr_accessor :event_type
|
13
|
+
|
14
|
+
# Name of the Algolia index.
|
15
|
+
attr_accessor :index
|
16
|
+
|
17
|
+
# Facet filters. Each facet filter string must be URL-encoded, such as, `discount:10%25`.
|
18
|
+
attr_accessor :filters
|
19
|
+
|
20
|
+
# Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens.
|
21
|
+
attr_accessor :user_token
|
22
|
+
|
23
|
+
# Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp.
|
24
|
+
attr_accessor :timestamp
|
25
|
+
|
26
|
+
# User token for authenticated users.
|
27
|
+
attr_accessor :authenticated_user_token
|
28
|
+
|
29
|
+
class EnumAttributeValidator
|
30
|
+
attr_reader :datatype
|
31
|
+
attr_reader :allowable_values
|
32
|
+
|
33
|
+
def initialize(datatype, allowable_values)
|
34
|
+
@allowable_values = allowable_values.map do |value|
|
35
|
+
case datatype.to_s
|
36
|
+
when /Integer/i
|
37
|
+
value.to_i
|
38
|
+
when /Float/i
|
39
|
+
value.to_f
|
40
|
+
else
|
41
|
+
value
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def valid?(value)
|
47
|
+
!value || allowable_values.include?(value)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
52
|
+
def self.attribute_map
|
53
|
+
{
|
54
|
+
:event_name => :eventName,
|
55
|
+
:event_type => :eventType,
|
56
|
+
:index => :index,
|
57
|
+
:filters => :filters,
|
58
|
+
:user_token => :userToken,
|
59
|
+
:timestamp => :timestamp,
|
60
|
+
:authenticated_user_token => :authenticatedUserToken
|
61
|
+
}
|
62
|
+
end
|
63
|
+
|
64
|
+
# Returns all the JSON keys this model knows about
|
65
|
+
def self.acceptable_attributes
|
66
|
+
attribute_map.values
|
67
|
+
end
|
68
|
+
|
69
|
+
# Attribute type mapping.
|
70
|
+
def self.types_mapping
|
71
|
+
{
|
72
|
+
:event_name => :String,
|
73
|
+
:event_type => :ConversionEvent,
|
74
|
+
:index => :String,
|
75
|
+
:filters => :'Array<String>',
|
76
|
+
:user_token => :String,
|
77
|
+
:timestamp => :Integer,
|
78
|
+
:authenticated_user_token => :String
|
79
|
+
}
|
80
|
+
end
|
81
|
+
|
82
|
+
# List of attributes with nullable: true
|
83
|
+
def self.openapi_nullable
|
84
|
+
Set.new([])
|
85
|
+
end
|
86
|
+
|
87
|
+
# Initializes the object
|
88
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
89
|
+
def initialize(attributes = {})
|
90
|
+
unless attributes.is_a?(Hash)
|
91
|
+
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::ConvertedFilters` initialize method"
|
92
|
+
end
|
93
|
+
|
94
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
95
|
+
attributes = attributes.each_with_object({}) do |(k, v), h|
|
96
|
+
unless self.class.attribute_map.key?(k.to_sym)
|
97
|
+
raise ArgumentError,
|
98
|
+
"`#{k}` is not a valid attribute in `Algolia::ConvertedFilters`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
99
|
+
end
|
100
|
+
|
101
|
+
h[k.to_sym] = v
|
102
|
+
end
|
103
|
+
|
104
|
+
if attributes.key?(:event_name)
|
105
|
+
self.event_name = attributes[:event_name]
|
106
|
+
else
|
107
|
+
self.event_name = nil
|
108
|
+
end
|
109
|
+
|
110
|
+
if attributes.key?(:event_type)
|
111
|
+
self.event_type = attributes[:event_type]
|
112
|
+
else
|
113
|
+
self.event_type = nil
|
114
|
+
end
|
115
|
+
|
116
|
+
if attributes.key?(:index)
|
117
|
+
self.index = attributes[:index]
|
118
|
+
else
|
119
|
+
self.index = nil
|
120
|
+
end
|
121
|
+
|
122
|
+
if attributes.key?(:filters)
|
123
|
+
if (value = attributes[:filters]).is_a?(Array)
|
124
|
+
self.filters = value
|
125
|
+
end
|
126
|
+
else
|
127
|
+
self.filters = nil
|
128
|
+
end
|
129
|
+
|
130
|
+
if attributes.key?(:user_token)
|
131
|
+
self.user_token = attributes[:user_token]
|
132
|
+
else
|
133
|
+
self.user_token = nil
|
134
|
+
end
|
135
|
+
|
136
|
+
if attributes.key?(:timestamp)
|
137
|
+
self.timestamp = attributes[:timestamp]
|
138
|
+
end
|
139
|
+
|
140
|
+
if attributes.key?(:authenticated_user_token)
|
141
|
+
self.authenticated_user_token = attributes[:authenticated_user_token]
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
# Custom attribute writer method with validation
|
146
|
+
# @param [Object] event_name Value to be assigned
|
147
|
+
def event_name=(event_name)
|
148
|
+
if event_name.nil?
|
149
|
+
raise ArgumentError, 'event_name cannot be nil'
|
150
|
+
end
|
151
|
+
|
152
|
+
if event_name.to_s.length > 64
|
153
|
+
raise ArgumentError, 'invalid value for "event_name", the character length must be smaller than or equal to 64.'
|
154
|
+
end
|
155
|
+
|
156
|
+
if event_name.to_s.length < 1
|
157
|
+
raise ArgumentError, 'invalid value for "event_name", the character length must be great than or equal to 1.'
|
158
|
+
end
|
159
|
+
|
160
|
+
pattern = /[\x20-\x7E]{1,64}/
|
161
|
+
if event_name !~ pattern
|
162
|
+
raise ArgumentError, "invalid value for \"event_name\", must conform to the pattern #{pattern}."
|
163
|
+
end
|
164
|
+
|
165
|
+
@event_name = event_name
|
166
|
+
end
|
167
|
+
|
168
|
+
# Custom attribute writer method with validation
|
169
|
+
# @param [Object] filters Value to be assigned
|
170
|
+
def filters=(filters)
|
171
|
+
if filters.nil?
|
172
|
+
raise ArgumentError, 'filters cannot be nil'
|
173
|
+
end
|
174
|
+
|
175
|
+
if filters.length > 20
|
176
|
+
raise ArgumentError, 'invalid value for "filters", number of items must be less than or equal to 20.'
|
177
|
+
end
|
178
|
+
|
179
|
+
if filters.length < 1
|
180
|
+
raise ArgumentError, 'invalid value for "filters", number of items must be greater than or equal to 1.'
|
181
|
+
end
|
182
|
+
|
183
|
+
@filters = filters
|
184
|
+
end
|
185
|
+
|
186
|
+
# Custom attribute writer method with validation
|
187
|
+
# @param [Object] user_token Value to be assigned
|
188
|
+
def user_token=(user_token)
|
189
|
+
if user_token.nil?
|
190
|
+
raise ArgumentError, 'user_token cannot be nil'
|
191
|
+
end
|
192
|
+
|
193
|
+
if user_token.to_s.length > 129
|
194
|
+
raise ArgumentError, 'invalid value for "user_token", the character length must be smaller than or equal to 129.'
|
195
|
+
end
|
196
|
+
|
197
|
+
if user_token.to_s.length < 1
|
198
|
+
raise ArgumentError, 'invalid value for "user_token", the character length must be great than or equal to 1.'
|
199
|
+
end
|
200
|
+
|
201
|
+
pattern = %r{[a-zA-Z0-9_=/+-]{1,129}}
|
202
|
+
if user_token !~ pattern
|
203
|
+
raise ArgumentError, "invalid value for \"user_token\", must conform to the pattern #{pattern}."
|
204
|
+
end
|
205
|
+
|
206
|
+
@user_token = user_token
|
207
|
+
end
|
208
|
+
|
209
|
+
# Checks equality by comparing each attribute.
|
210
|
+
# @param [Object] Object to be compared
|
211
|
+
def ==(other)
|
212
|
+
return true if equal?(other)
|
213
|
+
|
214
|
+
self.class == other.class &&
|
215
|
+
event_name == other.event_name &&
|
216
|
+
event_type == other.event_type &&
|
217
|
+
index == other.index &&
|
218
|
+
filters == other.filters &&
|
219
|
+
user_token == other.user_token &&
|
220
|
+
timestamp == other.timestamp &&
|
221
|
+
authenticated_user_token == other.authenticated_user_token
|
222
|
+
end
|
223
|
+
|
224
|
+
# @see the `==` method
|
225
|
+
# @param [Object] Object to be compared
|
226
|
+
def eql?(other)
|
227
|
+
self == other
|
228
|
+
end
|
229
|
+
|
230
|
+
# Calculates hash code according to all attributes.
|
231
|
+
# @return [Integer] Hash code
|
232
|
+
def hash
|
233
|
+
[event_name, event_type, index, filters, user_token, timestamp, authenticated_user_token].hash
|
234
|
+
end
|
235
|
+
|
236
|
+
# Builds the object from hash
|
237
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
238
|
+
# @return [Object] Returns the model itself
|
239
|
+
def self.build_from_hash(attributes)
|
240
|
+
return nil unless attributes.is_a?(Hash)
|
241
|
+
|
242
|
+
attributes = attributes.transform_keys(&:to_sym)
|
243
|
+
transformed_hash = {}
|
244
|
+
types_mapping.each_pair do |key, type|
|
245
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
246
|
+
transformed_hash[key.to_s] = nil
|
247
|
+
elsif type =~ /\AArray<(.*)>/i
|
248
|
+
# check to ensure the input is an array given that the attribute
|
249
|
+
# is documented as an array but the input is not
|
250
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
251
|
+
transformed_hash[key.to_s] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }
|
252
|
+
end
|
253
|
+
elsif !attributes[attribute_map[key]].nil?
|
254
|
+
transformed_hash[key.to_s] = _deserialize(type, attributes[attribute_map[key]])
|
255
|
+
end
|
256
|
+
end
|
257
|
+
new(transformed_hash)
|
258
|
+
end
|
259
|
+
|
260
|
+
# Deserializes the data based on type
|
261
|
+
# @param string type Data type
|
262
|
+
# @param string value Value to be deserialized
|
263
|
+
# @return [Object] Deserialized data
|
264
|
+
def self._deserialize(type, value)
|
265
|
+
case type.to_sym
|
266
|
+
when :Time
|
267
|
+
Time.parse(value)
|
268
|
+
when :Date
|
269
|
+
Date.parse(value)
|
270
|
+
when :String
|
271
|
+
value.to_s
|
272
|
+
when :Integer
|
273
|
+
value.to_i
|
274
|
+
when :Float
|
275
|
+
value.to_f
|
276
|
+
when :Boolean
|
277
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
278
|
+
true
|
279
|
+
else
|
280
|
+
false
|
281
|
+
end
|
282
|
+
when :Object
|
283
|
+
# generic object (usually a Hash), return directly
|
284
|
+
value
|
285
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
286
|
+
inner_type = Regexp.last_match[:inner_type]
|
287
|
+
value.map { |v| _deserialize(inner_type, v) }
|
288
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
289
|
+
k_type = Regexp.last_match[:k_type]
|
290
|
+
v_type = Regexp.last_match[:v_type]
|
291
|
+
{}.tap do |hash|
|
292
|
+
value.each do |k, v|
|
293
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
294
|
+
end
|
295
|
+
end
|
296
|
+
else # model
|
297
|
+
# models (e.g. Pet) or oneOf
|
298
|
+
klass = Algolia::Insights.const_get(type)
|
299
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
300
|
+
end
|
301
|
+
end
|
302
|
+
|
303
|
+
# Returns the string representation of the object
|
304
|
+
# @return [String] String presentation of the object
|
305
|
+
def to_s
|
306
|
+
to_hash.to_s
|
307
|
+
end
|
308
|
+
|
309
|
+
# to_body is an alias to to_hash (backward compatibility)
|
310
|
+
# @return [Hash] Returns the object in the form of hash
|
311
|
+
def to_body
|
312
|
+
to_hash
|
313
|
+
end
|
314
|
+
|
315
|
+
# Returns the object in the form of hash
|
316
|
+
# @return [Hash] Returns the object in the form of hash
|
317
|
+
def to_hash
|
318
|
+
hash = {}
|
319
|
+
self.class.attribute_map.each_pair do |attr, param|
|
320
|
+
value = send(attr)
|
321
|
+
if value.nil?
|
322
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
323
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
324
|
+
end
|
325
|
+
|
326
|
+
hash[param] = _to_hash(value)
|
327
|
+
end
|
328
|
+
hash
|
329
|
+
end
|
330
|
+
|
331
|
+
# Outputs non-array value in the form of hash
|
332
|
+
# For object, use to_hash. Otherwise, just return the value
|
333
|
+
# @param [Object] value Any valid value
|
334
|
+
# @return [Hash] Returns the value in the form of hash
|
335
|
+
def _to_hash(value)
|
336
|
+
if value.is_a?(Array)
|
337
|
+
value.compact.map { |v| _to_hash(v) }
|
338
|
+
elsif value.is_a?(Hash)
|
339
|
+
{}.tap do |hash|
|
340
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
341
|
+
end
|
342
|
+
elsif value.respond_to? :to_hash
|
343
|
+
value.to_hash
|
344
|
+
else
|
345
|
+
value
|
346
|
+
end
|
347
|
+
end
|
348
|
+
end
|
349
|
+
end
|
350
|
+
end
|
@@ -0,0 +1,351 @@
|
|
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 Insights
|
8
|
+
# Use this event to track when users convert on items unrelated to a previous Algolia request. For example, if you don't use Algolia to build your category pages, use this event. To track conversion events related to Algolia requests, use the \"Converted object IDs after search\" event.
|
9
|
+
class ConvertedObjectIDs
|
10
|
+
# Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework.
|
11
|
+
attr_accessor :event_name
|
12
|
+
|
13
|
+
attr_accessor :event_type
|
14
|
+
|
15
|
+
# Name of the Algolia index.
|
16
|
+
attr_accessor :index
|
17
|
+
|
18
|
+
# List of object identifiers for items of an Algolia index.
|
19
|
+
attr_accessor :object_ids
|
20
|
+
|
21
|
+
# Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens.
|
22
|
+
attr_accessor :user_token
|
23
|
+
|
24
|
+
# Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp.
|
25
|
+
attr_accessor :timestamp
|
26
|
+
|
27
|
+
# User token for authenticated users.
|
28
|
+
attr_accessor :authenticated_user_token
|
29
|
+
|
30
|
+
class EnumAttributeValidator
|
31
|
+
attr_reader :datatype
|
32
|
+
attr_reader :allowable_values
|
33
|
+
|
34
|
+
def initialize(datatype, allowable_values)
|
35
|
+
@allowable_values = allowable_values.map do |value|
|
36
|
+
case datatype.to_s
|
37
|
+
when /Integer/i
|
38
|
+
value.to_i
|
39
|
+
when /Float/i
|
40
|
+
value.to_f
|
41
|
+
else
|
42
|
+
value
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def valid?(value)
|
48
|
+
!value || allowable_values.include?(value)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
53
|
+
def self.attribute_map
|
54
|
+
{
|
55
|
+
:event_name => :eventName,
|
56
|
+
:event_type => :eventType,
|
57
|
+
:index => :index,
|
58
|
+
:object_ids => :objectIDs,
|
59
|
+
:user_token => :userToken,
|
60
|
+
:timestamp => :timestamp,
|
61
|
+
:authenticated_user_token => :authenticatedUserToken
|
62
|
+
}
|
63
|
+
end
|
64
|
+
|
65
|
+
# Returns all the JSON keys this model knows about
|
66
|
+
def self.acceptable_attributes
|
67
|
+
attribute_map.values
|
68
|
+
end
|
69
|
+
|
70
|
+
# Attribute type mapping.
|
71
|
+
def self.types_mapping
|
72
|
+
{
|
73
|
+
:event_name => :String,
|
74
|
+
:event_type => :ConversionEvent,
|
75
|
+
:index => :String,
|
76
|
+
:object_ids => :'Array<String>',
|
77
|
+
:user_token => :String,
|
78
|
+
:timestamp => :Integer,
|
79
|
+
:authenticated_user_token => :String
|
80
|
+
}
|
81
|
+
end
|
82
|
+
|
83
|
+
# List of attributes with nullable: true
|
84
|
+
def self.openapi_nullable
|
85
|
+
Set.new([])
|
86
|
+
end
|
87
|
+
|
88
|
+
# Initializes the object
|
89
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
90
|
+
def initialize(attributes = {})
|
91
|
+
unless attributes.is_a?(Hash)
|
92
|
+
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::ConvertedObjectIDs` initialize method"
|
93
|
+
end
|
94
|
+
|
95
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
96
|
+
attributes = attributes.each_with_object({}) do |(k, v), h|
|
97
|
+
unless self.class.attribute_map.key?(k.to_sym)
|
98
|
+
raise ArgumentError,
|
99
|
+
"`#{k}` is not a valid attribute in `Algolia::ConvertedObjectIDs`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
100
|
+
end
|
101
|
+
|
102
|
+
h[k.to_sym] = v
|
103
|
+
end
|
104
|
+
|
105
|
+
if attributes.key?(:event_name)
|
106
|
+
self.event_name = attributes[:event_name]
|
107
|
+
else
|
108
|
+
self.event_name = nil
|
109
|
+
end
|
110
|
+
|
111
|
+
if attributes.key?(:event_type)
|
112
|
+
self.event_type = attributes[:event_type]
|
113
|
+
else
|
114
|
+
self.event_type = nil
|
115
|
+
end
|
116
|
+
|
117
|
+
if attributes.key?(:index)
|
118
|
+
self.index = attributes[:index]
|
119
|
+
else
|
120
|
+
self.index = nil
|
121
|
+
end
|
122
|
+
|
123
|
+
if attributes.key?(:object_ids)
|
124
|
+
if (value = attributes[:object_ids]).is_a?(Array)
|
125
|
+
self.object_ids = value
|
126
|
+
end
|
127
|
+
else
|
128
|
+
self.object_ids = nil
|
129
|
+
end
|
130
|
+
|
131
|
+
if attributes.key?(:user_token)
|
132
|
+
self.user_token = attributes[:user_token]
|
133
|
+
else
|
134
|
+
self.user_token = nil
|
135
|
+
end
|
136
|
+
|
137
|
+
if attributes.key?(:timestamp)
|
138
|
+
self.timestamp = attributes[:timestamp]
|
139
|
+
end
|
140
|
+
|
141
|
+
if attributes.key?(:authenticated_user_token)
|
142
|
+
self.authenticated_user_token = attributes[:authenticated_user_token]
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
# Custom attribute writer method with validation
|
147
|
+
# @param [Object] event_name Value to be assigned
|
148
|
+
def event_name=(event_name)
|
149
|
+
if event_name.nil?
|
150
|
+
raise ArgumentError, 'event_name cannot be nil'
|
151
|
+
end
|
152
|
+
|
153
|
+
if event_name.to_s.length > 64
|
154
|
+
raise ArgumentError, 'invalid value for "event_name", the character length must be smaller than or equal to 64.'
|
155
|
+
end
|
156
|
+
|
157
|
+
if event_name.to_s.length < 1
|
158
|
+
raise ArgumentError, 'invalid value for "event_name", the character length must be great than or equal to 1.'
|
159
|
+
end
|
160
|
+
|
161
|
+
pattern = /[\x20-\x7E]{1,64}/
|
162
|
+
if event_name !~ pattern
|
163
|
+
raise ArgumentError, "invalid value for \"event_name\", must conform to the pattern #{pattern}."
|
164
|
+
end
|
165
|
+
|
166
|
+
@event_name = event_name
|
167
|
+
end
|
168
|
+
|
169
|
+
# Custom attribute writer method with validation
|
170
|
+
# @param [Object] object_ids Value to be assigned
|
171
|
+
def object_ids=(object_ids)
|
172
|
+
if object_ids.nil?
|
173
|
+
raise ArgumentError, 'object_ids cannot be nil'
|
174
|
+
end
|
175
|
+
|
176
|
+
if object_ids.length > 20
|
177
|
+
raise ArgumentError, 'invalid value for "object_ids", number of items must be less than or equal to 20.'
|
178
|
+
end
|
179
|
+
|
180
|
+
if object_ids.length < 1
|
181
|
+
raise ArgumentError, 'invalid value for "object_ids", number of items must be greater than or equal to 1.'
|
182
|
+
end
|
183
|
+
|
184
|
+
@object_ids = object_ids
|
185
|
+
end
|
186
|
+
|
187
|
+
# Custom attribute writer method with validation
|
188
|
+
# @param [Object] user_token Value to be assigned
|
189
|
+
def user_token=(user_token)
|
190
|
+
if user_token.nil?
|
191
|
+
raise ArgumentError, 'user_token cannot be nil'
|
192
|
+
end
|
193
|
+
|
194
|
+
if user_token.to_s.length > 129
|
195
|
+
raise ArgumentError, 'invalid value for "user_token", the character length must be smaller than or equal to 129.'
|
196
|
+
end
|
197
|
+
|
198
|
+
if user_token.to_s.length < 1
|
199
|
+
raise ArgumentError, 'invalid value for "user_token", the character length must be great than or equal to 1.'
|
200
|
+
end
|
201
|
+
|
202
|
+
pattern = %r{[a-zA-Z0-9_=/+-]{1,129}}
|
203
|
+
if user_token !~ pattern
|
204
|
+
raise ArgumentError, "invalid value for \"user_token\", must conform to the pattern #{pattern}."
|
205
|
+
end
|
206
|
+
|
207
|
+
@user_token = user_token
|
208
|
+
end
|
209
|
+
|
210
|
+
# Checks equality by comparing each attribute.
|
211
|
+
# @param [Object] Object to be compared
|
212
|
+
def ==(other)
|
213
|
+
return true if equal?(other)
|
214
|
+
|
215
|
+
self.class == other.class &&
|
216
|
+
event_name == other.event_name &&
|
217
|
+
event_type == other.event_type &&
|
218
|
+
index == other.index &&
|
219
|
+
object_ids == other.object_ids &&
|
220
|
+
user_token == other.user_token &&
|
221
|
+
timestamp == other.timestamp &&
|
222
|
+
authenticated_user_token == other.authenticated_user_token
|
223
|
+
end
|
224
|
+
|
225
|
+
# @see the `==` method
|
226
|
+
# @param [Object] Object to be compared
|
227
|
+
def eql?(other)
|
228
|
+
self == other
|
229
|
+
end
|
230
|
+
|
231
|
+
# Calculates hash code according to all attributes.
|
232
|
+
# @return [Integer] Hash code
|
233
|
+
def hash
|
234
|
+
[event_name, event_type, index, object_ids, user_token, timestamp, authenticated_user_token].hash
|
235
|
+
end
|
236
|
+
|
237
|
+
# Builds the object from hash
|
238
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
239
|
+
# @return [Object] Returns the model itself
|
240
|
+
def self.build_from_hash(attributes)
|
241
|
+
return nil unless attributes.is_a?(Hash)
|
242
|
+
|
243
|
+
attributes = attributes.transform_keys(&:to_sym)
|
244
|
+
transformed_hash = {}
|
245
|
+
types_mapping.each_pair do |key, type|
|
246
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
247
|
+
transformed_hash[key.to_s] = nil
|
248
|
+
elsif type =~ /\AArray<(.*)>/i
|
249
|
+
# check to ensure the input is an array given that the attribute
|
250
|
+
# is documented as an array but the input is not
|
251
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
252
|
+
transformed_hash[key.to_s] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }
|
253
|
+
end
|
254
|
+
elsif !attributes[attribute_map[key]].nil?
|
255
|
+
transformed_hash[key.to_s] = _deserialize(type, attributes[attribute_map[key]])
|
256
|
+
end
|
257
|
+
end
|
258
|
+
new(transformed_hash)
|
259
|
+
end
|
260
|
+
|
261
|
+
# Deserializes the data based on type
|
262
|
+
# @param string type Data type
|
263
|
+
# @param string value Value to be deserialized
|
264
|
+
# @return [Object] Deserialized data
|
265
|
+
def self._deserialize(type, value)
|
266
|
+
case type.to_sym
|
267
|
+
when :Time
|
268
|
+
Time.parse(value)
|
269
|
+
when :Date
|
270
|
+
Date.parse(value)
|
271
|
+
when :String
|
272
|
+
value.to_s
|
273
|
+
when :Integer
|
274
|
+
value.to_i
|
275
|
+
when :Float
|
276
|
+
value.to_f
|
277
|
+
when :Boolean
|
278
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
279
|
+
true
|
280
|
+
else
|
281
|
+
false
|
282
|
+
end
|
283
|
+
when :Object
|
284
|
+
# generic object (usually a Hash), return directly
|
285
|
+
value
|
286
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
287
|
+
inner_type = Regexp.last_match[:inner_type]
|
288
|
+
value.map { |v| _deserialize(inner_type, v) }
|
289
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
290
|
+
k_type = Regexp.last_match[:k_type]
|
291
|
+
v_type = Regexp.last_match[:v_type]
|
292
|
+
{}.tap do |hash|
|
293
|
+
value.each do |k, v|
|
294
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
295
|
+
end
|
296
|
+
end
|
297
|
+
else # model
|
298
|
+
# models (e.g. Pet) or oneOf
|
299
|
+
klass = Algolia::Insights.const_get(type)
|
300
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
301
|
+
end
|
302
|
+
end
|
303
|
+
|
304
|
+
# Returns the string representation of the object
|
305
|
+
# @return [String] String presentation of the object
|
306
|
+
def to_s
|
307
|
+
to_hash.to_s
|
308
|
+
end
|
309
|
+
|
310
|
+
# to_body is an alias to to_hash (backward compatibility)
|
311
|
+
# @return [Hash] Returns the object in the form of hash
|
312
|
+
def to_body
|
313
|
+
to_hash
|
314
|
+
end
|
315
|
+
|
316
|
+
# Returns the object in the form of hash
|
317
|
+
# @return [Hash] Returns the object in the form of hash
|
318
|
+
def to_hash
|
319
|
+
hash = {}
|
320
|
+
self.class.attribute_map.each_pair do |attr, param|
|
321
|
+
value = send(attr)
|
322
|
+
if value.nil?
|
323
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
324
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
325
|
+
end
|
326
|
+
|
327
|
+
hash[param] = _to_hash(value)
|
328
|
+
end
|
329
|
+
hash
|
330
|
+
end
|
331
|
+
|
332
|
+
# Outputs non-array value in the form of hash
|
333
|
+
# For object, use to_hash. Otherwise, just return the value
|
334
|
+
# @param [Object] value Any valid value
|
335
|
+
# @return [Hash] Returns the value in the form of hash
|
336
|
+
def _to_hash(value)
|
337
|
+
if value.is_a?(Array)
|
338
|
+
value.compact.map { |v| _to_hash(v) }
|
339
|
+
elsif value.is_a?(Hash)
|
340
|
+
{}.tap do |hash|
|
341
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
342
|
+
end
|
343
|
+
elsif value.respond_to? :to_hash
|
344
|
+
value.to_hash
|
345
|
+
else
|
346
|
+
value
|
347
|
+
end
|
348
|
+
end
|
349
|
+
end
|
350
|
+
end
|
351
|
+
end
|