├── lib ├── algolia │ ├── transport │ │ ├── call_type.rb │ │ ├── retry_outcome_type.rb │ │ ├── echo_requester.rb │ │ ├── stateful_host.rb │ │ ├── http │ │ │ ├── response.rb │ │ │ └── http_requester.rb │ │ ├── request_options.rb │ │ └── retry_strategy.rb │ ├── defaults.rb │ ├── version.rb │ ├── user_agent.rb │ ├── logger_helper.rb │ ├── models │ │ ├── monitoring │ │ │ ├── type.rb │ │ │ ├── server_status.rb │ │ │ ├── period.rb │ │ │ ├── status.rb │ │ │ ├── metric.rb │ │ │ └── region.rb │ │ ├── insights │ │ │ ├── view_event.rb │ │ │ ├── click_event.rb │ │ │ ├── purchase_event.rb │ │ │ ├── add_to_cart_event.rb │ │ │ └── conversion_event.rb │ │ ├── ingestion │ │ │ ├── platform_none.rb │ │ │ ├── method_type.rb │ │ │ ├── order_keys.rb │ │ │ ├── schedule_trigger_type.rb │ │ │ ├── on_demand_trigger_type.rb │ │ │ ├── run_outcome.rb │ │ │ ├── streaming_trigger_type.rb │ │ │ ├── big_query_data_type.rb │ │ │ ├── entity_type.rb │ │ │ ├── mapping_format_schema.rb │ │ │ ├── destination_type.rb │ │ │ ├── subscription_trigger_type.rb │ │ │ ├── transformation_type.rb │ │ │ ├── record_type.rb │ │ │ ├── event_sort_keys.rb │ │ │ ├── docker_streams_sync_mode.rb │ │ │ ├── platform.rb │ │ │ ├── run_sort_keys.rb │ │ │ ├── event_type.rb │ │ │ ├── run_status.rb │ │ │ ├── transformation_sort_keys.rb │ │ │ ├── source_sort_keys.rb │ │ │ ├── run_type.rb │ │ │ ├── destination_sort_keys.rb │ │ │ ├── trigger_type.rb │ │ │ ├── mapping_type_csv.rb │ │ │ ├── action_type.rb │ │ │ ├── task_sort_keys.rb │ │ │ ├── authentication_sort_keys.rb │ │ │ ├── event_status.rb │ │ │ ├── authentication_type.rb │ │ │ ├── source_type.rb │ │ │ ├── run_reason_code.rb │ │ │ └── action.rb │ │ ├── search │ │ │ ├── around_radius_all.rb │ │ │ ├── search_type_facet.rb │ │ │ ├── search_type_default.rb │ │ │ ├── edit_type.rb │ │ │ ├── operation_type.rb │ │ │ ├── boolean_string.rb │ │ │ ├── mode.rb │ │ │ ├── task_status.rb │ │ │ ├── match_level.rb │ │ │ ├── dictionary_entry_type.rb │ │ │ ├── dictionary_action.rb │ │ │ ├── dictionary_entry_state.rb │ │ │ ├── scope_type.rb │ │ │ ├── api_key_operation.rb │ │ │ ├── search_strategy.rb │ │ │ ├── log_type.rb │ │ │ ├── sort_remaining_by.rb │ │ │ ├── dictionary_type.rb │ │ │ ├── event_type.rb │ │ │ ├── query_type.rb │ │ │ ├── advanced_syntax_features.rb │ │ │ ├── exact_on_single_word_query.rb │ │ │ ├── anchoring.rb │ │ │ ├── typo_tolerance_enum.rb │ │ │ ├── remove_words_if_no_results.rb │ │ │ ├── event_status.rb │ │ │ ├── alternatives_as_exact.rb │ │ │ ├── built_in_operation_type.rb │ │ │ ├── action.rb │ │ │ ├── synonym_type.rb │ │ │ ├── acl.rb │ │ │ ├── supported_language.rb │ │ │ ├── promote.rb │ │ │ ├── search_query.rb │ │ │ └── attribute_to_update.rb │ │ ├── recommend │ │ │ ├── around_radius_all.rb │ │ │ ├── fbt_model.rb │ │ │ ├── related_model.rb │ │ │ ├── boolean_string.rb │ │ │ ├── trending_items_model.rb │ │ │ ├── looking_similar_model.rb │ │ │ ├── trending_facets_model.rb │ │ │ ├── task_status.rb │ │ │ ├── match_level.rb │ │ │ ├── sort_remaining_by.rb │ │ │ ├── query_type.rb │ │ │ ├── advanced_syntax_features.rb │ │ │ ├── exact_on_single_word_query.rb │ │ │ ├── typo_tolerance_enum.rb │ │ │ ├── remove_words_if_no_results.rb │ │ │ ├── recommend_models.rb │ │ │ ├── alternatives_as_exact.rb │ │ │ └── supported_language.rb │ │ ├── composition │ │ │ ├── around_radius_all.rb │ │ │ ├── action.rb │ │ │ ├── boolean_string.rb │ │ │ ├── task_status.rb │ │ │ ├── match_level.rb │ │ │ ├── external_ordering.rb │ │ │ ├── dedup_positioning.rb │ │ │ ├── sort_remaining_by.rb │ │ │ ├── query_type.rb │ │ │ ├── advanced_syntax_features.rb │ │ │ ├── exact_on_single_word_query.rb │ │ │ ├── anchoring.rb │ │ │ ├── typo_tolerance_enum.rb │ │ │ ├── remove_words_if_no_results.rb │ │ │ ├── alternatives_as_exact.rb │ │ │ └── supported_language.rb │ │ ├── analytics │ │ │ ├── direction.rb │ │ │ ├── order_by.rb │ │ │ └── operator.rb │ │ ├── abtesting-v3 │ │ │ ├── direction.rb │ │ │ ├── status.rb │ │ │ ├── error_correction_type.rb │ │ │ ├── effect_metric.rb │ │ │ └── metric_name.rb │ │ ├── query-suggestions │ │ │ └── log_level.rb │ │ ├── personalization │ │ │ └── event_type.rb │ │ └── abtesting │ │ │ ├── status.rb │ │ │ └── effect_metric.rb │ ├── error.rb │ ├── api_error.rb │ └── configuration.rb └── algolia.rb ├── Gemfile ├── Rakefile ├── .github ├── workflows │ ├── release.yml │ ├── do-not-edit-this-repository.yml │ └── issue.yml └── ISSUE_TEMPLATE │ └── Bug_report.yml ├── .gitignore ├── Gemfile.lock ├── LICENSE ├── algolia.gemspec └── README.md /lib/algolia/transport/call_type.rb: -------------------------------------------------------------------------------- 1 | module CallType 2 | READ = 1 3 | WRITE = 2 4 | end 5 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | source 'https://rubygems.org' 4 | 5 | gemspec 6 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require 'bundler/gem_tasks' 2 | 3 | task(:default) { system 'rake --tasks' } 4 | 5 | -------------------------------------------------------------------------------- /lib/algolia/defaults.rb: -------------------------------------------------------------------------------- 1 | module Algolia 2 | module Defaults 3 | TTL = 300 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /lib/algolia/transport/retry_outcome_type.rb: -------------------------------------------------------------------------------- 1 | module RetryOutcomeType 2 | SUCCESS = "SUCCESS".freeze 3 | RETRY = "RETRY".freeze 4 | FAILURE = "FAILURE".freeze 5 | end 6 | -------------------------------------------------------------------------------- /lib/algolia/version.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | module Algolia 6 | VERSION = "3.34.1" 7 | end 8 | -------------------------------------------------------------------------------- /lib/algolia/user_agent.rb: -------------------------------------------------------------------------------- 1 | module Algolia 2 | class UserAgent 3 | attr_accessor :value 4 | 5 | def initialize 6 | @value = "Algolia for Ruby (#{VERSION}); Ruby (#{RUBY_VERSION})" 7 | end 8 | 9 | # Adds a segment to the UserAgent 10 | # 11 | def add(segment, version = nil) 12 | if version.nil? 13 | @value += format("; %s", segment: segment) 14 | else 15 | @value += format("; %s (%s)", segment: segment, version: version) 16 | end 17 | 18 | self 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /lib/algolia/transport/echo_requester.rb: -------------------------------------------------------------------------------- 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( 6 | host: host, 7 | status: 200, 8 | body: body, 9 | query_params: query_params, 10 | headers: headers, 11 | method: method, 12 | path: path, 13 | timeout: timeout, 14 | connect_timeout: connect_timeout 15 | ) 16 | end 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /lib/algolia/logger_helper.rb: -------------------------------------------------------------------------------- 1 | require "logger" 2 | 3 | module Algolia 4 | class LoggerHelper 5 | # @param debug_file [nil|String] file used to output the logs 6 | # 7 | def self.create(debug_file = nil) 8 | file = debug_file 9 | 10 | if file.nil? && ENV["ALGOLIA_DEBUG"] 11 | begin 12 | file = File.new("debug.log", "a+") 13 | rescue Errno::EACCES, Errno::ENOENT => e 14 | puts("Failed to open debug.log: #{e.message}. Falling back to $stderr.") 15 | end 16 | end 17 | 18 | instance = ::Logger.new(file || $stderr) 19 | instance.progname = "algolia" 20 | instance 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | 3 | # This file is registered in https://rubygems.org/gems/algolia/trusted_publishers to be able to publish new versions of the gem. 4 | 5 | on: 6 | push: 7 | branches: 8 | - main 9 | 10 | jobs: 11 | release: 12 | name: Publish 13 | runs-on: ubuntu-22.04 14 | if: "startsWith(github.event.head_commit.message, 'chore: release')" 15 | permissions: 16 | id-token: write 17 | contents: write 18 | steps: 19 | - uses: actions/checkout@v6 20 | 21 | - name: Install Ruby 22 | uses: ruby/setup-ruby@v1 23 | with: 24 | ruby-version: 3.4.7 25 | bundler-cache: true 26 | 27 | - uses: rubygems/release-gem@1c162a739e8b4cb21a676e97b087e8268d8fc40b 28 | with: 29 | await-release: false 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by: https://openapi-generator.tech 2 | # 3 | 4 | *.gem 5 | *.rbc 6 | /.config 7 | /coverage/ 8 | /InstalledFiles 9 | /pkg/ 10 | /spec/reports/ 11 | /spec/examples.txt 12 | /test/tmp/ 13 | /test/version_tmp/ 14 | /tmp/ 15 | 16 | ## Specific to RubyMotion: 17 | .dat* 18 | .repl_history 19 | build/ 20 | 21 | ## Documentation cache and generated files: 22 | /.yardoc/ 23 | /_yardoc/ 24 | /doc/ 25 | /rdoc/ 26 | 27 | ## Environment normalization: 28 | /.bundle/ 29 | /vendor/bundle 30 | /lib/bundler/man/ 31 | 32 | # for a library or gem, you might want to ignore these files since the code is 33 | # intended to run in multiple environments; otherwise, check them in: 34 | # Gemfile.lock 35 | # .ruby-version 36 | # .ruby-gemset 37 | 38 | # unless supporting rvm < 1.11.0 or doing something fancy, ignore this: 39 | .rvmrc 40 | -------------------------------------------------------------------------------- /lib/algolia/transport/stateful_host.rb: -------------------------------------------------------------------------------- 1 | module Algolia 2 | module Transport 3 | class StatefulHost 4 | include CallType 5 | 6 | attr_reader :url, :protocol, :accept, :port 7 | attr_accessor :last_use, :retry_count, :up 8 | 9 | # @param url [String] host url 10 | # @option options [binary] :accept accept type flag 11 | # @option options [DateTime] :last_use last usage date 12 | # @option options [Integer] :retry_count number of retries 13 | # @option options [Boolean] :up host status 14 | # 15 | def initialize(url, opts = {}) 16 | @url = url 17 | @protocol = opts[:protocol] || "https://" 18 | @port = opts[:port] 19 | @accept = opts[:accept] || (READ | WRITE) 20 | @last_use = opts[:last_use] || Time.now.utc 21 | @retry_count = opts[:retry_count] || 0 22 | @up = opts.key?(:up) ? opts[:up] : true 23 | end 24 | end 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: . 3 | specs: 4 | algolia (3.34.1) 5 | base64 (>= 0.2.0, < 1) 6 | faraday (>= 1.0.1, < 3.0) 7 | faraday-net_http_persistent (>= 0.15, < 3) 8 | net-http-persistent 9 | 10 | GEM 11 | remote: https://rubygems.org/ 12 | specs: 13 | base64 (0.3.0) 14 | connection_pool (2.5.4) 15 | faraday (2.14.0) 16 | faraday-net_http (>= 2.0, < 3.5) 17 | json 18 | logger 19 | faraday-net_http (3.4.1) 20 | net-http (>= 0.5.0) 21 | faraday-net_http_persistent (2.3.1) 22 | faraday (~> 2.5) 23 | net-http-persistent (>= 4.0.4, < 5) 24 | json (2.15.0) 25 | logger (1.7.0) 26 | net-http (0.6.0) 27 | uri 28 | net-http-persistent (4.0.6) 29 | connection_pool (~> 2.2, >= 2.2.4) 30 | rake (13.3.0) 31 | uri (1.0.4) 32 | 33 | PLATFORMS 34 | aarch64-linux 35 | x86_64-linux 36 | 37 | DEPENDENCIES 38 | algolia! 39 | bundler (>= 2.4.10) 40 | rake 41 | 42 | BUNDLED WITH 43 | 2.4.10 44 | -------------------------------------------------------------------------------- /.github/workflows/do-not-edit-this-repository.yml: -------------------------------------------------------------------------------- 1 | name: Do not edit files in this repository 2 | 3 | on: 4 | pull_request_target: 5 | types: 6 | - opened 7 | - synchronize 8 | - reopened 9 | branches: 10 | - 'main' 11 | 12 | jobs: 13 | auto_close_pr: 14 | name: Close PR 15 | runs-on: ubuntu-latest 16 | steps: 17 | - uses: actions/checkout@v6 18 | 19 | - name: Close PR 20 | env: 21 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} 22 | PR_NUMBER: ${{ github.event.pull_request.number }} 23 | run: | 24 | gh pr close "${PR_NUMBER}" -d -c "Thanks for contributing to our API clients! Sorry to close your PR, but this repository is fully generated, you can port your changes to [the API Clients Automation repository](https://github.com/algolia/api-clients-automation). If you need some guidance, feel free to [open an issue](https://github.com/algolia/api-clients-automation/issues) or [read our contribution guide](https://api-clients-automation.netlify.app/docs/introduction)." 25 | -------------------------------------------------------------------------------- /lib/algolia/models/monitoring/type.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Monitoring 10 | class Type 11 | CLUSTER = "cluster".freeze 12 | 13 | def self.all_vars 14 | @all_vars ||= [CLUSTER].freeze 15 | end 16 | 17 | # Builds the enum from string 18 | # @param [String] The enum value in the form of the string 19 | # @return [String] The enum value 20 | def self.build_from_hash(value) 21 | new.build_from_hash(value) 22 | end 23 | 24 | # Builds the enum from string 25 | # @param [String] The enum value in the form of the string 26 | # @return [String] The enum value 27 | def build_from_hash(value) 28 | return value if Type.all_vars.include?(value) 29 | raise "Invalid ENUM value #{value} for class #Type" 30 | end 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /lib/algolia/models/insights/view_event.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Insights 10 | class ViewEvent 11 | VIEW = "view".freeze 12 | 13 | def self.all_vars 14 | @all_vars ||= [VIEW].freeze 15 | end 16 | 17 | # Builds the enum from string 18 | # @param [String] The enum value in the form of the string 19 | # @return [String] The enum value 20 | def self.build_from_hash(value) 21 | new.build_from_hash(value) 22 | end 23 | 24 | # Builds the enum from string 25 | # @param [String] The enum value in the form of the string 26 | # @return [String] The enum value 27 | def build_from_hash(value) 28 | return value if ViewEvent.all_vars.include?(value) 29 | raise "Invalid ENUM value #{value} for class #ViewEvent" 30 | end 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /lib/algolia/models/insights/click_event.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Insights 10 | class ClickEvent 11 | CLICK = "click".freeze 12 | 13 | def self.all_vars 14 | @all_vars ||= [CLICK].freeze 15 | end 16 | 17 | # Builds the enum from string 18 | # @param [String] The enum value in the form of the string 19 | # @return [String] The enum value 20 | def self.build_from_hash(value) 21 | new.build_from_hash(value) 22 | end 23 | 24 | # Builds the enum from string 25 | # @param [String] The enum value in the form of the string 26 | # @return [String] The enum value 27 | def build_from_hash(value) 28 | return value if ClickEvent.all_vars.include?(value) 29 | raise "Invalid ENUM value #{value} for class #ClickEvent" 30 | end 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /lib/algolia/models/ingestion/platform_none.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Ingestion 10 | class PlatformNone 11 | NONE = "none".freeze 12 | 13 | def self.all_vars 14 | @all_vars ||= [NONE].freeze 15 | end 16 | 17 | # Builds the enum from string 18 | # @param [String] The enum value in the form of the string 19 | # @return [String] The enum value 20 | def self.build_from_hash(value) 21 | new.build_from_hash(value) 22 | end 23 | 24 | # Builds the enum from string 25 | # @param [String] The enum value in the form of the string 26 | # @return [String] The enum value 27 | def build_from_hash(value) 28 | return value if PlatformNone.all_vars.include?(value) 29 | raise "Invalid ENUM value #{value} for class #PlatformNone" 30 | end 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /lib/algolia/models/search/around_radius_all.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Search 10 | class AroundRadiusAll 11 | ALL = "all".freeze 12 | 13 | def self.all_vars 14 | @all_vars ||= [ALL].freeze 15 | end 16 | 17 | # Builds the enum from string 18 | # @param [String] The enum value in the form of the string 19 | # @return [String] The enum value 20 | def self.build_from_hash(value) 21 | new.build_from_hash(value) 22 | end 23 | 24 | # Builds the enum from string 25 | # @param [String] The enum value in the form of the string 26 | # @return [String] The enum value 27 | def build_from_hash(value) 28 | return value if AroundRadiusAll.all_vars.include?(value) 29 | raise "Invalid ENUM value #{value} for class #AroundRadiusAll" 30 | end 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /lib/algolia/models/recommend/around_radius_all.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Recommend 10 | class AroundRadiusAll 11 | ALL = "all".freeze 12 | 13 | def self.all_vars 14 | @all_vars ||= [ALL].freeze 15 | end 16 | 17 | # Builds the enum from string 18 | # @param [String] The enum value in the form of the string 19 | # @return [String] The enum value 20 | def self.build_from_hash(value) 21 | new.build_from_hash(value) 22 | end 23 | 24 | # Builds the enum from string 25 | # @param [String] The enum value in the form of the string 26 | # @return [String] The enum value 27 | def build_from_hash(value) 28 | return value if AroundRadiusAll.all_vars.include?(value) 29 | raise "Invalid ENUM value #{value} for class #AroundRadiusAll" 30 | end 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /lib/algolia/models/search/search_type_facet.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Search 10 | class SearchTypeFacet 11 | FACET = "facet".freeze 12 | 13 | def self.all_vars 14 | @all_vars ||= [FACET].freeze 15 | end 16 | 17 | # Builds the enum from string 18 | # @param [String] The enum value in the form of the string 19 | # @return [String] The enum value 20 | def self.build_from_hash(value) 21 | new.build_from_hash(value) 22 | end 23 | 24 | # Builds the enum from string 25 | # @param [String] The enum value in the form of the string 26 | # @return [String] The enum value 27 | def build_from_hash(value) 28 | return value if SearchTypeFacet.all_vars.include?(value) 29 | raise "Invalid ENUM value #{value} for class #SearchTypeFacet" 30 | end 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /lib/algolia/models/composition/around_radius_all.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Composition 10 | class AroundRadiusAll 11 | ALL = "all".freeze 12 | 13 | def self.all_vars 14 | @all_vars ||= [ALL].freeze 15 | end 16 | 17 | # Builds the enum from string 18 | # @param [String] The enum value in the form of the string 19 | # @return [String] The enum value 20 | def self.build_from_hash(value) 21 | new.build_from_hash(value) 22 | end 23 | 24 | # Builds the enum from string 25 | # @param [String] The enum value in the form of the string 26 | # @return [String] The enum value 27 | def build_from_hash(value) 28 | return value if AroundRadiusAll.all_vars.include?(value) 29 | raise "Invalid ENUM value #{value} for class #AroundRadiusAll" 30 | end 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /lib/algolia/models/insights/purchase_event.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Insights 10 | class PurchaseEvent 11 | PURCHASE = "purchase".freeze 12 | 13 | def self.all_vars 14 | @all_vars ||= [PURCHASE].freeze 15 | end 16 | 17 | # Builds the enum from string 18 | # @param [String] The enum value in the form of the string 19 | # @return [String] The enum value 20 | def self.build_from_hash(value) 21 | new.build_from_hash(value) 22 | end 23 | 24 | # Builds the enum from string 25 | # @param [String] The enum value in the form of the string 26 | # @return [String] The enum value 27 | def build_from_hash(value) 28 | return value if PurchaseEvent.all_vars.include?(value) 29 | raise "Invalid ENUM value #{value} for class #PurchaseEvent" 30 | end 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /lib/algolia/models/recommend/fbt_model.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Recommend 10 | class FbtModel 11 | BOUGHT_TOGETHER = "bought-together".freeze 12 | 13 | def self.all_vars 14 | @all_vars ||= [BOUGHT_TOGETHER].freeze 15 | end 16 | 17 | # Builds the enum from string 18 | # @param [String] The enum value in the form of the string 19 | # @return [String] The enum value 20 | def self.build_from_hash(value) 21 | new.build_from_hash(value) 22 | end 23 | 24 | # Builds the enum from string 25 | # @param [String] The enum value in the form of the string 26 | # @return [String] The enum value 27 | def build_from_hash(value) 28 | return value if FbtModel.all_vars.include?(value) 29 | raise "Invalid ENUM value #{value} for class #FbtModel" 30 | end 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2013-Present Algolia 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /lib/algolia/models/analytics/direction.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Analytics 10 | class Direction 11 | ASC = "asc".freeze 12 | DESC = "desc".freeze 13 | 14 | def self.all_vars 15 | @all_vars ||= [ASC, DESC].freeze 16 | end 17 | 18 | # Builds the enum from string 19 | # @param [String] The enum value in the form of the string 20 | # @return [String] The enum value 21 | def self.build_from_hash(value) 22 | new.build_from_hash(value) 23 | end 24 | 25 | # Builds the enum from string 26 | # @param [String] The enum value in the form of the string 27 | # @return [String] The enum value 28 | def build_from_hash(value) 29 | return value if Direction.all_vars.include?(value) 30 | raise "Invalid ENUM value #{value} for class #Direction" 31 | end 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /lib/algolia/models/monitoring/server_status.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Monitoring 10 | class ServerStatus 11 | PRODUCTION = "PRODUCTION".freeze 12 | 13 | def self.all_vars 14 | @all_vars ||= [PRODUCTION].freeze 15 | end 16 | 17 | # Builds the enum from string 18 | # @param [String] The enum value in the form of the string 19 | # @return [String] The enum value 20 | def self.build_from_hash(value) 21 | new.build_from_hash(value) 22 | end 23 | 24 | # Builds the enum from string 25 | # @param [String] The enum value in the form of the string 26 | # @return [String] The enum value 27 | def build_from_hash(value) 28 | return value if ServerStatus.all_vars.include?(value) 29 | raise "Invalid ENUM value #{value} for class #ServerStatus" 30 | end 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /lib/algolia/models/abtesting-v3/direction.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module AbtestingV3 10 | class Direction 11 | ASC = "asc".freeze 12 | DESC = "desc".freeze 13 | 14 | def self.all_vars 15 | @all_vars ||= [ASC, DESC].freeze 16 | end 17 | 18 | # Builds the enum from string 19 | # @param [String] The enum value in the form of the string 20 | # @return [String] The enum value 21 | def self.build_from_hash(value) 22 | new.build_from_hash(value) 23 | end 24 | 25 | # Builds the enum from string 26 | # @param [String] The enum value in the form of the string 27 | # @return [String] The enum value 28 | def build_from_hash(value) 29 | return value if Direction.all_vars.include?(value) 30 | raise "Invalid ENUM value #{value} for class #Direction" 31 | end 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /lib/algolia/models/ingestion/method_type.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Ingestion 10 | class MethodType 11 | GET = "GET".freeze 12 | POST = "POST".freeze 13 | 14 | def self.all_vars 15 | @all_vars ||= [GET, POST].freeze 16 | end 17 | 18 | # Builds the enum from string 19 | # @param [String] The enum value in the form of the string 20 | # @return [String] The enum value 21 | def self.build_from_hash(value) 22 | new.build_from_hash(value) 23 | end 24 | 25 | # Builds the enum from string 26 | # @param [String] The enum value in the form of the string 27 | # @return [String] The enum value 28 | def build_from_hash(value) 29 | return value if MethodType.all_vars.include?(value) 30 | raise "Invalid ENUM value #{value} for class #MethodType" 31 | end 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /lib/algolia/models/ingestion/order_keys.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Ingestion 10 | class OrderKeys 11 | ASC = "asc".freeze 12 | DESC = "desc".freeze 13 | 14 | def self.all_vars 15 | @all_vars ||= [ASC, DESC].freeze 16 | end 17 | 18 | # Builds the enum from string 19 | # @param [String] The enum value in the form of the string 20 | # @return [String] The enum value 21 | def self.build_from_hash(value) 22 | new.build_from_hash(value) 23 | end 24 | 25 | # Builds the enum from string 26 | # @param [String] The enum value in the form of the string 27 | # @return [String] The enum value 28 | def build_from_hash(value) 29 | return value if OrderKeys.all_vars.include?(value) 30 | raise "Invalid ENUM value #{value} for class #OrderKeys" 31 | end 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /lib/algolia/models/insights/add_to_cart_event.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Insights 10 | class AddToCartEvent 11 | ADD_TO_CART = "addToCart".freeze 12 | 13 | def self.all_vars 14 | @all_vars ||= [ADD_TO_CART].freeze 15 | end 16 | 17 | # Builds the enum from string 18 | # @param [String] The enum value in the form of the string 19 | # @return [String] The enum value 20 | def self.build_from_hash(value) 21 | new.build_from_hash(value) 22 | end 23 | 24 | # Builds the enum from string 25 | # @param [String] The enum value in the form of the string 26 | # @return [String] The enum value 27 | def build_from_hash(value) 28 | return value if AddToCartEvent.all_vars.include?(value) 29 | raise "Invalid ENUM value #{value} for class #AddToCartEvent" 30 | end 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /lib/algolia/models/search/search_type_default.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Search 10 | class SearchTypeDefault 11 | DEFAULT = "default".freeze 12 | 13 | def self.all_vars 14 | @all_vars ||= [DEFAULT].freeze 15 | end 16 | 17 | # Builds the enum from string 18 | # @param [String] The enum value in the form of the string 19 | # @return [String] The enum value 20 | def self.build_from_hash(value) 21 | new.build_from_hash(value) 22 | end 23 | 24 | # Builds the enum from string 25 | # @param [String] The enum value in the form of the string 26 | # @return [String] The enum value 27 | def build_from_hash(value) 28 | return value if SearchTypeDefault.all_vars.include?(value) 29 | raise "Invalid ENUM value #{value} for class #SearchTypeDefault" 30 | end 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /lib/algolia/models/composition/action.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Composition 10 | class Action 11 | UPSERT = "upsert".freeze 12 | DELETE = "delete".freeze 13 | 14 | def self.all_vars 15 | @all_vars ||= [UPSERT, DELETE].freeze 16 | end 17 | 18 | # Builds the enum from string 19 | # @param [String] The enum value in the form of the string 20 | # @return [String] The enum value 21 | def self.build_from_hash(value) 22 | new.build_from_hash(value) 23 | end 24 | 25 | # Builds the enum from string 26 | # @param [String] The enum value in the form of the string 27 | # @return [String] The enum value 28 | def build_from_hash(value) 29 | return value if Action.all_vars.include?(value) 30 | raise "Invalid ENUM value #{value} for class #Action" 31 | end 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /lib/algolia/models/insights/conversion_event.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Insights 10 | class ConversionEvent 11 | CONVERSION = "conversion".freeze 12 | 13 | def self.all_vars 14 | @all_vars ||= [CONVERSION].freeze 15 | end 16 | 17 | # Builds the enum from string 18 | # @param [String] The enum value in the form of the string 19 | # @return [String] The enum value 20 | def self.build_from_hash(value) 21 | new.build_from_hash(value) 22 | end 23 | 24 | # Builds the enum from string 25 | # @param [String] The enum value in the form of the string 26 | # @return [String] The enum value 27 | def build_from_hash(value) 28 | return value if ConversionEvent.all_vars.include?(value) 29 | raise "Invalid ENUM value #{value} for class #ConversionEvent" 30 | end 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /lib/algolia/models/search/edit_type.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Search 10 | class EditType 11 | REMOVE = "remove".freeze 12 | REPLACE = "replace".freeze 13 | 14 | def self.all_vars 15 | @all_vars ||= [REMOVE, REPLACE].freeze 16 | end 17 | 18 | # Builds the enum from string 19 | # @param [String] The enum value in the form of the string 20 | # @return [String] The enum value 21 | def self.build_from_hash(value) 22 | new.build_from_hash(value) 23 | end 24 | 25 | # Builds the enum from string 26 | # @param [String] The enum value in the form of the string 27 | # @return [String] The enum value 28 | def build_from_hash(value) 29 | return value if EditType.all_vars.include?(value) 30 | raise "Invalid ENUM value #{value} for class #EditType" 31 | end 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /lib/algolia/models/recommend/related_model.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Recommend 10 | class RelatedModel 11 | RELATED_PRODUCTS = "related-products".freeze 12 | 13 | def self.all_vars 14 | @all_vars ||= [RELATED_PRODUCTS].freeze 15 | end 16 | 17 | # Builds the enum from string 18 | # @param [String] The enum value in the form of the string 19 | # @return [String] The enum value 20 | def self.build_from_hash(value) 21 | new.build_from_hash(value) 22 | end 23 | 24 | # Builds the enum from string 25 | # @param [String] The enum value in the form of the string 26 | # @return [String] The enum value 27 | def build_from_hash(value) 28 | return value if RelatedModel.all_vars.include?(value) 29 | raise "Invalid ENUM value #{value} for class #RelatedModel" 30 | end 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /lib/algolia/models/search/operation_type.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Search 10 | class OperationType 11 | MOVE = "move".freeze 12 | COPY = "copy".freeze 13 | 14 | def self.all_vars 15 | @all_vars ||= [MOVE, COPY].freeze 16 | end 17 | 18 | # Builds the enum from string 19 | # @param [String] The enum value in the form of the string 20 | # @return [String] The enum value 21 | def self.build_from_hash(value) 22 | new.build_from_hash(value) 23 | end 24 | 25 | # Builds the enum from string 26 | # @param [String] The enum value in the form of the string 27 | # @return [String] The enum value 28 | def build_from_hash(value) 29 | return value if OperationType.all_vars.include?(value) 30 | raise "Invalid ENUM value #{value} for class #OperationType" 31 | end 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /lib/algolia/models/ingestion/schedule_trigger_type.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Ingestion 10 | class ScheduleTriggerType 11 | SCHEDULE = "schedule".freeze 12 | 13 | def self.all_vars 14 | @all_vars ||= [SCHEDULE].freeze 15 | end 16 | 17 | # Builds the enum from string 18 | # @param [String] The enum value in the form of the string 19 | # @return [String] The enum value 20 | def self.build_from_hash(value) 21 | new.build_from_hash(value) 22 | end 23 | 24 | # Builds the enum from string 25 | # @param [String] The enum value in the form of the string 26 | # @return [String] The enum value 27 | def build_from_hash(value) 28 | return value if ScheduleTriggerType.all_vars.include?(value) 29 | raise "Invalid ENUM value #{value} for class #ScheduleTriggerType" 30 | end 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /lib/algolia/models/search/boolean_string.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Search 10 | class BooleanString 11 | TRUE = "true".freeze 12 | FALSE = "false".freeze 13 | 14 | def self.all_vars 15 | @all_vars ||= [TRUE, FALSE].freeze 16 | end 17 | 18 | # Builds the enum from string 19 | # @param [String] The enum value in the form of the string 20 | # @return [String] The enum value 21 | def self.build_from_hash(value) 22 | new.build_from_hash(value) 23 | end 24 | 25 | # Builds the enum from string 26 | # @param [String] The enum value in the form of the string 27 | # @return [String] The enum value 28 | def build_from_hash(value) 29 | return value if BooleanString.all_vars.include?(value) 30 | raise "Invalid ENUM value #{value} for class #BooleanString" 31 | end 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /lib/algolia/models/ingestion/on_demand_trigger_type.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Ingestion 10 | class OnDemandTriggerType 11 | ON_DEMAND = "onDemand".freeze 12 | 13 | def self.all_vars 14 | @all_vars ||= [ON_DEMAND].freeze 15 | end 16 | 17 | # Builds the enum from string 18 | # @param [String] The enum value in the form of the string 19 | # @return [String] The enum value 20 | def self.build_from_hash(value) 21 | new.build_from_hash(value) 22 | end 23 | 24 | # Builds the enum from string 25 | # @param [String] The enum value in the form of the string 26 | # @return [String] The enum value 27 | def build_from_hash(value) 28 | return value if OnDemandTriggerType.all_vars.include?(value) 29 | raise "Invalid ENUM value #{value} for class #OnDemandTriggerType" 30 | end 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /lib/algolia/models/recommend/boolean_string.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Recommend 10 | class BooleanString 11 | TRUE = "true".freeze 12 | FALSE = "false".freeze 13 | 14 | def self.all_vars 15 | @all_vars ||= [TRUE, FALSE].freeze 16 | end 17 | 18 | # Builds the enum from string 19 | # @param [String] The enum value in the form of the string 20 | # @return [String] The enum value 21 | def self.build_from_hash(value) 22 | new.build_from_hash(value) 23 | end 24 | 25 | # Builds the enum from string 26 | # @param [String] The enum value in the form of the string 27 | # @return [String] The enum value 28 | def build_from_hash(value) 29 | return value if BooleanString.all_vars.include?(value) 30 | raise "Invalid ENUM value #{value} for class #BooleanString" 31 | end 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /lib/algolia/models/composition/boolean_string.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Composition 10 | class BooleanString 11 | TRUE = "true".freeze 12 | FALSE = "false".freeze 13 | 14 | def self.all_vars 15 | @all_vars ||= [TRUE, FALSE].freeze 16 | end 17 | 18 | # Builds the enum from string 19 | # @param [String] The enum value in the form of the string 20 | # @return [String] The enum value 21 | def self.build_from_hash(value) 22 | new.build_from_hash(value) 23 | end 24 | 25 | # Builds the enum from string 26 | # @param [String] The enum value in the form of the string 27 | # @return [String] The enum value 28 | def build_from_hash(value) 29 | return value if BooleanString.all_vars.include?(value) 30 | raise "Invalid ENUM value #{value} for class #BooleanString" 31 | end 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /lib/algolia/models/ingestion/run_outcome.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Ingestion 10 | class RunOutcome 11 | SUCCESS = "success".freeze 12 | FAILURE = "failure".freeze 13 | 14 | def self.all_vars 15 | @all_vars ||= [SUCCESS, FAILURE].freeze 16 | end 17 | 18 | # Builds the enum from string 19 | # @param [String] The enum value in the form of the string 20 | # @return [String] The enum value 21 | def self.build_from_hash(value) 22 | new.build_from_hash(value) 23 | end 24 | 25 | # Builds the enum from string 26 | # @param [String] The enum value in the form of the string 27 | # @return [String] The enum value 28 | def build_from_hash(value) 29 | return value if RunOutcome.all_vars.include?(value) 30 | raise "Invalid ENUM value #{value} for class #RunOutcome" 31 | end 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /lib/algolia/models/ingestion/streaming_trigger_type.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Ingestion 10 | class StreamingTriggerType 11 | STREAMING = "streaming".freeze 12 | 13 | def self.all_vars 14 | @all_vars ||= [STREAMING].freeze 15 | end 16 | 17 | # Builds the enum from string 18 | # @param [String] The enum value in the form of the string 19 | # @return [String] The enum value 20 | def self.build_from_hash(value) 21 | new.build_from_hash(value) 22 | end 23 | 24 | # Builds the enum from string 25 | # @param [String] The enum value in the form of the string 26 | # @return [String] The enum value 27 | def build_from_hash(value) 28 | return value if StreamingTriggerType.all_vars.include?(value) 29 | raise "Invalid ENUM value #{value} for class #StreamingTriggerType" 30 | end 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /lib/algolia.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | # Common files 6 | require "algolia/api_client" 7 | require "algolia/api_error" 8 | require "algolia/defaults" 9 | require "algolia/error" 10 | require "algolia/version" 11 | require "algolia/configuration" 12 | require "algolia/user_agent" 13 | require "algolia/logger_helper" 14 | require "algolia/transport/http/http_requester" 15 | require "algolia/transport/http/response" 16 | require "algolia/transport/echo_requester" 17 | require "algolia/transport/call_type" 18 | require "algolia/transport/retry_outcome_type" 19 | require "algolia/transport/stateful_host" 20 | require "algolia/transport/retry_strategy" 21 | require "algolia/transport/request_options" 22 | require "algolia/transport/transport" 23 | 24 | # Models 25 | Dir["#{File.dirname(__FILE__)}/algolia/models/**/*.rb"].sort.each { |file| require file } 26 | 27 | # APIs 28 | Dir["#{File.dirname(__FILE__)}/algolia/api/*.rb"].sort.each { |file| require file } 29 | 30 | module Algolia 31 | end 32 | -------------------------------------------------------------------------------- /lib/algolia/models/ingestion/big_query_data_type.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Ingestion 10 | class BigQueryDataType 11 | GA4 = "ga4".freeze 12 | GA360 = "ga360".freeze 13 | 14 | def self.all_vars 15 | @all_vars ||= [GA4, GA360].freeze 16 | end 17 | 18 | # Builds the enum from string 19 | # @param [String] The enum value in the form of the string 20 | # @return [String] The enum value 21 | def self.build_from_hash(value) 22 | new.build_from_hash(value) 23 | end 24 | 25 | # Builds the enum from string 26 | # @param [String] The enum value in the form of the string 27 | # @return [String] The enum value 28 | def build_from_hash(value) 29 | return value if BigQueryDataType.all_vars.include?(value) 30 | raise "Invalid ENUM value #{value} for class #BigQueryDataType" 31 | end 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /lib/algolia/models/ingestion/entity_type.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Ingestion 10 | class EntityType 11 | PRODUCT = "product".freeze 12 | COLLECTION = "collection".freeze 13 | 14 | def self.all_vars 15 | @all_vars ||= [PRODUCT, COLLECTION].freeze 16 | end 17 | 18 | # Builds the enum from string 19 | # @param [String] The enum value in the form of the string 20 | # @return [String] The enum value 21 | def self.build_from_hash(value) 22 | new.build_from_hash(value) 23 | end 24 | 25 | # Builds the enum from string 26 | # @param [String] The enum value in the form of the string 27 | # @return [String] The enum value 28 | def build_from_hash(value) 29 | return value if EntityType.all_vars.include?(value) 30 | raise "Invalid ENUM value #{value} for class #EntityType" 31 | end 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /lib/algolia/models/ingestion/mapping_format_schema.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Ingestion 10 | class MappingFormatSchema 11 | MAPPINGKIT_V1 = "mappingkit/v1".freeze 12 | 13 | def self.all_vars 14 | @all_vars ||= [MAPPINGKIT_V1].freeze 15 | end 16 | 17 | # Builds the enum from string 18 | # @param [String] The enum value in the form of the string 19 | # @return [String] The enum value 20 | def self.build_from_hash(value) 21 | new.build_from_hash(value) 22 | end 23 | 24 | # Builds the enum from string 25 | # @param [String] The enum value in the form of the string 26 | # @return [String] The enum value 27 | def build_from_hash(value) 28 | return value if MappingFormatSchema.all_vars.include?(value) 29 | raise "Invalid ENUM value #{value} for class #MappingFormatSchema" 30 | end 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /lib/algolia/models/recommend/trending_items_model.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Recommend 10 | class TrendingItemsModel 11 | TRENDING_ITEMS = "trending-items".freeze 12 | 13 | def self.all_vars 14 | @all_vars ||= [TRENDING_ITEMS].freeze 15 | end 16 | 17 | # Builds the enum from string 18 | # @param [String] The enum value in the form of the string 19 | # @return [String] The enum value 20 | def self.build_from_hash(value) 21 | new.build_from_hash(value) 22 | end 23 | 24 | # Builds the enum from string 25 | # @param [String] The enum value in the form of the string 26 | # @return [String] The enum value 27 | def build_from_hash(value) 28 | return value if TrendingItemsModel.all_vars.include?(value) 29 | raise "Invalid ENUM value #{value} for class #TrendingItemsModel" 30 | end 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /lib/algolia/models/search/mode.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Search 10 | class Mode 11 | NEURAL_SEARCH = "neuralSearch".freeze 12 | KEYWORD_SEARCH = "keywordSearch".freeze 13 | 14 | def self.all_vars 15 | @all_vars ||= [NEURAL_SEARCH, KEYWORD_SEARCH].freeze 16 | end 17 | 18 | # Builds the enum from string 19 | # @param [String] The enum value in the form of the string 20 | # @return [String] The enum value 21 | def self.build_from_hash(value) 22 | new.build_from_hash(value) 23 | end 24 | 25 | # Builds the enum from string 26 | # @param [String] The enum value in the form of the string 27 | # @return [String] The enum value 28 | def build_from_hash(value) 29 | return value if Mode.all_vars.include?(value) 30 | raise "Invalid ENUM value #{value} for class #Mode" 31 | end 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /lib/algolia/models/recommend/looking_similar_model.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Recommend 10 | class LookingSimilarModel 11 | LOOKING_SIMILAR = "looking-similar".freeze 12 | 13 | def self.all_vars 14 | @all_vars ||= [LOOKING_SIMILAR].freeze 15 | end 16 | 17 | # Builds the enum from string 18 | # @param [String] The enum value in the form of the string 19 | # @return [String] The enum value 20 | def self.build_from_hash(value) 21 | new.build_from_hash(value) 22 | end 23 | 24 | # Builds the enum from string 25 | # @param [String] The enum value in the form of the string 26 | # @return [String] The enum value 27 | def build_from_hash(value) 28 | return value if LookingSimilarModel.all_vars.include?(value) 29 | raise "Invalid ENUM value #{value} for class #LookingSimilarModel" 30 | end 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /lib/algolia/models/recommend/trending_facets_model.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Recommend 10 | class TrendingFacetsModel 11 | TRENDING_FACETS = "trending-facets".freeze 12 | 13 | def self.all_vars 14 | @all_vars ||= [TRENDING_FACETS].freeze 15 | end 16 | 17 | # Builds the enum from string 18 | # @param [String] The enum value in the form of the string 19 | # @return [String] The enum value 20 | def self.build_from_hash(value) 21 | new.build_from_hash(value) 22 | end 23 | 24 | # Builds the enum from string 25 | # @param [String] The enum value in the form of the string 26 | # @return [String] The enum value 27 | def build_from_hash(value) 28 | return value if TrendingFacetsModel.all_vars.include?(value) 29 | raise "Invalid ENUM value #{value} for class #TrendingFacetsModel" 30 | end 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /lib/algolia/models/search/task_status.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Search 10 | class TaskStatus 11 | PUBLISHED = "published".freeze 12 | NOT_PUBLISHED = "notPublished".freeze 13 | 14 | def self.all_vars 15 | @all_vars ||= [PUBLISHED, NOT_PUBLISHED].freeze 16 | end 17 | 18 | # Builds the enum from string 19 | # @param [String] The enum value in the form of the string 20 | # @return [String] The enum value 21 | def self.build_from_hash(value) 22 | new.build_from_hash(value) 23 | end 24 | 25 | # Builds the enum from string 26 | # @param [String] The enum value in the form of the string 27 | # @return [String] The enum value 28 | def build_from_hash(value) 29 | return value if TaskStatus.all_vars.include?(value) 30 | raise "Invalid ENUM value #{value} for class #TaskStatus" 31 | end 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /lib/algolia/models/ingestion/destination_type.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Ingestion 10 | class DestinationType 11 | SEARCH = "search".freeze 12 | INSIGHTS = "insights".freeze 13 | 14 | def self.all_vars 15 | @all_vars ||= [SEARCH, INSIGHTS].freeze 16 | end 17 | 18 | # Builds the enum from string 19 | # @param [String] The enum value in the form of the string 20 | # @return [String] The enum value 21 | def self.build_from_hash(value) 22 | new.build_from_hash(value) 23 | end 24 | 25 | # Builds the enum from string 26 | # @param [String] The enum value in the form of the string 27 | # @return [String] The enum value 28 | def build_from_hash(value) 29 | return value if DestinationType.all_vars.include?(value) 30 | raise "Invalid ENUM value #{value} for class #DestinationType" 31 | end 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /lib/algolia/models/ingestion/subscription_trigger_type.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Ingestion 10 | class SubscriptionTriggerType 11 | SUBSCRIPTION = "subscription".freeze 12 | 13 | def self.all_vars 14 | @all_vars ||= [SUBSCRIPTION].freeze 15 | end 16 | 17 | # Builds the enum from string 18 | # @param [String] The enum value in the form of the string 19 | # @return [String] The enum value 20 | def self.build_from_hash(value) 21 | new.build_from_hash(value) 22 | end 23 | 24 | # Builds the enum from string 25 | # @param [String] The enum value in the form of the string 26 | # @return [String] The enum value 27 | def build_from_hash(value) 28 | return value if SubscriptionTriggerType.all_vars.include?(value) 29 | raise "Invalid ENUM value #{value} for class #SubscriptionTriggerType" 30 | end 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /lib/algolia/models/ingestion/transformation_type.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Ingestion 10 | class TransformationType 11 | CODE = "code".freeze 12 | NO_CODE = "noCode".freeze 13 | 14 | def self.all_vars 15 | @all_vars ||= [CODE, NO_CODE].freeze 16 | end 17 | 18 | # Builds the enum from string 19 | # @param [String] The enum value in the form of the string 20 | # @return [String] The enum value 21 | def self.build_from_hash(value) 22 | new.build_from_hash(value) 23 | end 24 | 25 | # Builds the enum from string 26 | # @param [String] The enum value in the form of the string 27 | # @return [String] The enum value 28 | def build_from_hash(value) 29 | return value if TransformationType.all_vars.include?(value) 30 | raise "Invalid ENUM value #{value} for class #TransformationType" 31 | end 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /lib/algolia/models/recommend/task_status.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Recommend 10 | class TaskStatus 11 | PUBLISHED = "published".freeze 12 | NOT_PUBLISHED = "notPublished".freeze 13 | 14 | def self.all_vars 15 | @all_vars ||= [PUBLISHED, NOT_PUBLISHED].freeze 16 | end 17 | 18 | # Builds the enum from string 19 | # @param [String] The enum value in the form of the string 20 | # @return [String] The enum value 21 | def self.build_from_hash(value) 22 | new.build_from_hash(value) 23 | end 24 | 25 | # Builds the enum from string 26 | # @param [String] The enum value in the form of the string 27 | # @return [String] The enum value 28 | def build_from_hash(value) 29 | return value if TaskStatus.all_vars.include?(value) 30 | raise "Invalid ENUM value #{value} for class #TaskStatus" 31 | end 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /lib/algolia/models/search/match_level.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Search 10 | class MatchLevel 11 | NONE = "none".freeze 12 | PARTIAL = "partial".freeze 13 | FULL = "full".freeze 14 | 15 | def self.all_vars 16 | @all_vars ||= [NONE, PARTIAL, FULL].freeze 17 | end 18 | 19 | # Builds the enum from string 20 | # @param [String] The enum value in the form of the string 21 | # @return [String] The enum value 22 | def self.build_from_hash(value) 23 | new.build_from_hash(value) 24 | end 25 | 26 | # Builds the enum from string 27 | # @param [String] The enum value in the form of the string 28 | # @return [String] The enum value 29 | def build_from_hash(value) 30 | return value if MatchLevel.all_vars.include?(value) 31 | raise "Invalid ENUM value #{value} for class #MatchLevel" 32 | end 33 | end 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /lib/algolia/models/composition/task_status.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Composition 10 | class TaskStatus 11 | PUBLISHED = "published".freeze 12 | NOT_PUBLISHED = "notPublished".freeze 13 | 14 | def self.all_vars 15 | @all_vars ||= [PUBLISHED, NOT_PUBLISHED].freeze 16 | end 17 | 18 | # Builds the enum from string 19 | # @param [String] The enum value in the form of the string 20 | # @return [String] The enum value 21 | def self.build_from_hash(value) 22 | new.build_from_hash(value) 23 | end 24 | 25 | # Builds the enum from string 26 | # @param [String] The enum value in the form of the string 27 | # @return [String] The enum value 28 | def build_from_hash(value) 29 | return value if TaskStatus.all_vars.include?(value) 30 | raise "Invalid ENUM value #{value} for class #TaskStatus" 31 | end 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /lib/algolia/models/recommend/match_level.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Recommend 10 | class MatchLevel 11 | NONE = "none".freeze 12 | PARTIAL = "partial".freeze 13 | FULL = "full".freeze 14 | 15 | def self.all_vars 16 | @all_vars ||= [NONE, PARTIAL, FULL].freeze 17 | end 18 | 19 | # Builds the enum from string 20 | # @param [String] The enum value in the form of the string 21 | # @return [String] The enum value 22 | def self.build_from_hash(value) 23 | new.build_from_hash(value) 24 | end 25 | 26 | # Builds the enum from string 27 | # @param [String] The enum value in the form of the string 28 | # @return [String] The enum value 29 | def build_from_hash(value) 30 | return value if MatchLevel.all_vars.include?(value) 31 | raise "Invalid ENUM value #{value} for class #MatchLevel" 32 | end 33 | end 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /lib/algolia/models/composition/match_level.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Composition 10 | class MatchLevel 11 | NONE = "none".freeze 12 | PARTIAL = "partial".freeze 13 | FULL = "full".freeze 14 | 15 | def self.all_vars 16 | @all_vars ||= [NONE, PARTIAL, FULL].freeze 17 | end 18 | 19 | # Builds the enum from string 20 | # @param [String] The enum value in the form of the string 21 | # @return [String] The enum value 22 | def self.build_from_hash(value) 23 | new.build_from_hash(value) 24 | end 25 | 26 | # Builds the enum from string 27 | # @param [String] The enum value in the form of the string 28 | # @return [String] The enum value 29 | def build_from_hash(value) 30 | return value if MatchLevel.all_vars.include?(value) 31 | raise "Invalid ENUM value #{value} for class #MatchLevel" 32 | end 33 | end 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /lib/algolia/models/query-suggestions/log_level.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module QuerySuggestions 10 | class LogLevel 11 | SKIP = "SKIP".freeze 12 | INFO = "INFO".freeze 13 | ERROR = "ERROR".freeze 14 | 15 | def self.all_vars 16 | @all_vars ||= [SKIP, INFO, ERROR].freeze 17 | end 18 | 19 | # Builds the enum from string 20 | # @param [String] The enum value in the form of the string 21 | # @return [String] The enum value 22 | def self.build_from_hash(value) 23 | new.build_from_hash(value) 24 | end 25 | 26 | # Builds the enum from string 27 | # @param [String] The enum value in the form of the string 28 | # @return [String] The enum value 29 | def build_from_hash(value) 30 | return value if LogLevel.all_vars.include?(value) 31 | raise "Invalid ENUM value #{value} for class #LogLevel" 32 | end 33 | end 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /lib/algolia/models/search/dictionary_entry_type.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Search 10 | class DictionaryEntryType 11 | CUSTOM = "custom".freeze 12 | STANDARD = "standard".freeze 13 | 14 | def self.all_vars 15 | @all_vars ||= [CUSTOM, STANDARD].freeze 16 | end 17 | 18 | # Builds the enum from string 19 | # @param [String] The enum value in the form of the string 20 | # @return [String] The enum value 21 | def self.build_from_hash(value) 22 | new.build_from_hash(value) 23 | end 24 | 25 | # Builds the enum from string 26 | # @param [String] The enum value in the form of the string 27 | # @return [String] The enum value 28 | def build_from_hash(value) 29 | return value if DictionaryEntryType.all_vars.include?(value) 30 | raise "Invalid ENUM value #{value} for class #DictionaryEntryType" 31 | end 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /lib/algolia/models/search/dictionary_action.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Search 10 | class DictionaryAction 11 | ADD_ENTRY = "addEntry".freeze 12 | DELETE_ENTRY = "deleteEntry".freeze 13 | 14 | def self.all_vars 15 | @all_vars ||= [ADD_ENTRY, DELETE_ENTRY].freeze 16 | end 17 | 18 | # Builds the enum from string 19 | # @param [String] The enum value in the form of the string 20 | # @return [String] The enum value 21 | def self.build_from_hash(value) 22 | new.build_from_hash(value) 23 | end 24 | 25 | # Builds the enum from string 26 | # @param [String] The enum value in the form of the string 27 | # @return [String] The enum value 28 | def build_from_hash(value) 29 | return value if DictionaryAction.all_vars.include?(value) 30 | raise "Invalid ENUM value #{value} for class #DictionaryAction" 31 | end 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /lib/algolia/models/search/dictionary_entry_state.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Search 10 | class DictionaryEntryState 11 | ENABLED = "enabled".freeze 12 | DISABLED = "disabled".freeze 13 | 14 | def self.all_vars 15 | @all_vars ||= [ENABLED, DISABLED].freeze 16 | end 17 | 18 | # Builds the enum from string 19 | # @param [String] The enum value in the form of the string 20 | # @return [String] The enum value 21 | def self.build_from_hash(value) 22 | new.build_from_hash(value) 23 | end 24 | 25 | # Builds the enum from string 26 | # @param [String] The enum value in the form of the string 27 | # @return [String] The enum value 28 | def build_from_hash(value) 29 | return value if DictionaryEntryState.all_vars.include?(value) 30 | raise "Invalid ENUM value #{value} for class #DictionaryEntryState" 31 | end 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /lib/algolia/models/search/scope_type.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Search 10 | class ScopeType 11 | SETTINGS = "settings".freeze 12 | SYNONYMS = "synonyms".freeze 13 | RULES = "rules".freeze 14 | 15 | def self.all_vars 16 | @all_vars ||= [SETTINGS, SYNONYMS, RULES].freeze 17 | end 18 | 19 | # Builds the enum from string 20 | # @param [String] The enum value in the form of the string 21 | # @return [String] The enum value 22 | def self.build_from_hash(value) 23 | new.build_from_hash(value) 24 | end 25 | 26 | # Builds the enum from string 27 | # @param [String] The enum value in the form of the string 28 | # @return [String] The enum value 29 | def build_from_hash(value) 30 | return value if ScopeType.all_vars.include?(value) 31 | raise "Invalid ENUM value #{value} for class #ScopeType" 32 | end 33 | end 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /lib/algolia/models/composition/external_ordering.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Composition 10 | class ExternalOrdering 11 | DEFAULT = "default".freeze 12 | USER_DEFINED = "userDefined".freeze 13 | 14 | def self.all_vars 15 | @all_vars ||= [DEFAULT, USER_DEFINED].freeze 16 | end 17 | 18 | # Builds the enum from string 19 | # @param [String] The enum value in the form of the string 20 | # @return [String] The enum value 21 | def self.build_from_hash(value) 22 | new.build_from_hash(value) 23 | end 24 | 25 | # Builds the enum from string 26 | # @param [String] The enum value in the form of the string 27 | # @return [String] The enum value 28 | def build_from_hash(value) 29 | return value if ExternalOrdering.all_vars.include?(value) 30 | raise "Invalid ENUM value #{value} for class #ExternalOrdering" 31 | end 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /lib/algolia/models/search/api_key_operation.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Search 10 | class ApiKeyOperation 11 | ADD = "add".freeze 12 | DELETE = "delete".freeze 13 | UPDATE = "update".freeze 14 | 15 | def self.all_vars 16 | @all_vars ||= [ADD, DELETE, UPDATE].freeze 17 | end 18 | 19 | # Builds the enum from string 20 | # @param [String] The enum value in the form of the string 21 | # @return [String] The enum value 22 | def self.build_from_hash(value) 23 | new.build_from_hash(value) 24 | end 25 | 26 | # Builds the enum from string 27 | # @param [String] The enum value in the form of the string 28 | # @return [String] The enum value 29 | def build_from_hash(value) 30 | return value if ApiKeyOperation.all_vars.include?(value) 31 | raise "Invalid ENUM value #{value} for class #ApiKeyOperation" 32 | end 33 | end 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /lib/algolia/models/search/search_strategy.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Search 10 | class SearchStrategy 11 | NONE = "none".freeze 12 | STOP_IF_ENOUGH_MATCHES = "stopIfEnoughMatches".freeze 13 | 14 | def self.all_vars 15 | @all_vars ||= [NONE, STOP_IF_ENOUGH_MATCHES].freeze 16 | end 17 | 18 | # Builds the enum from string 19 | # @param [String] The enum value in the form of the string 20 | # @return [String] The enum value 21 | def self.build_from_hash(value) 22 | new.build_from_hash(value) 23 | end 24 | 25 | # Builds the enum from string 26 | # @param [String] The enum value in the form of the string 27 | # @return [String] The enum value 28 | def build_from_hash(value) 29 | return value if SearchStrategy.all_vars.include?(value) 30 | raise "Invalid ENUM value #{value} for class #SearchStrategy" 31 | end 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /lib/algolia/models/personalization/event_type.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Personalization 10 | class EventType 11 | CLICK = "click".freeze 12 | CONVERSION = "conversion".freeze 13 | VIEW = "view".freeze 14 | 15 | def self.all_vars 16 | @all_vars ||= [CLICK, CONVERSION, VIEW].freeze 17 | end 18 | 19 | # Builds the enum from string 20 | # @param [String] The enum value in the form of the string 21 | # @return [String] The enum value 22 | def self.build_from_hash(value) 23 | new.build_from_hash(value) 24 | end 25 | 26 | # Builds the enum from string 27 | # @param [String] The enum value in the form of the string 28 | # @return [String] The enum value 29 | def build_from_hash(value) 30 | return value if EventType.all_vars.include?(value) 31 | raise "Invalid ENUM value #{value} for class #EventType" 32 | end 33 | end 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /lib/algolia/models/search/log_type.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Search 10 | class LogType 11 | ALL = "all".freeze 12 | QUERY = "query".freeze 13 | BUILD = "build".freeze 14 | ERROR = "error".freeze 15 | 16 | def self.all_vars 17 | @all_vars ||= [ALL, QUERY, BUILD, ERROR].freeze 18 | end 19 | 20 | # Builds the enum from string 21 | # @param [String] The enum value in the form of the string 22 | # @return [String] The enum value 23 | def self.build_from_hash(value) 24 | new.build_from_hash(value) 25 | end 26 | 27 | # Builds the enum from string 28 | # @param [String] The enum value in the form of the string 29 | # @return [String] The enum value 30 | def build_from_hash(value) 31 | return value if LogType.all_vars.include?(value) 32 | raise "Invalid ENUM value #{value} for class #LogType" 33 | end 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /lib/algolia/models/search/sort_remaining_by.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Search 10 | class SortRemainingBy 11 | COUNT = "count".freeze 12 | ALPHA = "alpha".freeze 13 | HIDDEN = "hidden".freeze 14 | 15 | def self.all_vars 16 | @all_vars ||= [COUNT, ALPHA, HIDDEN].freeze 17 | end 18 | 19 | # Builds the enum from string 20 | # @param [String] The enum value in the form of the string 21 | # @return [String] The enum value 22 | def self.build_from_hash(value) 23 | new.build_from_hash(value) 24 | end 25 | 26 | # Builds the enum from string 27 | # @param [String] The enum value in the form of the string 28 | # @return [String] The enum value 29 | def build_from_hash(value) 30 | return value if SortRemainingBy.all_vars.include?(value) 31 | raise "Invalid ENUM value #{value} for class #SortRemainingBy" 32 | end 33 | end 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /lib/algolia/models/composition/dedup_positioning.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Composition 10 | class DedupPositioning 11 | HIGHEST = "highest".freeze 12 | HIGHEST_INJECTED = "highestInjected".freeze 13 | 14 | def self.all_vars 15 | @all_vars ||= [HIGHEST, HIGHEST_INJECTED].freeze 16 | end 17 | 18 | # Builds the enum from string 19 | # @param [String] The enum value in the form of the string 20 | # @return [String] The enum value 21 | def self.build_from_hash(value) 22 | new.build_from_hash(value) 23 | end 24 | 25 | # Builds the enum from string 26 | # @param [String] The enum value in the form of the string 27 | # @return [String] The enum value 28 | def build_from_hash(value) 29 | return value if DedupPositioning.all_vars.include?(value) 30 | raise "Invalid ENUM value #{value} for class #DedupPositioning" 31 | end 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /lib/algolia/models/recommend/sort_remaining_by.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Recommend 10 | class SortRemainingBy 11 | COUNT = "count".freeze 12 | ALPHA = "alpha".freeze 13 | HIDDEN = "hidden".freeze 14 | 15 | def self.all_vars 16 | @all_vars ||= [COUNT, ALPHA, HIDDEN].freeze 17 | end 18 | 19 | # Builds the enum from string 20 | # @param [String] The enum value in the form of the string 21 | # @return [String] The enum value 22 | def self.build_from_hash(value) 23 | new.build_from_hash(value) 24 | end 25 | 26 | # Builds the enum from string 27 | # @param [String] The enum value in the form of the string 28 | # @return [String] The enum value 29 | def build_from_hash(value) 30 | return value if SortRemainingBy.all_vars.include?(value) 31 | raise "Invalid ENUM value #{value} for class #SortRemainingBy" 32 | end 33 | end 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /lib/algolia/models/composition/sort_remaining_by.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Composition 10 | class SortRemainingBy 11 | COUNT = "count".freeze 12 | ALPHA = "alpha".freeze 13 | HIDDEN = "hidden".freeze 14 | 15 | def self.all_vars 16 | @all_vars ||= [COUNT, ALPHA, HIDDEN].freeze 17 | end 18 | 19 | # Builds the enum from string 20 | # @param [String] The enum value in the form of the string 21 | # @return [String] The enum value 22 | def self.build_from_hash(value) 23 | new.build_from_hash(value) 24 | end 25 | 26 | # Builds the enum from string 27 | # @param [String] The enum value in the form of the string 28 | # @return [String] The enum value 29 | def build_from_hash(value) 30 | return value if SortRemainingBy.all_vars.include?(value) 31 | raise "Invalid ENUM value #{value} for class #SortRemainingBy" 32 | end 33 | end 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /lib/algolia/models/ingestion/record_type.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Ingestion 10 | class RecordType 11 | PRODUCT = "product".freeze 12 | VARIANT = "variant".freeze 13 | COLLECTION = "collection".freeze 14 | 15 | def self.all_vars 16 | @all_vars ||= [PRODUCT, VARIANT, COLLECTION].freeze 17 | end 18 | 19 | # Builds the enum from string 20 | # @param [String] The enum value in the form of the string 21 | # @return [String] The enum value 22 | def self.build_from_hash(value) 23 | new.build_from_hash(value) 24 | end 25 | 26 | # Builds the enum from string 27 | # @param [String] The enum value in the form of the string 28 | # @return [String] The enum value 29 | def build_from_hash(value) 30 | return value if RecordType.all_vars.include?(value) 31 | raise "Invalid ENUM value #{value} for class #RecordType" 32 | end 33 | end 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /lib/algolia/models/ingestion/event_sort_keys.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Ingestion 10 | class EventSortKeys 11 | STATUS = "status".freeze 12 | TYPE = "type".freeze 13 | PUBLISHED_AT = "publishedAt".freeze 14 | 15 | def self.all_vars 16 | @all_vars ||= [STATUS, TYPE, PUBLISHED_AT].freeze 17 | end 18 | 19 | # Builds the enum from string 20 | # @param [String] The enum value in the form of the string 21 | # @return [String] The enum value 22 | def self.build_from_hash(value) 23 | new.build_from_hash(value) 24 | end 25 | 26 | # Builds the enum from string 27 | # @param [String] The enum value in the form of the string 28 | # @return [String] The enum value 29 | def build_from_hash(value) 30 | return value if EventSortKeys.all_vars.include?(value) 31 | raise "Invalid ENUM value #{value} for class #EventSortKeys" 32 | end 33 | end 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /lib/algolia/models/ingestion/docker_streams_sync_mode.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Ingestion 10 | class DockerStreamsSyncMode 11 | INCREMENTAL = "incremental".freeze 12 | FULL_TABLE = "fullTable".freeze 13 | 14 | def self.all_vars 15 | @all_vars ||= [INCREMENTAL, FULL_TABLE].freeze 16 | end 17 | 18 | # Builds the enum from string 19 | # @param [String] The enum value in the form of the string 20 | # @return [String] The enum value 21 | def self.build_from_hash(value) 22 | new.build_from_hash(value) 23 | end 24 | 25 | # Builds the enum from string 26 | # @param [String] The enum value in the form of the string 27 | # @return [String] The enum value 28 | def build_from_hash(value) 29 | return value if DockerStreamsSyncMode.all_vars.include?(value) 30 | raise "Invalid ENUM value #{value} for class #DockerStreamsSyncMode" 31 | end 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /lib/algolia/models/ingestion/platform.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Ingestion 10 | class Platform 11 | BIGCOMMERCE = "bigcommerce".freeze 12 | COMMERCETOOLS = "commercetools".freeze 13 | SHOPIFY = "shopify".freeze 14 | 15 | def self.all_vars 16 | @all_vars ||= [BIGCOMMERCE, COMMERCETOOLS, SHOPIFY].freeze 17 | end 18 | 19 | # Builds the enum from string 20 | # @param [String] The enum value in the form of the string 21 | # @return [String] The enum value 22 | def self.build_from_hash(value) 23 | new.build_from_hash(value) 24 | end 25 | 26 | # Builds the enum from string 27 | # @param [String] The enum value in the form of the string 28 | # @return [String] The enum value 29 | def build_from_hash(value) 30 | return value if Platform.all_vars.include?(value) 31 | raise "Invalid ENUM value #{value} for class #Platform" 32 | end 33 | end 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /lib/algolia/models/ingestion/run_sort_keys.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Ingestion 10 | class RunSortKeys 11 | STATUS = "status".freeze 12 | UPDATED_AT = "updatedAt".freeze 13 | CREATED_AT = "createdAt".freeze 14 | 15 | def self.all_vars 16 | @all_vars ||= [STATUS, UPDATED_AT, CREATED_AT].freeze 17 | end 18 | 19 | # Builds the enum from string 20 | # @param [String] The enum value in the form of the string 21 | # @return [String] The enum value 22 | def self.build_from_hash(value) 23 | new.build_from_hash(value) 24 | end 25 | 26 | # Builds the enum from string 27 | # @param [String] The enum value in the form of the string 28 | # @return [String] The enum value 29 | def build_from_hash(value) 30 | return value if RunSortKeys.all_vars.include?(value) 31 | raise "Invalid ENUM value #{value} for class #RunSortKeys" 32 | end 33 | end 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /lib/algolia/models/search/dictionary_type.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Search 10 | class DictionaryType 11 | PLURALS = "plurals".freeze 12 | STOPWORDS = "stopwords".freeze 13 | COMPOUNDS = "compounds".freeze 14 | 15 | def self.all_vars 16 | @all_vars ||= [PLURALS, STOPWORDS, COMPOUNDS].freeze 17 | end 18 | 19 | # Builds the enum from string 20 | # @param [String] The enum value in the form of the string 21 | # @return [String] The enum value 22 | def self.build_from_hash(value) 23 | new.build_from_hash(value) 24 | end 25 | 26 | # Builds the enum from string 27 | # @param [String] The enum value in the form of the string 28 | # @return [String] The enum value 29 | def build_from_hash(value) 30 | return value if DictionaryType.all_vars.include?(value) 31 | raise "Invalid ENUM value #{value} for class #DictionaryType" 32 | end 33 | end 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /lib/algolia/models/search/event_type.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Search 10 | class EventType 11 | FETCH = "fetch".freeze 12 | RECORD = "record".freeze 13 | LOG = "log".freeze 14 | TRANSFORM = "transform".freeze 15 | 16 | def self.all_vars 17 | @all_vars ||= [FETCH, RECORD, LOG, TRANSFORM].freeze 18 | end 19 | 20 | # Builds the enum from string 21 | # @param [String] The enum value in the form of the string 22 | # @return [String] The enum value 23 | def self.build_from_hash(value) 24 | new.build_from_hash(value) 25 | end 26 | 27 | # Builds the enum from string 28 | # @param [String] The enum value in the form of the string 29 | # @return [String] The enum value 30 | def build_from_hash(value) 31 | return value if EventType.all_vars.include?(value) 32 | raise "Invalid ENUM value #{value} for class #EventType" 33 | end 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /lib/algolia/models/search/query_type.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Search 10 | class QueryType 11 | PREFIX_LAST = "prefixLast".freeze 12 | PREFIX_ALL = "prefixAll".freeze 13 | PREFIX_NONE = "prefixNone".freeze 14 | 15 | def self.all_vars 16 | @all_vars ||= [PREFIX_LAST, PREFIX_ALL, PREFIX_NONE].freeze 17 | end 18 | 19 | # Builds the enum from string 20 | # @param [String] The enum value in the form of the string 21 | # @return [String] The enum value 22 | def self.build_from_hash(value) 23 | new.build_from_hash(value) 24 | end 25 | 26 | # Builds the enum from string 27 | # @param [String] The enum value in the form of the string 28 | # @return [String] The enum value 29 | def build_from_hash(value) 30 | return value if QueryType.all_vars.include?(value) 31 | raise "Invalid ENUM value #{value} for class #QueryType" 32 | end 33 | end 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /lib/algolia/models/abtesting/status.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Abtesting 10 | class Status 11 | ACTIVE = "active".freeze 12 | STOPPED = "stopped".freeze 13 | EXPIRED = "expired".freeze 14 | FAILED = "failed".freeze 15 | 16 | def self.all_vars 17 | @all_vars ||= [ACTIVE, STOPPED, EXPIRED, FAILED].freeze 18 | end 19 | 20 | # Builds the enum from string 21 | # @param [String] The enum value in the form of the string 22 | # @return [String] The enum value 23 | def self.build_from_hash(value) 24 | new.build_from_hash(value) 25 | end 26 | 27 | # Builds the enum from string 28 | # @param [String] The enum value in the form of the string 29 | # @return [String] The enum value 30 | def build_from_hash(value) 31 | return value if Status.all_vars.include?(value) 32 | raise "Invalid ENUM value #{value} for class #Status" 33 | end 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /lib/algolia/models/recommend/query_type.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Recommend 10 | class QueryType 11 | PREFIX_LAST = "prefixLast".freeze 12 | PREFIX_ALL = "prefixAll".freeze 13 | PREFIX_NONE = "prefixNone".freeze 14 | 15 | def self.all_vars 16 | @all_vars ||= [PREFIX_LAST, PREFIX_ALL, PREFIX_NONE].freeze 17 | end 18 | 19 | # Builds the enum from string 20 | # @param [String] The enum value in the form of the string 21 | # @return [String] The enum value 22 | def self.build_from_hash(value) 23 | new.build_from_hash(value) 24 | end 25 | 26 | # Builds the enum from string 27 | # @param [String] The enum value in the form of the string 28 | # @return [String] The enum value 29 | def build_from_hash(value) 30 | return value if QueryType.all_vars.include?(value) 31 | raise "Invalid ENUM value #{value} for class #QueryType" 32 | end 33 | end 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /lib/algolia/models/search/advanced_syntax_features.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Search 10 | class AdvancedSyntaxFeatures 11 | EXACT_PHRASE = "exactPhrase".freeze 12 | EXCLUDE_WORDS = "excludeWords".freeze 13 | 14 | def self.all_vars 15 | @all_vars ||= [EXACT_PHRASE, EXCLUDE_WORDS].freeze 16 | end 17 | 18 | # Builds the enum from string 19 | # @param [String] The enum value in the form of the string 20 | # @return [String] The enum value 21 | def self.build_from_hash(value) 22 | new.build_from_hash(value) 23 | end 24 | 25 | # Builds the enum from string 26 | # @param [String] The enum value in the form of the string 27 | # @return [String] The enum value 28 | def build_from_hash(value) 29 | return value if AdvancedSyntaxFeatures.all_vars.include?(value) 30 | raise "Invalid ENUM value #{value} for class #AdvancedSyntaxFeatures" 31 | end 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /lib/algolia/models/abtesting-v3/status.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module AbtestingV3 10 | class Status 11 | ACTIVE = "active".freeze 12 | STOPPED = "stopped".freeze 13 | EXPIRED = "expired".freeze 14 | FAILED = "failed".freeze 15 | 16 | def self.all_vars 17 | @all_vars ||= [ACTIVE, STOPPED, EXPIRED, FAILED].freeze 18 | end 19 | 20 | # Builds the enum from string 21 | # @param [String] The enum value in the form of the string 22 | # @return [String] The enum value 23 | def self.build_from_hash(value) 24 | new.build_from_hash(value) 25 | end 26 | 27 | # Builds the enum from string 28 | # @param [String] The enum value in the form of the string 29 | # @return [String] The enum value 30 | def build_from_hash(value) 31 | return value if Status.all_vars.include?(value) 32 | raise "Invalid ENUM value #{value} for class #Status" 33 | end 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /lib/algolia/models/composition/query_type.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Composition 10 | class QueryType 11 | PREFIX_LAST = "prefixLast".freeze 12 | PREFIX_ALL = "prefixAll".freeze 13 | PREFIX_NONE = "prefixNone".freeze 14 | 15 | def self.all_vars 16 | @all_vars ||= [PREFIX_LAST, PREFIX_ALL, PREFIX_NONE].freeze 17 | end 18 | 19 | # Builds the enum from string 20 | # @param [String] The enum value in the form of the string 21 | # @return [String] The enum value 22 | def self.build_from_hash(value) 23 | new.build_from_hash(value) 24 | end 25 | 26 | # Builds the enum from string 27 | # @param [String] The enum value in the form of the string 28 | # @return [String] The enum value 29 | def build_from_hash(value) 30 | return value if QueryType.all_vars.include?(value) 31 | raise "Invalid ENUM value #{value} for class #QueryType" 32 | end 33 | end 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /lib/algolia/models/ingestion/event_type.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Ingestion 10 | class EventType 11 | FETCH = "fetch".freeze 12 | RECORD = "record".freeze 13 | LOG = "log".freeze 14 | TRANSFORM = "transform".freeze 15 | 16 | def self.all_vars 17 | @all_vars ||= [FETCH, RECORD, LOG, TRANSFORM].freeze 18 | end 19 | 20 | # Builds the enum from string 21 | # @param [String] The enum value in the form of the string 22 | # @return [String] The enum value 23 | def self.build_from_hash(value) 24 | new.build_from_hash(value) 25 | end 26 | 27 | # Builds the enum from string 28 | # @param [String] The enum value in the form of the string 29 | # @return [String] The enum value 30 | def build_from_hash(value) 31 | return value if EventType.all_vars.include?(value) 32 | raise "Invalid ENUM value #{value} for class #EventType" 33 | end 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /lib/algolia/models/abtesting-v3/error_correction_type.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module AbtestingV3 10 | class ErrorCorrectionType 11 | BONFERRONI = "bonferroni".freeze 12 | BENJAMINI_HOCHBERG = "benjamini-hochberg".freeze 13 | 14 | def self.all_vars 15 | @all_vars ||= [BONFERRONI, BENJAMINI_HOCHBERG].freeze 16 | end 17 | 18 | # Builds the enum from string 19 | # @param [String] The enum value in the form of the string 20 | # @return [String] The enum value 21 | def self.build_from_hash(value) 22 | new.build_from_hash(value) 23 | end 24 | 25 | # Builds the enum from string 26 | # @param [String] The enum value in the form of the string 27 | # @return [String] The enum value 28 | def build_from_hash(value) 29 | return value if ErrorCorrectionType.all_vars.include?(value) 30 | raise "Invalid ENUM value #{value} for class #ErrorCorrectionType" 31 | end 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /lib/algolia/models/composition/advanced_syntax_features.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Composition 10 | class AdvancedSyntaxFeatures 11 | EXACT_PHRASE = "exactPhrase".freeze 12 | EXCLUDE_WORDS = "excludeWords".freeze 13 | 14 | def self.all_vars 15 | @all_vars ||= [EXACT_PHRASE, EXCLUDE_WORDS].freeze 16 | end 17 | 18 | # Builds the enum from string 19 | # @param [String] The enum value in the form of the string 20 | # @return [String] The enum value 21 | def self.build_from_hash(value) 22 | new.build_from_hash(value) 23 | end 24 | 25 | # Builds the enum from string 26 | # @param [String] The enum value in the form of the string 27 | # @return [String] The enum value 28 | def build_from_hash(value) 29 | return value if AdvancedSyntaxFeatures.all_vars.include?(value) 30 | raise "Invalid ENUM value #{value} for class #AdvancedSyntaxFeatures" 31 | end 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /lib/algolia/models/recommend/advanced_syntax_features.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Recommend 10 | class AdvancedSyntaxFeatures 11 | EXACT_PHRASE = "exactPhrase".freeze 12 | EXCLUDE_WORDS = "excludeWords".freeze 13 | 14 | def self.all_vars 15 | @all_vars ||= [EXACT_PHRASE, EXCLUDE_WORDS].freeze 16 | end 17 | 18 | # Builds the enum from string 19 | # @param [String] The enum value in the form of the string 20 | # @return [String] The enum value 21 | def self.build_from_hash(value) 22 | new.build_from_hash(value) 23 | end 24 | 25 | # Builds the enum from string 26 | # @param [String] The enum value in the form of the string 27 | # @return [String] The enum value 28 | def build_from_hash(value) 29 | return value if AdvancedSyntaxFeatures.all_vars.include?(value) 30 | raise "Invalid ENUM value #{value} for class #AdvancedSyntaxFeatures" 31 | end 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /lib/algolia/models/search/exact_on_single_word_query.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Search 10 | class ExactOnSingleWordQuery 11 | ATTRIBUTE = "attribute".freeze 12 | NONE = "none".freeze 13 | WORD = "word".freeze 14 | 15 | def self.all_vars 16 | @all_vars ||= [ATTRIBUTE, NONE, WORD].freeze 17 | end 18 | 19 | # Builds the enum from string 20 | # @param [String] The enum value in the form of the string 21 | # @return [String] The enum value 22 | def self.build_from_hash(value) 23 | new.build_from_hash(value) 24 | end 25 | 26 | # Builds the enum from string 27 | # @param [String] The enum value in the form of the string 28 | # @return [String] The enum value 29 | def build_from_hash(value) 30 | return value if ExactOnSingleWordQuery.all_vars.include?(value) 31 | raise "Invalid ENUM value #{value} for class #ExactOnSingleWordQuery" 32 | end 33 | end 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /lib/algolia/models/monitoring/period.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Monitoring 10 | class Period 11 | MINUTE = "minute".freeze 12 | HOUR = "hour".freeze 13 | DAY = "day".freeze 14 | WEEK = "week".freeze 15 | MONTH = "month".freeze 16 | 17 | def self.all_vars 18 | @all_vars ||= [MINUTE, HOUR, DAY, WEEK, MONTH].freeze 19 | end 20 | 21 | # Builds the enum from string 22 | # @param [String] The enum value in the form of the string 23 | # @return [String] The enum value 24 | def self.build_from_hash(value) 25 | new.build_from_hash(value) 26 | end 27 | 28 | # Builds the enum from string 29 | # @param [String] The enum value in the form of the string 30 | # @return [String] The enum value 31 | def build_from_hash(value) 32 | return value if Period.all_vars.include?(value) 33 | raise "Invalid ENUM value #{value} for class #Period" 34 | end 35 | end 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /lib/algolia/models/recommend/exact_on_single_word_query.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Recommend 10 | class ExactOnSingleWordQuery 11 | ATTRIBUTE = "attribute".freeze 12 | NONE = "none".freeze 13 | WORD = "word".freeze 14 | 15 | def self.all_vars 16 | @all_vars ||= [ATTRIBUTE, NONE, WORD].freeze 17 | end 18 | 19 | # Builds the enum from string 20 | # @param [String] The enum value in the form of the string 21 | # @return [String] The enum value 22 | def self.build_from_hash(value) 23 | new.build_from_hash(value) 24 | end 25 | 26 | # Builds the enum from string 27 | # @param [String] The enum value in the form of the string 28 | # @return [String] The enum value 29 | def build_from_hash(value) 30 | return value if ExactOnSingleWordQuery.all_vars.include?(value) 31 | raise "Invalid ENUM value #{value} for class #ExactOnSingleWordQuery" 32 | end 33 | end 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /lib/algolia/models/search/anchoring.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Search 10 | class Anchoring 11 | IS = "is".freeze 12 | STARTS_WITH = "startsWith".freeze 13 | ENDS_WITH = "endsWith".freeze 14 | CONTAINS = "contains".freeze 15 | 16 | def self.all_vars 17 | @all_vars ||= [IS, STARTS_WITH, ENDS_WITH, CONTAINS].freeze 18 | end 19 | 20 | # Builds the enum from string 21 | # @param [String] The enum value in the form of the string 22 | # @return [String] The enum value 23 | def self.build_from_hash(value) 24 | new.build_from_hash(value) 25 | end 26 | 27 | # Builds the enum from string 28 | # @param [String] The enum value in the form of the string 29 | # @return [String] The enum value 30 | def build_from_hash(value) 31 | return value if Anchoring.all_vars.include?(value) 32 | raise "Invalid ENUM value #{value} for class #Anchoring" 33 | end 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /lib/algolia/models/search/typo_tolerance_enum.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Search 10 | class TypoToleranceEnum 11 | MIN = "min".freeze 12 | STRICT = "strict".freeze 13 | TRUE = "true".freeze 14 | FALSE = "false".freeze 15 | 16 | def self.all_vars 17 | @all_vars ||= [MIN, STRICT, TRUE, FALSE].freeze 18 | end 19 | 20 | # Builds the enum from string 21 | # @param [String] The enum value in the form of the string 22 | # @return [String] The enum value 23 | def self.build_from_hash(value) 24 | new.build_from_hash(value) 25 | end 26 | 27 | # Builds the enum from string 28 | # @param [String] The enum value in the form of the string 29 | # @return [String] The enum value 30 | def build_from_hash(value) 31 | return value if TypoToleranceEnum.all_vars.include?(value) 32 | raise "Invalid ENUM value #{value} for class #TypoToleranceEnum" 33 | end 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /lib/algolia/models/composition/exact_on_single_word_query.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Composition 10 | class ExactOnSingleWordQuery 11 | ATTRIBUTE = "attribute".freeze 12 | NONE = "none".freeze 13 | WORD = "word".freeze 14 | 15 | def self.all_vars 16 | @all_vars ||= [ATTRIBUTE, NONE, WORD].freeze 17 | end 18 | 19 | # Builds the enum from string 20 | # @param [String] The enum value in the form of the string 21 | # @return [String] The enum value 22 | def self.build_from_hash(value) 23 | new.build_from_hash(value) 24 | end 25 | 26 | # Builds the enum from string 27 | # @param [String] The enum value in the form of the string 28 | # @return [String] The enum value 29 | def build_from_hash(value) 30 | return value if ExactOnSingleWordQuery.all_vars.include?(value) 31 | raise "Invalid ENUM value #{value} for class #ExactOnSingleWordQuery" 32 | end 33 | end 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /lib/algolia/models/ingestion/run_status.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Ingestion 10 | class RunStatus 11 | CREATED = "created".freeze 12 | STARTED = "started".freeze 13 | FINISHED = "finished".freeze 14 | SKIPPED = "skipped".freeze 15 | 16 | def self.all_vars 17 | @all_vars ||= [CREATED, STARTED, FINISHED, SKIPPED].freeze 18 | end 19 | 20 | # Builds the enum from string 21 | # @param [String] The enum value in the form of the string 22 | # @return [String] The enum value 23 | def self.build_from_hash(value) 24 | new.build_from_hash(value) 25 | end 26 | 27 | # Builds the enum from string 28 | # @param [String] The enum value in the form of the string 29 | # @return [String] The enum value 30 | def build_from_hash(value) 31 | return value if RunStatus.all_vars.include?(value) 32 | raise "Invalid ENUM value #{value} for class #RunStatus" 33 | end 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /lib/algolia/models/recommend/typo_tolerance_enum.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Recommend 10 | class TypoToleranceEnum 11 | MIN = "min".freeze 12 | STRICT = "strict".freeze 13 | TRUE = "true".freeze 14 | FALSE = "false".freeze 15 | 16 | def self.all_vars 17 | @all_vars ||= [MIN, STRICT, TRUE, FALSE].freeze 18 | end 19 | 20 | # Builds the enum from string 21 | # @param [String] The enum value in the form of the string 22 | # @return [String] The enum value 23 | def self.build_from_hash(value) 24 | new.build_from_hash(value) 25 | end 26 | 27 | # Builds the enum from string 28 | # @param [String] The enum value in the form of the string 29 | # @return [String] The enum value 30 | def build_from_hash(value) 31 | return value if TypoToleranceEnum.all_vars.include?(value) 32 | raise "Invalid ENUM value #{value} for class #TypoToleranceEnum" 33 | end 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /lib/algolia/error.rb: -------------------------------------------------------------------------------- 1 | module Algolia 2 | # Base exception class for errors thrown by the Algolia 3 | # client library. AlgoliaError will be raised by any 4 | # network operation if Algolia.init() has not been called. 5 | # Exception ... why? A:http://www.skorks.com/2009/09/ruby-exceptions-and-exception-handling/ 6 | # 7 | class AlgoliaError < StandardError 8 | end 9 | 10 | # Used when hosts are unreachable 11 | # 12 | class AlgoliaUnreachableHostError < AlgoliaError 13 | attr_reader :errors 14 | 15 | def initialize(message, errors = []) 16 | errors.last&.tap do |last_error| 17 | message += " Last error for #{last_error[:host]}: #{last_error[:error]}" 18 | end 19 | 20 | super(message) 21 | @errors = errors 22 | end 23 | end 24 | 25 | # An exception class raised when the REST API returns an error. 26 | # The error code and message will be parsed out of the HTTP response, 27 | # which is also included in the response attribute. 28 | # 29 | class AlgoliaHttpError < AlgoliaError 30 | attr_accessor :code, :http_message 31 | 32 | def initialize(code, message) 33 | self.code = code 34 | self.http_message = message 35 | super("#{code}: #{message}") 36 | end 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /lib/algolia/models/composition/anchoring.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Composition 10 | class Anchoring 11 | IS = "is".freeze 12 | STARTS_WITH = "startsWith".freeze 13 | ENDS_WITH = "endsWith".freeze 14 | CONTAINS = "contains".freeze 15 | 16 | def self.all_vars 17 | @all_vars ||= [IS, STARTS_WITH, ENDS_WITH, CONTAINS].freeze 18 | end 19 | 20 | # Builds the enum from string 21 | # @param [String] The enum value in the form of the string 22 | # @return [String] The enum value 23 | def self.build_from_hash(value) 24 | new.build_from_hash(value) 25 | end 26 | 27 | # Builds the enum from string 28 | # @param [String] The enum value in the form of the string 29 | # @return [String] The enum value 30 | def build_from_hash(value) 31 | return value if Anchoring.all_vars.include?(value) 32 | raise "Invalid ENUM value #{value} for class #Anchoring" 33 | end 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /lib/algolia/models/composition/typo_tolerance_enum.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Composition 10 | class TypoToleranceEnum 11 | MIN = "min".freeze 12 | STRICT = "strict".freeze 13 | TRUE = "true".freeze 14 | FALSE = "false".freeze 15 | 16 | def self.all_vars 17 | @all_vars ||= [MIN, STRICT, TRUE, FALSE].freeze 18 | end 19 | 20 | # Builds the enum from string 21 | # @param [String] The enum value in the form of the string 22 | # @return [String] The enum value 23 | def self.build_from_hash(value) 24 | new.build_from_hash(value) 25 | end 26 | 27 | # Builds the enum from string 28 | # @param [String] The enum value in the form of the string 29 | # @return [String] The enum value 30 | def build_from_hash(value) 31 | return value if TypoToleranceEnum.all_vars.include?(value) 32 | raise "Invalid ENUM value #{value} for class #TypoToleranceEnum" 33 | end 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /lib/algolia/models/ingestion/transformation_sort_keys.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Ingestion 10 | class TransformationSortKeys 11 | NAME = "name".freeze 12 | UPDATED_AT = "updatedAt".freeze 13 | CREATED_AT = "createdAt".freeze 14 | 15 | def self.all_vars 16 | @all_vars ||= [NAME, UPDATED_AT, CREATED_AT].freeze 17 | end 18 | 19 | # Builds the enum from string 20 | # @param [String] The enum value in the form of the string 21 | # @return [String] The enum value 22 | def self.build_from_hash(value) 23 | new.build_from_hash(value) 24 | end 25 | 26 | # Builds the enum from string 27 | # @param [String] The enum value in the form of the string 28 | # @return [String] The enum value 29 | def build_from_hash(value) 30 | return value if TransformationSortKeys.all_vars.include?(value) 31 | raise "Invalid ENUM value #{value} for class #TransformationSortKeys" 32 | end 33 | end 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /lib/algolia/models/ingestion/source_sort_keys.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Ingestion 10 | class SourceSortKeys 11 | NAME = "name".freeze 12 | TYPE = "type".freeze 13 | UPDATED_AT = "updatedAt".freeze 14 | CREATED_AT = "createdAt".freeze 15 | 16 | def self.all_vars 17 | @all_vars ||= [NAME, TYPE, UPDATED_AT, CREATED_AT].freeze 18 | end 19 | 20 | # Builds the enum from string 21 | # @param [String] The enum value in the form of the string 22 | # @return [String] The enum value 23 | def self.build_from_hash(value) 24 | new.build_from_hash(value) 25 | end 26 | 27 | # Builds the enum from string 28 | # @param [String] The enum value in the form of the string 29 | # @return [String] The enum value 30 | def build_from_hash(value) 31 | return value if SourceSortKeys.all_vars.include?(value) 32 | raise "Invalid ENUM value #{value} for class #SourceSortKeys" 33 | end 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /lib/algolia/models/ingestion/run_type.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Ingestion 10 | class RunType 11 | REINDEX = "reindex".freeze 12 | UPDATE = "update".freeze 13 | DISCOVER = "discover".freeze 14 | VALIDATE = "validate".freeze 15 | PUSH = "push".freeze 16 | 17 | def self.all_vars 18 | @all_vars ||= [REINDEX, UPDATE, DISCOVER, VALIDATE, PUSH].freeze 19 | end 20 | 21 | # Builds the enum from string 22 | # @param [String] The enum value in the form of the string 23 | # @return [String] The enum value 24 | def self.build_from_hash(value) 25 | new.build_from_hash(value) 26 | end 27 | 28 | # Builds the enum from string 29 | # @param [String] The enum value in the form of the string 30 | # @return [String] The enum value 31 | def build_from_hash(value) 32 | return value if RunType.all_vars.include?(value) 33 | raise "Invalid ENUM value #{value} for class #RunType" 34 | end 35 | end 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /lib/algolia/models/ingestion/destination_sort_keys.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Ingestion 10 | class DestinationSortKeys 11 | NAME = "name".freeze 12 | TYPE = "type".freeze 13 | UPDATED_AT = "updatedAt".freeze 14 | CREATED_AT = "createdAt".freeze 15 | 16 | def self.all_vars 17 | @all_vars ||= [NAME, TYPE, UPDATED_AT, CREATED_AT].freeze 18 | end 19 | 20 | # Builds the enum from string 21 | # @param [String] The enum value in the form of the string 22 | # @return [String] The enum value 23 | def self.build_from_hash(value) 24 | new.build_from_hash(value) 25 | end 26 | 27 | # Builds the enum from string 28 | # @param [String] The enum value in the form of the string 29 | # @return [String] The enum value 30 | def build_from_hash(value) 31 | return value if DestinationSortKeys.all_vars.include?(value) 32 | raise "Invalid ENUM value #{value} for class #DestinationSortKeys" 33 | end 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /lib/algolia/models/ingestion/trigger_type.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Ingestion 10 | class TriggerType 11 | ON_DEMAND = "onDemand".freeze 12 | SCHEDULE = "schedule".freeze 13 | SUBSCRIPTION = "subscription".freeze 14 | STREAMING = "streaming".freeze 15 | 16 | def self.all_vars 17 | @all_vars ||= [ON_DEMAND, SCHEDULE, SUBSCRIPTION, STREAMING].freeze 18 | end 19 | 20 | # Builds the enum from string 21 | # @param [String] The enum value in the form of the string 22 | # @return [String] The enum value 23 | def self.build_from_hash(value) 24 | new.build_from_hash(value) 25 | end 26 | 27 | # Builds the enum from string 28 | # @param [String] The enum value in the form of the string 29 | # @return [String] The enum value 30 | def build_from_hash(value) 31 | return value if TriggerType.all_vars.include?(value) 32 | raise "Invalid ENUM value #{value} for class #TriggerType" 33 | end 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /lib/algolia/models/ingestion/mapping_type_csv.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Ingestion 10 | class MappingTypeCSV 11 | STRING = "string".freeze 12 | INTEGER = "integer".freeze 13 | FLOAT = "float".freeze 14 | BOOLEAN = "boolean".freeze 15 | JSON = "json".freeze 16 | 17 | def self.all_vars 18 | @all_vars ||= [STRING, INTEGER, FLOAT, BOOLEAN, JSON].freeze 19 | end 20 | 21 | # Builds the enum from string 22 | # @param [String] The enum value in the form of the string 23 | # @return [String] The enum value 24 | def self.build_from_hash(value) 25 | new.build_from_hash(value) 26 | end 27 | 28 | # Builds the enum from string 29 | # @param [String] The enum value in the form of the string 30 | # @return [String] The enum value 31 | def build_from_hash(value) 32 | return value if MappingTypeCSV.all_vars.include?(value) 33 | raise "Invalid ENUM value #{value} for class #MappingTypeCSV" 34 | end 35 | end 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /lib/algolia/models/ingestion/action_type.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Ingestion 10 | class ActionType 11 | REPLACE = "replace".freeze 12 | SAVE = "save".freeze 13 | PARTIAL = "partial".freeze 14 | PARTIAL_NO_CREATE = "partialNoCreate".freeze 15 | APPEND = "append".freeze 16 | 17 | def self.all_vars 18 | @all_vars ||= [REPLACE, SAVE, PARTIAL, PARTIAL_NO_CREATE, APPEND].freeze 19 | end 20 | 21 | # Builds the enum from string 22 | # @param [String] The enum value in the form of the string 23 | # @return [String] The enum value 24 | def self.build_from_hash(value) 25 | new.build_from_hash(value) 26 | end 27 | 28 | # Builds the enum from string 29 | # @param [String] The enum value in the form of the string 30 | # @return [String] The enum value 31 | def build_from_hash(value) 32 | return value if ActionType.all_vars.include?(value) 33 | raise "Invalid ENUM value #{value} for class #ActionType" 34 | end 35 | end 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /lib/algolia/models/search/remove_words_if_no_results.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Search 10 | class RemoveWordsIfNoResults 11 | NONE = "none".freeze 12 | LAST_WORDS = "lastWords".freeze 13 | FIRST_WORDS = "firstWords".freeze 14 | ALL_OPTIONAL = "allOptional".freeze 15 | 16 | def self.all_vars 17 | @all_vars ||= [NONE, LAST_WORDS, FIRST_WORDS, ALL_OPTIONAL].freeze 18 | end 19 | 20 | # Builds the enum from string 21 | # @param [String] The enum value in the form of the string 22 | # @return [String] The enum value 23 | def self.build_from_hash(value) 24 | new.build_from_hash(value) 25 | end 26 | 27 | # Builds the enum from string 28 | # @param [String] The enum value in the form of the string 29 | # @return [String] The enum value 30 | def build_from_hash(value) 31 | return value if RemoveWordsIfNoResults.all_vars.include?(value) 32 | raise "Invalid ENUM value #{value} for class #RemoveWordsIfNoResults" 33 | end 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /lib/algolia/models/monitoring/status.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Monitoring 10 | class Status 11 | OPERATIONAL = "operational".freeze 12 | DEGRADED_PERFORMANCE = "degraded_performance".freeze 13 | PARTIAL_OUTAGE = "partial_outage".freeze 14 | MAJOR_OUTAGE = "major_outage".freeze 15 | 16 | def self.all_vars 17 | @all_vars ||= [OPERATIONAL, DEGRADED_PERFORMANCE, PARTIAL_OUTAGE, MAJOR_OUTAGE].freeze 18 | end 19 | 20 | # Builds the enum from string 21 | # @param [String] The enum value in the form of the string 22 | # @return [String] The enum value 23 | def self.build_from_hash(value) 24 | new.build_from_hash(value) 25 | end 26 | 27 | # Builds the enum from string 28 | # @param [String] The enum value in the form of the string 29 | # @return [String] The enum value 30 | def build_from_hash(value) 31 | return value if Status.all_vars.include?(value) 32 | raise "Invalid ENUM value #{value} for class #Status" 33 | end 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /lib/algolia/models/recommend/remove_words_if_no_results.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Recommend 10 | class RemoveWordsIfNoResults 11 | NONE = "none".freeze 12 | LAST_WORDS = "lastWords".freeze 13 | FIRST_WORDS = "firstWords".freeze 14 | ALL_OPTIONAL = "allOptional".freeze 15 | 16 | def self.all_vars 17 | @all_vars ||= [NONE, LAST_WORDS, FIRST_WORDS, ALL_OPTIONAL].freeze 18 | end 19 | 20 | # Builds the enum from string 21 | # @param [String] The enum value in the form of the string 22 | # @return [String] The enum value 23 | def self.build_from_hash(value) 24 | new.build_from_hash(value) 25 | end 26 | 27 | # Builds the enum from string 28 | # @param [String] The enum value in the form of the string 29 | # @return [String] The enum value 30 | def build_from_hash(value) 31 | return value if RemoveWordsIfNoResults.all_vars.include?(value) 32 | raise "Invalid ENUM value #{value} for class #RemoveWordsIfNoResults" 33 | end 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /lib/algolia/models/composition/remove_words_if_no_results.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Composition 10 | class RemoveWordsIfNoResults 11 | NONE = "none".freeze 12 | LAST_WORDS = "lastWords".freeze 13 | FIRST_WORDS = "firstWords".freeze 14 | ALL_OPTIONAL = "allOptional".freeze 15 | 16 | def self.all_vars 17 | @all_vars ||= [NONE, LAST_WORDS, FIRST_WORDS, ALL_OPTIONAL].freeze 18 | end 19 | 20 | # Builds the enum from string 21 | # @param [String] The enum value in the form of the string 22 | # @return [String] The enum value 23 | def self.build_from_hash(value) 24 | new.build_from_hash(value) 25 | end 26 | 27 | # Builds the enum from string 28 | # @param [String] The enum value in the form of the string 29 | # @return [String] The enum value 30 | def build_from_hash(value) 31 | return value if RemoveWordsIfNoResults.all_vars.include?(value) 32 | raise "Invalid ENUM value #{value} for class #RemoveWordsIfNoResults" 33 | end 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /lib/algolia/models/ingestion/task_sort_keys.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Ingestion 10 | class TaskSortKeys 11 | ENABLED = "enabled".freeze 12 | TRIGGER_TYPE = "triggerType".freeze 13 | ACTION = "action".freeze 14 | UPDATED_AT = "updatedAt".freeze 15 | CREATED_AT = "createdAt".freeze 16 | 17 | def self.all_vars 18 | @all_vars ||= [ENABLED, TRIGGER_TYPE, ACTION, UPDATED_AT, CREATED_AT].freeze 19 | end 20 | 21 | # Builds the enum from string 22 | # @param [String] The enum value in the form of the string 23 | # @return [String] The enum value 24 | def self.build_from_hash(value) 25 | new.build_from_hash(value) 26 | end 27 | 28 | # Builds the enum from string 29 | # @param [String] The enum value in the form of the string 30 | # @return [String] The enum value 31 | def build_from_hash(value) 32 | return value if TaskSortKeys.all_vars.include?(value) 33 | raise "Invalid ENUM value #{value} for class #TaskSortKeys" 34 | end 35 | end 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /lib/algolia/models/analytics/order_by.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Analytics 10 | class OrderBy 11 | SEARCH_COUNT = "searchCount".freeze 12 | CLICK_THROUGH_RATE = "clickThroughRate".freeze 13 | CONVERSION_RATE = "conversionRate".freeze 14 | AVERAGE_CLICK_POSITION = "averageClickPosition".freeze 15 | 16 | def self.all_vars 17 | @all_vars ||= [SEARCH_COUNT, CLICK_THROUGH_RATE, CONVERSION_RATE, AVERAGE_CLICK_POSITION].freeze 18 | end 19 | 20 | # Builds the enum from string 21 | # @param [String] The enum value in the form of the string 22 | # @return [String] The enum value 23 | def self.build_from_hash(value) 24 | new.build_from_hash(value) 25 | end 26 | 27 | # Builds the enum from string 28 | # @param [String] The enum value in the form of the string 29 | # @return [String] The enum value 30 | def build_from_hash(value) 31 | return value if OrderBy.all_vars.include?(value) 32 | raise "Invalid ENUM value #{value} for class #OrderBy" 33 | end 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /lib/algolia/models/ingestion/authentication_sort_keys.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Ingestion 10 | class AuthenticationSortKeys 11 | NAME = "name".freeze 12 | TYPE = "type".freeze 13 | PLATFORM = "platform".freeze 14 | UPDATED_AT = "updatedAt".freeze 15 | CREATED_AT = "createdAt".freeze 16 | 17 | def self.all_vars 18 | @all_vars ||= [NAME, TYPE, PLATFORM, UPDATED_AT, CREATED_AT].freeze 19 | end 20 | 21 | # Builds the enum from string 22 | # @param [String] The enum value in the form of the string 23 | # @return [String] The enum value 24 | def self.build_from_hash(value) 25 | new.build_from_hash(value) 26 | end 27 | 28 | # Builds the enum from string 29 | # @param [String] The enum value in the form of the string 30 | # @return [String] The enum value 31 | def build_from_hash(value) 32 | return value if AuthenticationSortKeys.all_vars.include?(value) 33 | raise "Invalid ENUM value #{value} for class #AuthenticationSortKeys" 34 | end 35 | end 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /lib/algolia/models/search/event_status.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Search 10 | class EventStatus 11 | CREATED = "created".freeze 12 | STARTED = "started".freeze 13 | RETRIED = "retried".freeze 14 | FAILED = "failed".freeze 15 | SUCCEEDED = "succeeded".freeze 16 | CRITICAL = "critical".freeze 17 | 18 | def self.all_vars 19 | @all_vars ||= [CREATED, STARTED, RETRIED, FAILED, SUCCEEDED, CRITICAL].freeze 20 | end 21 | 22 | # Builds the enum from string 23 | # @param [String] The enum value in the form of the string 24 | # @return [String] The enum value 25 | def self.build_from_hash(value) 26 | new.build_from_hash(value) 27 | end 28 | 29 | # Builds the enum from string 30 | # @param [String] The enum value in the form of the string 31 | # @return [String] The enum value 32 | def build_from_hash(value) 33 | return value if EventStatus.all_vars.include?(value) 34 | raise "Invalid ENUM value #{value} for class #EventStatus" 35 | end 36 | end 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /lib/algolia/models/abtesting/effect_metric.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Abtesting 10 | class EffectMetric 11 | ADD_TO_CART_RATE = "addToCartRate".freeze 12 | CLICK_THROUGH_RATE = "clickThroughRate".freeze 13 | CONVERSION_RATE = "conversionRate".freeze 14 | PURCHASE_RATE = "purchaseRate".freeze 15 | 16 | def self.all_vars 17 | @all_vars ||= [ADD_TO_CART_RATE, CLICK_THROUGH_RATE, CONVERSION_RATE, PURCHASE_RATE].freeze 18 | end 19 | 20 | # Builds the enum from string 21 | # @param [String] The enum value in the form of the string 22 | # @return [String] The enum value 23 | def self.build_from_hash(value) 24 | new.build_from_hash(value) 25 | end 26 | 27 | # Builds the enum from string 28 | # @param [String] The enum value in the form of the string 29 | # @return [String] The enum value 30 | def build_from_hash(value) 31 | return value if EffectMetric.all_vars.include?(value) 32 | raise "Invalid ENUM value #{value} for class #EffectMetric" 33 | end 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /lib/algolia/models/ingestion/event_status.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Ingestion 10 | class EventStatus 11 | CREATED = "created".freeze 12 | STARTED = "started".freeze 13 | RETRIED = "retried".freeze 14 | FAILED = "failed".freeze 15 | SUCCEEDED = "succeeded".freeze 16 | CRITICAL = "critical".freeze 17 | 18 | def self.all_vars 19 | @all_vars ||= [CREATED, STARTED, RETRIED, FAILED, SUCCEEDED, CRITICAL].freeze 20 | end 21 | 22 | # Builds the enum from string 23 | # @param [String] The enum value in the form of the string 24 | # @return [String] The enum value 25 | def self.build_from_hash(value) 26 | new.build_from_hash(value) 27 | end 28 | 29 | # Builds the enum from string 30 | # @param [String] The enum value in the form of the string 31 | # @return [String] The enum value 32 | def build_from_hash(value) 33 | return value if EventStatus.all_vars.include?(value) 34 | raise "Invalid ENUM value #{value} for class #EventStatus" 35 | end 36 | end 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /algolia.gemspec: -------------------------------------------------------------------------------- 1 | require 'English' 2 | lib = File.expand_path('lib', __dir__) 3 | $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) 4 | require 'algolia/version' 5 | require 'date' 6 | 7 | Gem::Specification.new do |s| 8 | s.name = 'algolia' 9 | s.version = Algolia::VERSION 10 | s.platform = Gem::Platform::RUBY 11 | s.authors = ['https://alg.li/support'] 12 | s.homepage = 'https://github.com/algolia/algoliasearch-client-ruby' 13 | s.summary = 'A simple Ruby client for the algolia.com REST API' 14 | s.description = 'A simple Ruby client for the algolia.com REST API' 15 | s.licenses = ['MIT'] 16 | 17 | s.metadata = { 18 | 'bug_tracker_uri' => 'https://github.com/algolia/algoliasearch-client-ruby/issues', 19 | 'source_code_uri' => 'https://github.com/algolia/algoliasearch-client-ruby', 20 | 'rubygems_mfa_required' => 'true' 21 | } 22 | 23 | s.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR) 24 | s.executables = [] 25 | s.require_paths = ['lib'] 26 | 27 | s.add_dependency 'faraday', '>= 1.0.1', '< 3.0' 28 | s.add_dependency 'faraday-net_http_persistent', ['>= 0.15', '< 3'] 29 | s.add_dependency 'base64', '>= 0.2.0', '< 1' 30 | 31 | s.add_dependency 'net-http-persistent' 32 | 33 | s.add_development_dependency 'bundler', '>= 2.4.10' 34 | s.add_development_dependency 'rake' 35 | end 36 | -------------------------------------------------------------------------------- /lib/algolia/models/recommend/recommend_models.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Recommend 10 | class RecommendModels 11 | RELATED_PRODUCTS = "related-products".freeze 12 | BOUGHT_TOGETHER = "bought-together".freeze 13 | TRENDING_FACETS = "trending-facets".freeze 14 | TRENDING_ITEMS = "trending-items".freeze 15 | 16 | def self.all_vars 17 | @all_vars ||= [RELATED_PRODUCTS, BOUGHT_TOGETHER, TRENDING_FACETS, TRENDING_ITEMS].freeze 18 | end 19 | 20 | # Builds the enum from string 21 | # @param [String] The enum value in the form of the string 22 | # @return [String] The enum value 23 | def self.build_from_hash(value) 24 | new.build_from_hash(value) 25 | end 26 | 27 | # Builds the enum from string 28 | # @param [String] The enum value in the form of the string 29 | # @return [String] The enum value 30 | def build_from_hash(value) 31 | return value if RecommendModels.all_vars.include?(value) 32 | raise "Invalid ENUM value #{value} for class #RecommendModels" 33 | end 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /lib/algolia/models/analytics/operator.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Analytics 10 | class Operator 11 | APPLY = ":".freeze 12 | LESS_THAN = "<".freeze 13 | LESS_EQUALS = "<=".freeze 14 | EQUALS = "=".freeze 15 | NOT_EQUALS = "!=".freeze 16 | GREATER_THAN = ">".freeze 17 | GREATER_EQUALS = ">=".freeze 18 | 19 | def self.all_vars 20 | @all_vars ||= [APPLY, LESS_THAN, LESS_EQUALS, EQUALS, NOT_EQUALS, GREATER_THAN, GREATER_EQUALS].freeze 21 | end 22 | 23 | # Builds the enum from string 24 | # @param [String] The enum value in the form of the string 25 | # @return [String] The enum value 26 | def self.build_from_hash(value) 27 | new.build_from_hash(value) 28 | end 29 | 30 | # Builds the enum from string 31 | # @param [String] The enum value in the form of the string 32 | # @return [String] The enum value 33 | def build_from_hash(value) 34 | return value if Operator.all_vars.include?(value) 35 | raise "Invalid ENUM value #{value} for class #Operator" 36 | end 37 | end 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /lib/algolia/models/search/alternatives_as_exact.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Search 10 | class AlternativesAsExact 11 | IGNORE_PLURALS = "ignorePlurals".freeze 12 | SINGLE_WORD_SYNONYM = "singleWordSynonym".freeze 13 | MULTI_WORDS_SYNONYM = "multiWordsSynonym".freeze 14 | IGNORE_CONJUGATIONS = "ignoreConjugations".freeze 15 | 16 | def self.all_vars 17 | @all_vars ||= [IGNORE_PLURALS, SINGLE_WORD_SYNONYM, MULTI_WORDS_SYNONYM, IGNORE_CONJUGATIONS].freeze 18 | end 19 | 20 | # Builds the enum from string 21 | # @param [String] The enum value in the form of the string 22 | # @return [String] The enum value 23 | def self.build_from_hash(value) 24 | new.build_from_hash(value) 25 | end 26 | 27 | # Builds the enum from string 28 | # @param [String] The enum value in the form of the string 29 | # @return [String] The enum value 30 | def build_from_hash(value) 31 | return value if AlternativesAsExact.all_vars.include?(value) 32 | raise "Invalid ENUM value #{value} for class #AlternativesAsExact" 33 | end 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /lib/algolia/models/monitoring/metric.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Monitoring 10 | class Metric 11 | AVG_BUILD_TIME = "avg_build_time".freeze 12 | SSD_USAGE = "ssd_usage".freeze 13 | RAM_SEARCH_USAGE = "ram_search_usage".freeze 14 | RAM_INDEXING_USAGE = "ram_indexing_usage".freeze 15 | CPU_USAGE = "cpu_usage".freeze 16 | ALL = "*".freeze 17 | 18 | def self.all_vars 19 | @all_vars ||= [AVG_BUILD_TIME, SSD_USAGE, RAM_SEARCH_USAGE, RAM_INDEXING_USAGE, CPU_USAGE, ALL].freeze 20 | end 21 | 22 | # Builds the enum from string 23 | # @param [String] The enum value in the form of the string 24 | # @return [String] The enum value 25 | def self.build_from_hash(value) 26 | new.build_from_hash(value) 27 | end 28 | 29 | # Builds the enum from string 30 | # @param [String] The enum value in the form of the string 31 | # @return [String] The enum value 32 | def build_from_hash(value) 33 | return value if Metric.all_vars.include?(value) 34 | raise "Invalid ENUM value #{value} for class #Metric" 35 | end 36 | end 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /lib/algolia/models/recommend/alternatives_as_exact.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Recommend 10 | class AlternativesAsExact 11 | IGNORE_PLURALS = "ignorePlurals".freeze 12 | SINGLE_WORD_SYNONYM = "singleWordSynonym".freeze 13 | MULTI_WORDS_SYNONYM = "multiWordsSynonym".freeze 14 | IGNORE_CONJUGATIONS = "ignoreConjugations".freeze 15 | 16 | def self.all_vars 17 | @all_vars ||= [IGNORE_PLURALS, SINGLE_WORD_SYNONYM, MULTI_WORDS_SYNONYM, IGNORE_CONJUGATIONS].freeze 18 | end 19 | 20 | # Builds the enum from string 21 | # @param [String] The enum value in the form of the string 22 | # @return [String] The enum value 23 | def self.build_from_hash(value) 24 | new.build_from_hash(value) 25 | end 26 | 27 | # Builds the enum from string 28 | # @param [String] The enum value in the form of the string 29 | # @return [String] The enum value 30 | def build_from_hash(value) 31 | return value if AlternativesAsExact.all_vars.include?(value) 32 | raise "Invalid ENUM value #{value} for class #AlternativesAsExact" 33 | end 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /lib/algolia/transport/http/response.rb: -------------------------------------------------------------------------------- 1 | module Algolia 2 | module Http 3 | class Response 4 | attr_reader :status, :reason_phrase, :body, :error, :headers, :has_timed_out, :network_failure 5 | 6 | # used for the echo requester 7 | attr_reader :method, :path, :query_params, :host, :timeout, :connect_timeout 8 | 9 | # 10 | # @option status [String] Response status 11 | # @option reason_phrase [String] Response reason phrase 12 | # @option body [String] Response body 13 | # @option error [String] Response error or caught error 14 | # @option headers [String] Response headers 15 | # @option has_timed_out [String] If the request has timed out 16 | # 17 | def initialize(opts = {}) 18 | @status = opts[:status] 19 | @reason_phrase = opts[:reason_phrase] 20 | @body = opts[:body] 21 | @error = opts[:error] || "" 22 | @headers = opts[:headers] || "" 23 | @has_timed_out = opts[:has_timed_out] || false 24 | @network_failure = opts[:network_failure] || false 25 | 26 | @method = opts[:method] || "" 27 | @path = opts[:path] || "" 28 | @host = opts[:host] || "" 29 | @timeout = opts[:timeout] || 0 30 | @connect_timeout = opts[:connect_timeout] || 0 31 | @query_params = opts[:query_params] || {} 32 | end 33 | end 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /lib/algolia/models/composition/alternatives_as_exact.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Composition 10 | class AlternativesAsExact 11 | IGNORE_PLURALS = "ignorePlurals".freeze 12 | SINGLE_WORD_SYNONYM = "singleWordSynonym".freeze 13 | MULTI_WORDS_SYNONYM = "multiWordsSynonym".freeze 14 | IGNORE_CONJUGATIONS = "ignoreConjugations".freeze 15 | 16 | def self.all_vars 17 | @all_vars ||= [IGNORE_PLURALS, SINGLE_WORD_SYNONYM, MULTI_WORDS_SYNONYM, IGNORE_CONJUGATIONS].freeze 18 | end 19 | 20 | # Builds the enum from string 21 | # @param [String] The enum value in the form of the string 22 | # @return [String] The enum value 23 | def self.build_from_hash(value) 24 | new.build_from_hash(value) 25 | end 26 | 27 | # Builds the enum from string 28 | # @param [String] The enum value in the form of the string 29 | # @return [String] The enum value 30 | def build_from_hash(value) 31 | return value if AlternativesAsExact.all_vars.include?(value) 32 | raise "Invalid ENUM value #{value} for class #AlternativesAsExact" 33 | end 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /lib/algolia/models/abtesting-v3/effect_metric.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module AbtestingV3 10 | class EffectMetric 11 | ADD_TO_CART_RATE = "addToCartRate".freeze 12 | CLICK_THROUGH_RATE = "clickThroughRate".freeze 13 | CONVERSION_RATE = "conversionRate".freeze 14 | PURCHASE_RATE = "purchaseRate".freeze 15 | NO_RESULTS_RATE = "noResultsRate".freeze 16 | 17 | def self.all_vars 18 | @all_vars ||= [ADD_TO_CART_RATE, CLICK_THROUGH_RATE, CONVERSION_RATE, PURCHASE_RATE, NO_RESULTS_RATE].freeze 19 | end 20 | 21 | # Builds the enum from string 22 | # @param [String] The enum value in the form of the string 23 | # @return [String] The enum value 24 | def self.build_from_hash(value) 25 | new.build_from_hash(value) 26 | end 27 | 28 | # Builds the enum from string 29 | # @param [String] The enum value in the form of the string 30 | # @return [String] The enum value 31 | def build_from_hash(value) 32 | return value if EffectMetric.all_vars.include?(value) 33 | raise "Invalid ENUM value #{value} for class #EffectMetric" 34 | end 35 | end 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /lib/algolia/models/search/built_in_operation_type.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Search 10 | class BuiltInOperationType 11 | INCREMENT = "Increment".freeze 12 | DECREMENT = "Decrement".freeze 13 | ADD = "Add".freeze 14 | REMOVE = "Remove".freeze 15 | ADD_UNIQUE = "AddUnique".freeze 16 | INCREMENT_FROM = "IncrementFrom".freeze 17 | INCREMENT_SET = "IncrementSet".freeze 18 | 19 | def self.all_vars 20 | @all_vars ||= [INCREMENT, DECREMENT, ADD, REMOVE, ADD_UNIQUE, INCREMENT_FROM, INCREMENT_SET].freeze 21 | end 22 | 23 | # Builds the enum from string 24 | # @param [String] The enum value in the form of the string 25 | # @return [String] The enum value 26 | def self.build_from_hash(value) 27 | new.build_from_hash(value) 28 | end 29 | 30 | # Builds the enum from string 31 | # @param [String] The enum value in the form of the string 32 | # @return [String] The enum value 33 | def build_from_hash(value) 34 | return value if BuiltInOperationType.all_vars.include?(value) 35 | raise "Invalid ENUM value #{value} for class #BuiltInOperationType" 36 | end 37 | end 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /lib/algolia/models/ingestion/authentication_type.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Ingestion 10 | class AuthenticationType 11 | GOOGLE_SERVICE_ACCOUNT = "googleServiceAccount".freeze 12 | BASIC = "basic".freeze 13 | API_KEY = "apiKey".freeze 14 | OAUTH = "oauth".freeze 15 | ALGOLIA = "algolia".freeze 16 | ALGOLIA_INSIGHTS = "algoliaInsights".freeze 17 | SECRETS = "secrets".freeze 18 | 19 | def self.all_vars 20 | @all_vars ||= [GOOGLE_SERVICE_ACCOUNT, BASIC, API_KEY, OAUTH, ALGOLIA, ALGOLIA_INSIGHTS, SECRETS].freeze 21 | end 22 | 23 | # Builds the enum from string 24 | # @param [String] The enum value in the form of the string 25 | # @return [String] The enum value 26 | def self.build_from_hash(value) 27 | new.build_from_hash(value) 28 | end 29 | 30 | # Builds the enum from string 31 | # @param [String] The enum value in the form of the string 32 | # @return [String] The enum value 33 | def build_from_hash(value) 34 | return value if AuthenticationType.all_vars.include?(value) 35 | raise "Invalid ENUM value #{value} for class #AuthenticationType" 36 | end 37 | end 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /lib/algolia/api_error.rb: -------------------------------------------------------------------------------- 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 | module Algolia 4 | class ApiError < StandardError 5 | attr_reader :code, :response_headers, :response_body 6 | 7 | # Usage examples: 8 | # ApiError.new 9 | # ApiError.new("message") 10 | # ApiError.new(:code => 500, :response_headers => {}, :response_body => "") 11 | # ApiError.new(:code => 404, :message => "Not Found") 12 | def initialize(arg = nil) 13 | if arg.is_a?(Hash) 14 | if arg.key?(:message) || arg.key?("message") 15 | super(arg[:message] || arg["message"]) 16 | else 17 | super 18 | end 19 | 20 | arg.each do |k, v| 21 | instance_variable_set("@#{k}", v) 22 | end 23 | else 24 | super 25 | @message = arg 26 | end 27 | end 28 | 29 | # Override to_s to display a friendly error message 30 | def to_s 31 | message 32 | end 33 | 34 | def message 35 | msg = if @message.nil? 36 | "Error message: the server returns an error" 37 | else 38 | @message 39 | end 40 | 41 | msg += "\nHTTP status code: #{code}" if code 42 | msg += "\nResponse headers: #{response_headers}" if response_headers 43 | msg += "\nResponse body: #{response_body}" if response_body 44 | 45 | msg 46 | end 47 | end 48 | end 49 | -------------------------------------------------------------------------------- /lib/algolia/models/ingestion/source_type.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Ingestion 10 | class SourceType 11 | BIGCOMMERCE = "bigcommerce".freeze 12 | BIGQUERY = "bigquery".freeze 13 | COMMERCETOOLS = "commercetools".freeze 14 | CSV = "csv".freeze 15 | DOCKER = "docker".freeze 16 | GA4_BIGQUERY_EXPORT = "ga4BigqueryExport".freeze 17 | JSON = "json".freeze 18 | SHOPIFY = "shopify".freeze 19 | PUSH = "push".freeze 20 | 21 | def self.all_vars 22 | @all_vars ||= [BIGCOMMERCE, BIGQUERY, COMMERCETOOLS, CSV, DOCKER, GA4_BIGQUERY_EXPORT, JSON, SHOPIFY, PUSH].freeze 23 | end 24 | 25 | # Builds the enum from string 26 | # @param [String] The enum value in the form of the string 27 | # @return [String] The enum value 28 | def self.build_from_hash(value) 29 | new.build_from_hash(value) 30 | end 31 | 32 | # Builds the enum from string 33 | # @param [String] The enum value in the form of the string 34 | # @return [String] The enum value 35 | def build_from_hash(value) 36 | return value if SourceType.all_vars.include?(value) 37 | raise "Invalid ENUM value #{value} for class #SourceType" 38 | end 39 | end 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /lib/algolia/models/ingestion/run_reason_code.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Ingestion 10 | class RunReasonCode 11 | INTERNAL = "internal".freeze 12 | CANCELLED = "cancelled".freeze 13 | CRITICAL = "critical".freeze 14 | NO_EVENTS = "no_events".freeze 15 | TOO_MANY_ERRORS = "too_many_errors".freeze 16 | LACKING_EVENTS = "lacking_events".freeze 17 | OK = "ok".freeze 18 | BLOCKING = "blocking".freeze 19 | IDLE = "idle".freeze 20 | 21 | def self.all_vars 22 | @all_vars ||= [INTERNAL, CANCELLED, CRITICAL, NO_EVENTS, TOO_MANY_ERRORS, LACKING_EVENTS, OK, BLOCKING, IDLE].freeze 23 | end 24 | 25 | # Builds the enum from string 26 | # @param [String] The enum value in the form of the string 27 | # @return [String] The enum value 28 | def self.build_from_hash(value) 29 | new.build_from_hash(value) 30 | end 31 | 32 | # Builds the enum from string 33 | # @param [String] The enum value in the form of the string 34 | # @return [String] The enum value 35 | def build_from_hash(value) 36 | return value if RunReasonCode.all_vars.include?(value) 37 | raise "Invalid ENUM value #{value} for class #RunReasonCode" 38 | end 39 | end 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /lib/algolia/models/monitoring/region.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Monitoring 10 | class Region 11 | AU = "au".freeze 12 | BR = "br".freeze 13 | CA = "ca".freeze 14 | DE = "de".freeze 15 | EU = "eu".freeze 16 | HK = "hk".freeze 17 | IN = "in".freeze 18 | JP = "jp".freeze 19 | SG = "sg".freeze 20 | UAE = "uae".freeze 21 | UK = "uk".freeze 22 | USC = "usc".freeze 23 | USE = "use".freeze 24 | USW = "usw".freeze 25 | ZA = "za".freeze 26 | 27 | def self.all_vars 28 | @all_vars ||= [AU, BR, CA, DE, EU, HK, IN, JP, SG, UAE, UK, USC, USE, USW, ZA].freeze 29 | end 30 | 31 | # Builds the enum from string 32 | # @param [String] The enum value in the form of the string 33 | # @return [String] The enum value 34 | def self.build_from_hash(value) 35 | new.build_from_hash(value) 36 | end 37 | 38 | # Builds the enum from string 39 | # @param [String] The enum value in the form of the string 40 | # @return [String] The enum value 41 | def build_from_hash(value) 42 | return value if Region.all_vars.include?(value) 43 | raise "Invalid ENUM value #{value} for class #Region" 44 | end 45 | end 46 | end 47 | end 48 | -------------------------------------------------------------------------------- /lib/algolia/models/search/action.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Search 10 | class Action 11 | ADD_OBJECT = "addObject".freeze 12 | UPDATE_OBJECT = "updateObject".freeze 13 | PARTIAL_UPDATE_OBJECT = "partialUpdateObject".freeze 14 | PARTIAL_UPDATE_OBJECT_NO_CREATE = "partialUpdateObjectNoCreate".freeze 15 | DELETE_OBJECT = "deleteObject".freeze 16 | DELETE = "delete".freeze 17 | CLEAR = "clear".freeze 18 | 19 | def self.all_vars 20 | @all_vars ||= [ 21 | ADD_OBJECT, 22 | UPDATE_OBJECT, 23 | PARTIAL_UPDATE_OBJECT, 24 | PARTIAL_UPDATE_OBJECT_NO_CREATE, 25 | DELETE_OBJECT, 26 | DELETE, 27 | CLEAR 28 | ].freeze 29 | end 30 | 31 | # Builds the enum from string 32 | # @param [String] The enum value in the form of the string 33 | # @return [String] The enum value 34 | def self.build_from_hash(value) 35 | new.build_from_hash(value) 36 | end 37 | 38 | # Builds the enum from string 39 | # @param [String] The enum value in the form of the string 40 | # @return [String] The enum value 41 | def build_from_hash(value) 42 | return value if Action.all_vars.include?(value) 43 | raise "Invalid ENUM value #{value} for class #Action" 44 | end 45 | end 46 | end 47 | end 48 | -------------------------------------------------------------------------------- /lib/algolia/models/ingestion/action.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Ingestion 10 | class Action 11 | ADD_OBJECT = "addObject".freeze 12 | UPDATE_OBJECT = "updateObject".freeze 13 | PARTIAL_UPDATE_OBJECT = "partialUpdateObject".freeze 14 | PARTIAL_UPDATE_OBJECT_NO_CREATE = "partialUpdateObjectNoCreate".freeze 15 | DELETE_OBJECT = "deleteObject".freeze 16 | DELETE = "delete".freeze 17 | CLEAR = "clear".freeze 18 | 19 | def self.all_vars 20 | @all_vars ||= [ 21 | ADD_OBJECT, 22 | UPDATE_OBJECT, 23 | PARTIAL_UPDATE_OBJECT, 24 | PARTIAL_UPDATE_OBJECT_NO_CREATE, 25 | DELETE_OBJECT, 26 | DELETE, 27 | CLEAR 28 | ].freeze 29 | end 30 | 31 | # Builds the enum from string 32 | # @param [String] The enum value in the form of the string 33 | # @return [String] The enum value 34 | def self.build_from_hash(value) 35 | new.build_from_hash(value) 36 | end 37 | 38 | # Builds the enum from string 39 | # @param [String] The enum value in the form of the string 40 | # @return [String] The enum value 41 | def build_from_hash(value) 42 | return value if Action.all_vars.include?(value) 43 | raise "Invalid ENUM value #{value} for class #Action" 44 | end 45 | end 46 | end 47 | end 48 | -------------------------------------------------------------------------------- /lib/algolia/models/search/synonym_type.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Search 10 | class SynonymType 11 | SYNONYM = "synonym".freeze 12 | ONEWAYSYNONYM = "onewaysynonym".freeze 13 | ALTCORRECTION1 = "altcorrection1".freeze 14 | ALTCORRECTION2 = "altcorrection2".freeze 15 | PLACEHOLDER = "placeholder".freeze 16 | ONE_WAY_SYNONYM = "oneWaySynonym".freeze 17 | ALT_CORRECTION1 = "altCorrection1".freeze 18 | ALT_CORRECTION2 = "altCorrection2".freeze 19 | 20 | def self.all_vars 21 | @all_vars ||= [ 22 | SYNONYM, 23 | ONEWAYSYNONYM, 24 | ALTCORRECTION1, 25 | ALTCORRECTION2, 26 | PLACEHOLDER, 27 | ONE_WAY_SYNONYM, 28 | ALT_CORRECTION1, 29 | ALT_CORRECTION2 30 | ].freeze 31 | end 32 | 33 | # Builds the enum from string 34 | # @param [String] The enum value in the form of the string 35 | # @return [String] The enum value 36 | def self.build_from_hash(value) 37 | new.build_from_hash(value) 38 | end 39 | 40 | # Builds the enum from string 41 | # @param [String] The enum value in the form of the string 42 | # @return [String] The enum value 43 | def build_from_hash(value) 44 | return value if SynonymType.all_vars.include?(value) 45 | raise "Invalid ENUM value #{value} for class #SynonymType" 46 | end 47 | end 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /.github/workflows/issue.yml: -------------------------------------------------------------------------------- 1 | name: 'Issue sync with Jira' 2 | on: 3 | issues: 4 | types: [opened] 5 | 6 | permissions: 7 | issues: write 8 | contents: read 9 | 10 | jobs: 11 | sync: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Create ticket 15 | uses: actions/github-script@v8 16 | with: 17 | script: | 18 | const action = context.payload.action; 19 | if (action !== 'opened') { 20 | return; 21 | } 22 | const title = context.payload.issue.title; 23 | const body = context.payload.issue.body; 24 | 25 | const res = await fetch('https://algolia.atlassian.net/rest/api/2/issue', { 26 | method: 'POST', 27 | headers: { 28 | 'Accept': 'application/json', 29 | 'Content-Type': 'application/json', 30 | 'Authorization': `Basic ${{ secrets.JIRA_TOKEN }}` 31 | }, 32 | body: JSON.stringify({ 33 | fields: { 34 | description: `Issue created by ${context.actor} at ${context.payload.issue.html_url} \n\n${body}`, 35 | issuetype: { 36 | id: '10001' 37 | }, 38 | parent: { 39 | key: 'API-1' 40 | }, 41 | project: { 42 | id: '11316' 43 | }, 44 | summary: `[GH-ISSUE] ${title}` 45 | }, 46 | update: {} 47 | }) 48 | }); 49 | 50 | if (!res.ok) { 51 | throw new Error(`Failed to create ticket: ${res.statusText} (${res.status}) - ${await res.text()}`); 52 | } 53 | 54 | const data = await res.json(); 55 | console.log(`Created ticket: ${data.key}`); 56 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/Bug_report.yml: -------------------------------------------------------------------------------- 1 | name: Bug Report 2 | description: File a bug report. 3 | title: '[bug]: ' 4 | labels: ['bug', 'triage'] 5 | body: 6 | - type: markdown 7 | attributes: 8 | value: | 9 | ## Please help us help you! 10 | 11 | > [!IMPORTANT] 12 | > This repository is fully generated and all pull request will be rejected. 13 | > If you wish to contribute, please refer to the [contribution guidelines](https://github.com/algolia/api-clients-automation/blob/main/CONTRIBUTING.md) on the `api-clients-automation` repository. 14 | 15 | Before filing your issue, ask yourself: 16 | - Is there an issue already opened for this bug? 17 | - Can I reproduce it? 18 | 19 | If you are not sure about the origin of the issue, or if it impacts your customer experience, please contact [our support team](https://alg.li/support). 20 | - type: textarea 21 | attributes: 22 | label: Description 23 | description: A clear and concise description of what the bug is. 24 | validations: 25 | required: true 26 | - type: dropdown 27 | id: client 28 | attributes: 29 | label: Client 30 | description: Which API are you targeting? 31 | options: 32 | - All 33 | - AB testing 34 | - Analytics 35 | - Ingestion 36 | - Insights 37 | - Monitoring 38 | - Personalization 39 | - Query-Suggestions 40 | - Recommend 41 | - Search 42 | - Crawler 43 | validations: 44 | required: true 45 | - type: input 46 | id: version 47 | attributes: 48 | label: Version 49 | description: The version of the client you are using. 50 | validations: 51 | required: true 52 | - type: textarea 53 | id: logs 54 | attributes: 55 | label: Relevant log output 56 | description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. 57 | render: shell 58 | -------------------------------------------------------------------------------- /lib/algolia/configuration.rb: -------------------------------------------------------------------------------- 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 | module Algolia 4 | class Configuration 5 | attr_accessor( 6 | :hosts, 7 | :app_id, 8 | :api_key, 9 | :user_agent, 10 | :header_params, 11 | :read_timeout, 12 | :write_timeout, 13 | :connect_timeout, 14 | :compression_type, 15 | :requester 16 | ) 17 | 18 | # Set this to false to skip client side validation in the operation. 19 | # Default to true. 20 | # @return [true, false] 21 | attr_accessor :client_side_validation 22 | 23 | def initialize(app_id, api_key, hosts, client_name, opts = {}) 24 | @hosts = hosts 25 | @app_id = app_id 26 | @api_key = api_key 27 | @client_side_validation = opts[:client_side_validation].nil? ? true : opts[:client_side_validation] 28 | @connect_timeout = opts[:connect_timeout] 29 | @read_timeout = opts[:read_timeout] 30 | @write_timeout = opts[:write_timeout] 31 | @compression_type = opts[:compression_type] || "none" 32 | @requester = opts[:requester] 33 | 34 | @user_agent = UserAgent.new.add(client_name, VERSION) 35 | 36 | if opts[:user_agent_segments] 37 | opts[:user_agent_segments].each do |segment| 38 | @user_agent.add(segment) 39 | end 40 | end 41 | 42 | @header_params = { 43 | "X-Algolia-Application-Id" => app_id, 44 | "X-Algolia-API-Key" => api_key, 45 | "Content-Type" => "application/json", 46 | "User-Agent" => @user_agent.value 47 | } 48 | @header_params.transform_keys!(&:downcase) 49 | 50 | yield(self) if block_given? 51 | end 52 | 53 | def set_client_api_key(api_key) 54 | @api_key = api_key 55 | @header_params["X-Algolia-API-Key"] = api_key 56 | 57 | self 58 | end 59 | 60 | # The default Configuration object. 61 | def self.default 62 | @@default ||= Configuration.new 63 | end 64 | 65 | def add_user_agent_segment(segment, version = nil) 66 | @user_agent.add(segment, version) 67 | @header_params["user-agent"] = @user_agent.value 68 | 69 | self 70 | end 71 | end 72 | end 73 | -------------------------------------------------------------------------------- /lib/algolia/models/abtesting-v3/metric_name.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module AbtestingV3 10 | class MetricName 11 | SEARCH_COUNT = "search_count".freeze 12 | TRACKED_SEARCH_COUNT = "tracked_search_count".freeze 13 | USER_COUNT = "user_count".freeze 14 | TRACKED_USER_COUNT = "tracked_user_count".freeze 15 | NO_RESULT_COUNT = "no_result_count".freeze 16 | ADD_TO_CART_COUNT = "add_to_cart_count".freeze 17 | PURCHASE_COUNT = "purchase_count".freeze 18 | CLICKED_SEARCH_COUNT = "clicked_search_count".freeze 19 | CONVERTED_SEARCH_COUNT = "converted_search_count".freeze 20 | CLICK_THROUGH_RATE = "click_through_rate".freeze 21 | CONVERSION_RATE = "conversion_rate".freeze 22 | ADD_TO_CART_RATE = "add_to_cart_rate".freeze 23 | PURCHASE_RATE = "purchase_rate".freeze 24 | AVERAGE_CLICK_POSITION = "average_click_position".freeze 25 | REVENUE = "revenue".freeze 26 | 27 | def self.all_vars 28 | @all_vars ||= [ 29 | SEARCH_COUNT, 30 | TRACKED_SEARCH_COUNT, 31 | USER_COUNT, 32 | TRACKED_USER_COUNT, 33 | NO_RESULT_COUNT, 34 | ADD_TO_CART_COUNT, 35 | PURCHASE_COUNT, 36 | CLICKED_SEARCH_COUNT, 37 | CONVERTED_SEARCH_COUNT, 38 | CLICK_THROUGH_RATE, 39 | CONVERSION_RATE, 40 | ADD_TO_CART_RATE, 41 | PURCHASE_RATE, 42 | AVERAGE_CLICK_POSITION, 43 | REVENUE 44 | ].freeze 45 | end 46 | 47 | # Builds the enum from string 48 | # @param [String] The enum value in the form of the string 49 | # @return [String] The enum value 50 | def self.build_from_hash(value) 51 | new.build_from_hash(value) 52 | end 53 | 54 | # Builds the enum from string 55 | # @param [String] The enum value in the form of the string 56 | # @return [String] The enum value 57 | def build_from_hash(value) 58 | return value if MetricName.all_vars.include?(value) 59 | raise "Invalid ENUM value #{value} for class #MetricName" 60 | end 61 | end 62 | end 63 | end 64 | -------------------------------------------------------------------------------- /lib/algolia/transport/request_options.rb: -------------------------------------------------------------------------------- 1 | module Algolia 2 | module Transport 3 | class RequestOptions 4 | attr_accessor :header_params, :query_params, :data, :timeout, :connect_timeout, :compression_type 5 | 6 | # @param [Search::Config] config 7 | # 8 | def initialize(config) 9 | @header_params = {} 10 | @query_params = {} 11 | @timeout = nil 12 | @connect_timeout = nil 13 | @compression_type = config.compression_type 14 | end 15 | 16 | # Create and format headers and query params from request options 17 | # 18 | # @param opts [Hash] 19 | # 20 | def create(opts = {}) 21 | add_header_params(opts) 22 | add_query_params(opts) 23 | add_timeout(opts) 24 | add_connect_timeout(opts) 25 | add_compression_type(opts) 26 | end 27 | 28 | # Add or update header_params 29 | # 30 | # @param opts [Hash] 31 | # 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 37 | end 38 | 39 | opts.delete(:header_params) 40 | end 41 | 42 | # Add or update query parameters 43 | # 44 | # @param opts [Hash] 45 | # 46 | def add_query_params(opts = {}) 47 | return if opts[:query_params].nil? 48 | 49 | opts[:query_params].each do |opt, value| 50 | @query_params[opt.to_sym] = value 51 | end 52 | 53 | opts.delete(:query_params) 54 | end 55 | 56 | # Add or update timeout 57 | # 58 | # @param opts [Hash] 59 | # 60 | def add_timeout(opts = {}) 61 | @timeout = opts[:timeout] || @timeout 62 | opts.delete(:timeout) 63 | end 64 | 65 | # Add or update connect timeout 66 | # 67 | # @param opts [Hash] 68 | # 69 | def add_connect_timeout(opts = {}) 70 | @connect_timeout = opts[:connect_timeout] || @connect_timeout 71 | opts.delete(:connect_timeout) 72 | end 73 | 74 | # Add or update compression_type 75 | # 76 | # @param opts [Hash] 77 | # 78 | def add_compression_type(opts = {}) 79 | @compression_type = opts[:compression_type] || @compression_type 80 | opts.delete(:compression_type) 81 | end 82 | end 83 | end 84 | end 85 | -------------------------------------------------------------------------------- /lib/algolia/models/search/acl.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Search 10 | class Acl 11 | ADD_OBJECT = "addObject".freeze 12 | ANALYTICS = "analytics".freeze 13 | BROWSE = "browse".freeze 14 | DELETE_OBJECT = "deleteObject".freeze 15 | DELETE_INDEX = "deleteIndex".freeze 16 | EDIT_SETTINGS = "editSettings".freeze 17 | INFERENCE = "inference".freeze 18 | LIST_INDEXES = "listIndexes".freeze 19 | LOGS = "logs".freeze 20 | PERSONALIZATION = "personalization".freeze 21 | RECOMMENDATION = "recommendation".freeze 22 | SEARCH = "search".freeze 23 | SEE_UNRETRIEVABLE_ATTRIBUTES = "seeUnretrievableAttributes".freeze 24 | SETTINGS = "settings".freeze 25 | USAGE = "usage".freeze 26 | NLU_WRITE_PROJECT = "nluWriteProject".freeze 27 | NLU_READ_PROJECT = "nluReadProject".freeze 28 | NLU_WRITE_ENTITY = "nluWriteEntity".freeze 29 | NLU_READ_ENTITY = "nluReadEntity".freeze 30 | NLU_WRITE_INTENT = "nluWriteIntent".freeze 31 | NLU_READ_INTENT = "nluReadIntent".freeze 32 | NLU_PREDICTION = "nluPrediction".freeze 33 | NLU_READ_ANSWERS = "nluReadAnswers".freeze 34 | 35 | def self.all_vars 36 | @all_vars ||= [ 37 | ADD_OBJECT, 38 | ANALYTICS, 39 | BROWSE, 40 | DELETE_OBJECT, 41 | DELETE_INDEX, 42 | EDIT_SETTINGS, 43 | INFERENCE, 44 | LIST_INDEXES, 45 | LOGS, 46 | PERSONALIZATION, 47 | RECOMMENDATION, 48 | SEARCH, 49 | SEE_UNRETRIEVABLE_ATTRIBUTES, 50 | SETTINGS, 51 | USAGE, 52 | NLU_WRITE_PROJECT, 53 | NLU_READ_PROJECT, 54 | NLU_WRITE_ENTITY, 55 | NLU_READ_ENTITY, 56 | NLU_WRITE_INTENT, 57 | NLU_READ_INTENT, 58 | NLU_PREDICTION, 59 | NLU_READ_ANSWERS 60 | ].freeze 61 | end 62 | 63 | # Builds the enum from string 64 | # @param [String] The enum value in the form of the string 65 | # @return [String] The enum value 66 | def self.build_from_hash(value) 67 | new.build_from_hash(value) 68 | end 69 | 70 | # Builds the enum from string 71 | # @param [String] The enum value in the form of the string 72 | # @return [String] The enum value 73 | def build_from_hash(value) 74 | return value if Acl.all_vars.include?(value) 75 | raise "Invalid ENUM value #{value} for class #Acl" 76 | end 77 | end 78 | end 79 | end 80 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 | Algolia for Ruby 4 | 5 | 6 |

The perfect starting point to integrate Algolia within your Ruby project

7 | 8 |

9 | CircleCI 10 | Gem Version 11 | License 12 |

13 |

14 | 15 |

16 | Documentation • 17 | Rails • 18 | Community Forum • 19 | Stack Overflow • 20 | Report a bug • 21 | Support 22 |

23 | 24 | ## ✨ Features 25 | 26 | Thin & minimal low-level HTTP client to interact with Algolia's API 27 | 28 | ## 💡 Getting Started 29 | 30 | First, install Algolia Ruby API Client via the [RubyGems](https://rubygems.org/) package manager: 31 | ```bash 32 | gem install algolia 33 | ``` 34 | 35 | Then, create objects on your index: 36 | 37 | 38 | ```ruby 39 | client = Algolia::SearchClient.create('YourApplicationID', 'YourAPIKey') 40 | 41 | client.save_object('your_index_name', {objectID: 1, name: 'Foo'}) 42 | ``` 43 | 44 | Finally, you may begin searching a object using the `search` method: 45 | ```ruby 46 | objects = client.search_single_index('your_index_name', 'Foo') 47 | ``` 48 | 49 | For full documentation, visit the **[Algolia Ruby API Client](https://www.algolia.com/doc/libraries/sdk/install#ruby)**. 50 | 51 | ## ❓ Troubleshooting 52 | 53 | Encountering an issue? Before reaching out to support, we recommend heading to our [FAQ](https://support.algolia.com/hc/sections/15061037630609-API-Client-FAQs) where you will find answers for the most common issues and gotchas with the client. You can also open [a GitHub issue](https://github.com/algolia/api-clients-automation/issues/new?assignees=&labels=&projects=&template=Bug_report.md) 54 | 55 | ## Contributing 56 | 57 | This repository hosts the code of the generated Algolia API client for Ruby, if you'd like to contribute, head over to the [main repository](https://github.com/algolia/api-clients-automation). You can also find contributing guides on [our documentation website](https://api-clients-automation.netlify.app/docs/introduction). 58 | 59 | ## 📄 License 60 | 61 | The Algolia Ruby API Client is an open-sourced software licensed under the [MIT license](LICENSE). 62 | -------------------------------------------------------------------------------- /lib/algolia/transport/retry_strategy.rb: -------------------------------------------------------------------------------- 1 | module Algolia 2 | module Transport 3 | class RetryStrategy 4 | include RetryOutcomeType 5 | 6 | # @param hosts [StatefulHost] 7 | # 8 | def initialize(hosts) 9 | @hosts = hosts 10 | @lock = Mutex.new 11 | end 12 | 13 | # Retrieves the tryable hosts 14 | # 15 | # @param call_type [binary] type of the host 16 | # 17 | # @return [Array] list of StatefulHost 18 | # 19 | def get_tryable_hosts(call_type) 20 | @lock.synchronize do 21 | reset_expired_hosts 22 | 23 | if @hosts.any? { |host| host.up && flag?(host.accept, call_type) } 24 | @hosts.select { |host| host.up && flag?(host.accept, call_type) } 25 | else 26 | @hosts.each do |host| 27 | reset(host) if flag?(host.accept, call_type) 28 | end 29 | 30 | @hosts 31 | end 32 | end 33 | end 34 | 35 | # Decides on the outcome of the request 36 | # 37 | # @param tryable_host [StatefulHost] host to test against 38 | # @param http_response_code [Integer] http response code 39 | # @param is_timed_out [Boolean] whether or not the request timed out 40 | # 41 | # @return [Binary] retry outcome code 42 | # 43 | def decide(tryable_host, http_response_code: nil, is_timed_out: false, network_failure: false) 44 | @lock.synchronize do 45 | if !is_timed_out && success?(http_response_code) 46 | tryable_host.up = true 47 | tryable_host.last_use = Time.now.utc 48 | SUCCESS 49 | elsif !is_timed_out && retryable?(http_response_code, network_failure) 50 | tryable_host.up = false 51 | tryable_host.last_use = Time.now.utc 52 | RETRY 53 | elsif is_timed_out 54 | tryable_host.up = true 55 | tryable_host.last_use = Time.now.utc 56 | tryable_host.retry_count += 1 57 | RETRY 58 | else 59 | FAILURE 60 | end 61 | end 62 | end 63 | 64 | private 65 | 66 | # @param http_response_code [Integer] 67 | # 68 | # @return [Boolean] 69 | # 70 | def success?(http_response_code) 71 | !http_response_code.nil? && (http_response_code.to_i / 100).floor == 2 72 | end 73 | 74 | # @param http_response_code [Integer] 75 | # 76 | # @return [Boolean] 77 | # 78 | def retryable?(http_response_code, network_failure) 79 | return true if network_failure 80 | 81 | !http_response_code.nil? && (http_response_code.to_i / 100).floor != 2 && (http_response_code.to_i / 100).floor != 4 82 | end 83 | 84 | # Iterates in the hosts list and reset the ones that are down 85 | # 86 | def reset_expired_hosts 87 | @hosts.each do |host| 88 | host_last_usage = Time.now.utc - host.last_use 89 | reset(host) if !host.up && host_last_usage.to_i > Defaults::TTL 90 | end 91 | end 92 | 93 | # Reset a single host 94 | # 95 | # @param host [StatefulHost] 96 | # 97 | def reset(host) 98 | host.up = true 99 | host.retry_count = 0 100 | host.last_use = Time.now.utc 101 | end 102 | 103 | # Make a binary check to know whether the item contains the flag 104 | # 105 | # @param item [binary] item to check 106 | # @param flag [binary] flag to find in the item 107 | # 108 | # @return [Boolean] 109 | # 110 | def flag?(item, flag) 111 | (item & (1 << (flag - 1))).positive? 112 | end 113 | end 114 | end 115 | end 116 | -------------------------------------------------------------------------------- /lib/algolia/transport/http/http_requester.rb: -------------------------------------------------------------------------------- 1 | module Algolia 2 | module Http 3 | class HttpRequester 4 | attr_accessor :adapter, :logger 5 | 6 | # 7 | # @param adapter [Object] adapter used to make requests. Defaults to Net::Http 8 | # @param logger [Object] logger used to log requests. Defaults to Algolia::LoggerHelper 9 | # 10 | def initialize(adapter, logger) 11 | @adapter = adapter 12 | @logger = logger 13 | @connections = {} 14 | end 15 | 16 | # Sends request to the engine 17 | # 18 | # @param host [StatefulHost] 19 | # @param method [Symbol] 20 | # @param path [String] 21 | # @param body [JSON] 22 | # @param query_params [Hash] 23 | # @param headers [Hash] 24 | # 25 | # @return [Http::Response] 26 | # 27 | def send_request(host, method, path, body, query_params, headers, timeout, connect_timeout) 28 | connection = connection(host) 29 | connection.options.timeout = timeout / 1000 30 | connection.options.open_timeout = connect_timeout / 1000 31 | path += handle_query_params(query_params) 32 | 33 | @logger.info("Sending #{method.to_s.upcase} request to #{path} with body #{body}") if ENV["ALGOLIA_DEBUG"] 34 | 35 | response = connection.run_request(method, path, body, headers) 36 | 37 | if response.success? 38 | if ENV["ALGOLIA_DEBUG"] 39 | @logger.info("Request succeeded. Response status: #{response.status}, body: #{response.body}") 40 | end 41 | 42 | return Http::Response.new( 43 | status: response.status, 44 | reason_phrase: response.reason_phrase, 45 | body: response.body, 46 | headers: response.headers 47 | ) 48 | end 49 | 50 | if ENV["ALGOLIA_DEBUG"] 51 | @logger.info("Request failed. Response status: #{response.status}, error: #{response.body}") 52 | end 53 | 54 | Http::Response.new( 55 | status: response.status, 56 | reason_phrase: response.reason_phrase, 57 | error: response.body, 58 | headers: response.headers 59 | ) 60 | rescue Faraday::TimeoutError => e 61 | @logger.info("Request timed out. Error: #{e.message}") if ENV["ALGOLIA_DEBUG"] 62 | Http::Response.new(error: e.message, has_timed_out: true) 63 | rescue ::StandardError => e 64 | @logger.info("Request failed. Error: #{e.message}") if ENV["ALGOLIA_DEBUG"] 65 | Http::Response.new(error: e.message, network_failure: true) 66 | end 67 | 68 | # Retrieve the connection from the @connections 69 | # 70 | # @param host [StatefulHost] 71 | # 72 | # @return [Faraday::Connection] 73 | # 74 | def connection(host) 75 | url = build_url(host) 76 | @connections[url] ||= Faraday.new(url) do |f| 77 | f.adapter(@adapter.to_sym) 78 | end 79 | end 80 | 81 | # Build url from host, path and parameters 82 | # 83 | # @param host [StatefulHost] 84 | # 85 | # @return [String] 86 | # 87 | def build_url(host) 88 | host.protocol + host.url + (host.port.nil? ? "" : ":#{host.port}") 89 | end 90 | 91 | # Convert query_params to a full query string 92 | # 93 | def handle_query_params(query_params) 94 | query_params.nil? || query_params.empty? ? "" : "?#{to_query_string(query_params)}" 95 | end 96 | 97 | # Create a query string from query_params 98 | # 99 | def to_query_string(query_params) 100 | query_params 101 | .map do |key, value| 102 | "#{key}=#{value}" 103 | end 104 | .join("&") 105 | end 106 | end 107 | end 108 | end 109 | -------------------------------------------------------------------------------- /lib/algolia/models/search/supported_language.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Search 10 | class SupportedLanguage 11 | AF = "af".freeze 12 | AR = "ar".freeze 13 | AZ = "az".freeze 14 | BG = "bg".freeze 15 | BN = "bn".freeze 16 | CA = "ca".freeze 17 | CS = "cs".freeze 18 | CY = "cy".freeze 19 | DA = "da".freeze 20 | DE = "de".freeze 21 | EL = "el".freeze 22 | EN = "en".freeze 23 | EO = "eo".freeze 24 | ES = "es".freeze 25 | ET = "et".freeze 26 | EU = "eu".freeze 27 | FA = "fa".freeze 28 | FI = "fi".freeze 29 | FO = "fo".freeze 30 | FR = "fr".freeze 31 | GA = "ga".freeze 32 | GL = "gl".freeze 33 | HE = "he".freeze 34 | HI = "hi".freeze 35 | HU = "hu".freeze 36 | HY = "hy".freeze 37 | ID = "id".freeze 38 | IS = "is".freeze 39 | IT = "it".freeze 40 | JA = "ja".freeze 41 | KA = "ka".freeze 42 | KK = "kk".freeze 43 | KO = "ko".freeze 44 | KU = "ku".freeze 45 | KY = "ky".freeze 46 | LT = "lt".freeze 47 | LV = "lv".freeze 48 | MI = "mi".freeze 49 | MN = "mn".freeze 50 | MR = "mr".freeze 51 | MS = "ms".freeze 52 | MT = "mt".freeze 53 | NB = "nb".freeze 54 | NL = "nl".freeze 55 | NO = "no".freeze 56 | NS = "ns".freeze 57 | PL = "pl".freeze 58 | PS = "ps".freeze 59 | PT = "pt".freeze 60 | PT_BR = "pt-br".freeze 61 | QU = "qu".freeze 62 | RO = "ro".freeze 63 | RU = "ru".freeze 64 | SK = "sk".freeze 65 | SQ = "sq".freeze 66 | SV = "sv".freeze 67 | SW = "sw".freeze 68 | TA = "ta".freeze 69 | TE = "te".freeze 70 | TH = "th".freeze 71 | TL = "tl".freeze 72 | TN = "tn".freeze 73 | TR = "tr".freeze 74 | TT = "tt".freeze 75 | UK = "uk".freeze 76 | UR = "ur".freeze 77 | UZ = "uz".freeze 78 | ZH = "zh".freeze 79 | 80 | def self.all_vars 81 | @all_vars ||= [ 82 | AF, 83 | AR, 84 | AZ, 85 | BG, 86 | BN, 87 | CA, 88 | CS, 89 | CY, 90 | DA, 91 | DE, 92 | EL, 93 | EN, 94 | EO, 95 | ES, 96 | ET, 97 | EU, 98 | FA, 99 | FI, 100 | FO, 101 | FR, 102 | GA, 103 | GL, 104 | HE, 105 | HI, 106 | HU, 107 | HY, 108 | ID, 109 | IS, 110 | IT, 111 | JA, 112 | KA, 113 | KK, 114 | KO, 115 | KU, 116 | KY, 117 | LT, 118 | LV, 119 | MI, 120 | MN, 121 | MR, 122 | MS, 123 | MT, 124 | NB, 125 | NL, 126 | NO, 127 | NS, 128 | PL, 129 | PS, 130 | PT, 131 | PT_BR, 132 | QU, 133 | RO, 134 | RU, 135 | SK, 136 | SQ, 137 | SV, 138 | SW, 139 | TA, 140 | TE, 141 | TH, 142 | TL, 143 | TN, 144 | TR, 145 | TT, 146 | UK, 147 | UR, 148 | UZ, 149 | ZH 150 | ].freeze 151 | end 152 | 153 | # Builds the enum from string 154 | # @param [String] The enum value in the form of the string 155 | # @return [String] The enum value 156 | def self.build_from_hash(value) 157 | new.build_from_hash(value) 158 | end 159 | 160 | # Builds the enum from string 161 | # @param [String] The enum value in the form of the string 162 | # @return [String] The enum value 163 | def build_from_hash(value) 164 | return value if SupportedLanguage.all_vars.include?(value) 165 | raise "Invalid ENUM value #{value} for class #SupportedLanguage" 166 | end 167 | end 168 | end 169 | end 170 | -------------------------------------------------------------------------------- /lib/algolia/models/recommend/supported_language.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Recommend 10 | class SupportedLanguage 11 | AF = "af".freeze 12 | AR = "ar".freeze 13 | AZ = "az".freeze 14 | BG = "bg".freeze 15 | BN = "bn".freeze 16 | CA = "ca".freeze 17 | CS = "cs".freeze 18 | CY = "cy".freeze 19 | DA = "da".freeze 20 | DE = "de".freeze 21 | EL = "el".freeze 22 | EN = "en".freeze 23 | EO = "eo".freeze 24 | ES = "es".freeze 25 | ET = "et".freeze 26 | EU = "eu".freeze 27 | FA = "fa".freeze 28 | FI = "fi".freeze 29 | FO = "fo".freeze 30 | FR = "fr".freeze 31 | GA = "ga".freeze 32 | GL = "gl".freeze 33 | HE = "he".freeze 34 | HI = "hi".freeze 35 | HU = "hu".freeze 36 | HY = "hy".freeze 37 | ID = "id".freeze 38 | IS = "is".freeze 39 | IT = "it".freeze 40 | JA = "ja".freeze 41 | KA = "ka".freeze 42 | KK = "kk".freeze 43 | KO = "ko".freeze 44 | KU = "ku".freeze 45 | KY = "ky".freeze 46 | LT = "lt".freeze 47 | LV = "lv".freeze 48 | MI = "mi".freeze 49 | MN = "mn".freeze 50 | MR = "mr".freeze 51 | MS = "ms".freeze 52 | MT = "mt".freeze 53 | NB = "nb".freeze 54 | NL = "nl".freeze 55 | NO = "no".freeze 56 | NS = "ns".freeze 57 | PL = "pl".freeze 58 | PS = "ps".freeze 59 | PT = "pt".freeze 60 | PT_BR = "pt-br".freeze 61 | QU = "qu".freeze 62 | RO = "ro".freeze 63 | RU = "ru".freeze 64 | SK = "sk".freeze 65 | SQ = "sq".freeze 66 | SV = "sv".freeze 67 | SW = "sw".freeze 68 | TA = "ta".freeze 69 | TE = "te".freeze 70 | TH = "th".freeze 71 | TL = "tl".freeze 72 | TN = "tn".freeze 73 | TR = "tr".freeze 74 | TT = "tt".freeze 75 | UK = "uk".freeze 76 | UR = "ur".freeze 77 | UZ = "uz".freeze 78 | ZH = "zh".freeze 79 | 80 | def self.all_vars 81 | @all_vars ||= [ 82 | AF, 83 | AR, 84 | AZ, 85 | BG, 86 | BN, 87 | CA, 88 | CS, 89 | CY, 90 | DA, 91 | DE, 92 | EL, 93 | EN, 94 | EO, 95 | ES, 96 | ET, 97 | EU, 98 | FA, 99 | FI, 100 | FO, 101 | FR, 102 | GA, 103 | GL, 104 | HE, 105 | HI, 106 | HU, 107 | HY, 108 | ID, 109 | IS, 110 | IT, 111 | JA, 112 | KA, 113 | KK, 114 | KO, 115 | KU, 116 | KY, 117 | LT, 118 | LV, 119 | MI, 120 | MN, 121 | MR, 122 | MS, 123 | MT, 124 | NB, 125 | NL, 126 | NO, 127 | NS, 128 | PL, 129 | PS, 130 | PT, 131 | PT_BR, 132 | QU, 133 | RO, 134 | RU, 135 | SK, 136 | SQ, 137 | SV, 138 | SW, 139 | TA, 140 | TE, 141 | TH, 142 | TL, 143 | TN, 144 | TR, 145 | TT, 146 | UK, 147 | UR, 148 | UZ, 149 | ZH 150 | ].freeze 151 | end 152 | 153 | # Builds the enum from string 154 | # @param [String] The enum value in the form of the string 155 | # @return [String] The enum value 156 | def self.build_from_hash(value) 157 | new.build_from_hash(value) 158 | end 159 | 160 | # Builds the enum from string 161 | # @param [String] The enum value in the form of the string 162 | # @return [String] The enum value 163 | def build_from_hash(value) 164 | return value if SupportedLanguage.all_vars.include?(value) 165 | raise "Invalid ENUM value #{value} for class #SupportedLanguage" 166 | end 167 | end 168 | end 169 | end 170 | -------------------------------------------------------------------------------- /lib/algolia/models/composition/supported_language.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Composition 10 | class SupportedLanguage 11 | AF = "af".freeze 12 | AR = "ar".freeze 13 | AZ = "az".freeze 14 | BG = "bg".freeze 15 | BN = "bn".freeze 16 | CA = "ca".freeze 17 | CS = "cs".freeze 18 | CY = "cy".freeze 19 | DA = "da".freeze 20 | DE = "de".freeze 21 | EL = "el".freeze 22 | EN = "en".freeze 23 | EO = "eo".freeze 24 | ES = "es".freeze 25 | ET = "et".freeze 26 | EU = "eu".freeze 27 | FA = "fa".freeze 28 | FI = "fi".freeze 29 | FO = "fo".freeze 30 | FR = "fr".freeze 31 | GA = "ga".freeze 32 | GL = "gl".freeze 33 | HE = "he".freeze 34 | HI = "hi".freeze 35 | HU = "hu".freeze 36 | HY = "hy".freeze 37 | ID = "id".freeze 38 | IS = "is".freeze 39 | IT = "it".freeze 40 | JA = "ja".freeze 41 | KA = "ka".freeze 42 | KK = "kk".freeze 43 | KO = "ko".freeze 44 | KU = "ku".freeze 45 | KY = "ky".freeze 46 | LT = "lt".freeze 47 | LV = "lv".freeze 48 | MI = "mi".freeze 49 | MN = "mn".freeze 50 | MR = "mr".freeze 51 | MS = "ms".freeze 52 | MT = "mt".freeze 53 | NB = "nb".freeze 54 | NL = "nl".freeze 55 | NO = "no".freeze 56 | NS = "ns".freeze 57 | PL = "pl".freeze 58 | PS = "ps".freeze 59 | PT = "pt".freeze 60 | PT_BR = "pt-br".freeze 61 | QU = "qu".freeze 62 | RO = "ro".freeze 63 | RU = "ru".freeze 64 | SK = "sk".freeze 65 | SQ = "sq".freeze 66 | SV = "sv".freeze 67 | SW = "sw".freeze 68 | TA = "ta".freeze 69 | TE = "te".freeze 70 | TH = "th".freeze 71 | TL = "tl".freeze 72 | TN = "tn".freeze 73 | TR = "tr".freeze 74 | TT = "tt".freeze 75 | UK = "uk".freeze 76 | UR = "ur".freeze 77 | UZ = "uz".freeze 78 | ZH = "zh".freeze 79 | 80 | def self.all_vars 81 | @all_vars ||= [ 82 | AF, 83 | AR, 84 | AZ, 85 | BG, 86 | BN, 87 | CA, 88 | CS, 89 | CY, 90 | DA, 91 | DE, 92 | EL, 93 | EN, 94 | EO, 95 | ES, 96 | ET, 97 | EU, 98 | FA, 99 | FI, 100 | FO, 101 | FR, 102 | GA, 103 | GL, 104 | HE, 105 | HI, 106 | HU, 107 | HY, 108 | ID, 109 | IS, 110 | IT, 111 | JA, 112 | KA, 113 | KK, 114 | KO, 115 | KU, 116 | KY, 117 | LT, 118 | LV, 119 | MI, 120 | MN, 121 | MR, 122 | MS, 123 | MT, 124 | NB, 125 | NL, 126 | NO, 127 | NS, 128 | PL, 129 | PS, 130 | PT, 131 | PT_BR, 132 | QU, 133 | RO, 134 | RU, 135 | SK, 136 | SQ, 137 | SV, 138 | SW, 139 | TA, 140 | TE, 141 | TH, 142 | TL, 143 | TN, 144 | TR, 145 | TT, 146 | UK, 147 | UR, 148 | UZ, 149 | ZH 150 | ].freeze 151 | end 152 | 153 | # Builds the enum from string 154 | # @param [String] The enum value in the form of the string 155 | # @return [String] The enum value 156 | def self.build_from_hash(value) 157 | new.build_from_hash(value) 158 | end 159 | 160 | # Builds the enum from string 161 | # @param [String] The enum value in the form of the string 162 | # @return [String] The enum value 163 | def build_from_hash(value) 164 | return value if SupportedLanguage.all_vars.include?(value) 165 | raise "Invalid ENUM value #{value} for class #SupportedLanguage" 166 | end 167 | end 168 | end 169 | end 170 | -------------------------------------------------------------------------------- /lib/algolia/models/search/promote.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Search 10 | module Promote 11 | class << self 12 | # List of class defined in oneOf (OpenAPI v3) 13 | def openapi_one_of 14 | [ 15 | :"PromoteObjectID", 16 | :"PromoteObjectIDs" 17 | ] 18 | end 19 | 20 | # Builds the object 21 | # @param [Mixed] Data to be matched against the list of oneOf items 22 | # @return [Object] Returns the model or the data itself 23 | def build(data) 24 | # Go through the list of oneOf items and attempt to identify the appropriate one. 25 | # Note: 26 | # - We do not attempt to check whether exactly one item matches. 27 | # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) 28 | # due to the way the deserialization is made in the base_object template (it just casts without verifying). 29 | # - TODO: scalar values are de facto behaving as if they were nullable. 30 | # - TODO: logging when debugging is set. 31 | openapi_one_of.each do |klass| 32 | begin 33 | # "nullable: true" 34 | next if klass == :AnyType 35 | typed_data = find_and_cast_into_type(klass, data) 36 | return typed_data if typed_data 37 | # rescue all errors so we keep iterating even if the current item lookup raises 38 | rescue 39 | end 40 | end 41 | 42 | openapi_one_of.include?(:AnyType) ? data : nil 43 | end 44 | 45 | private 46 | 47 | SchemaMismatchError = Class.new(StandardError) 48 | 49 | def find_and_cast_into_type(klass, data) 50 | return if data.nil? 51 | 52 | case klass.to_s 53 | when "Boolean" 54 | return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) 55 | when "Float" 56 | return data if data.instance_of?(Float) 57 | when "Integer" 58 | return data if data.instance_of?(Integer) 59 | when "Time" 60 | return Time.parse(data) 61 | when "Date" 62 | return Date.parse(data) 63 | when "String" 64 | return data if data.instance_of?(String) 65 | # "type: object" 66 | when "Object" 67 | return data if data.instance_of?(Hash) 68 | # "type: array" 69 | when /\AArray<(?.+)>\z/ 70 | if data.instance_of?(Array) 71 | sub_type = Regexp.last_match[:sub_type] 72 | return data.map { |item| find_and_cast_into_type(sub_type, item) } 73 | end 74 | # "type: object" with "additionalProperties: { ... }" 75 | when /\AHash.+)>\z/ 76 | if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } 77 | sub_type = Regexp.last_match[:sub_type] 78 | return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } 79 | end 80 | # model 81 | else 82 | const = Algolia::Search.const_get(klass) 83 | if const 84 | if const.respond_to?(:openapi_one_of) 85 | # nested oneOf model 86 | model = const.build(data) 87 | elsif const.respond_to?(:discriminator_attributes) 88 | if const.discriminator_attributes.all? { |attr| data.key?(attr) } 89 | model = const.build_from_hash(data) 90 | end 91 | else 92 | # maybe it's an enum, or doens't have discriminators 93 | model = const.build_from_hash(data) 94 | end 95 | 96 | return model if model 97 | end 98 | end 99 | 100 | # if no match by now, raise 101 | raise 102 | rescue 103 | raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" 104 | end 105 | end 106 | end 107 | end 108 | end 109 | -------------------------------------------------------------------------------- /lib/algolia/models/search/search_query.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Search 10 | module SearchQuery 11 | class << self 12 | # List of class defined in oneOf (OpenAPI v3) 13 | def openapi_one_of 14 | [ 15 | :"SearchForFacets", 16 | :"SearchForHits" 17 | ] 18 | end 19 | 20 | # Builds the object 21 | # @param [Mixed] Data to be matched against the list of oneOf items 22 | # @return [Object] Returns the model or the data itself 23 | def build(data) 24 | # Go through the list of oneOf items and attempt to identify the appropriate one. 25 | # Note: 26 | # - We do not attempt to check whether exactly one item matches. 27 | # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) 28 | # due to the way the deserialization is made in the base_object template (it just casts without verifying). 29 | # - TODO: scalar values are de facto behaving as if they were nullable. 30 | # - TODO: logging when debugging is set. 31 | openapi_one_of.each do |klass| 32 | begin 33 | # "nullable: true" 34 | next if klass == :AnyType 35 | typed_data = find_and_cast_into_type(klass, data) 36 | return typed_data if typed_data 37 | # rescue all errors so we keep iterating even if the current item lookup raises 38 | rescue 39 | end 40 | end 41 | 42 | openapi_one_of.include?(:AnyType) ? data : nil 43 | end 44 | 45 | private 46 | 47 | SchemaMismatchError = Class.new(StandardError) 48 | 49 | def find_and_cast_into_type(klass, data) 50 | return if data.nil? 51 | 52 | case klass.to_s 53 | when "Boolean" 54 | return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) 55 | when "Float" 56 | return data if data.instance_of?(Float) 57 | when "Integer" 58 | return data if data.instance_of?(Integer) 59 | when "Time" 60 | return Time.parse(data) 61 | when "Date" 62 | return Date.parse(data) 63 | when "String" 64 | return data if data.instance_of?(String) 65 | # "type: object" 66 | when "Object" 67 | return data if data.instance_of?(Hash) 68 | # "type: array" 69 | when /\AArray<(?.+)>\z/ 70 | if data.instance_of?(Array) 71 | sub_type = Regexp.last_match[:sub_type] 72 | return data.map { |item| find_and_cast_into_type(sub_type, item) } 73 | end 74 | # "type: object" with "additionalProperties: { ... }" 75 | when /\AHash.+)>\z/ 76 | if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } 77 | sub_type = Regexp.last_match[:sub_type] 78 | return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } 79 | end 80 | # model 81 | else 82 | const = Algolia::Search.const_get(klass) 83 | if const 84 | if const.respond_to?(:openapi_one_of) 85 | # nested oneOf model 86 | model = const.build(data) 87 | elsif const.respond_to?(:discriminator_attributes) 88 | if const.discriminator_attributes.all? { |attr| data.key?(attr) } 89 | model = const.build_from_hash(data) 90 | end 91 | else 92 | # maybe it's an enum, or doens't have discriminators 93 | model = const.build_from_hash(data) 94 | end 95 | 96 | return model if model 97 | end 98 | end 99 | 100 | # if no match by now, raise 101 | raise 102 | rescue 103 | raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" 104 | end 105 | end 106 | end 107 | end 108 | end 109 | -------------------------------------------------------------------------------- /lib/algolia/models/search/attribute_to_update.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. 4 | 5 | require "date" 6 | require "time" 7 | 8 | module Algolia 9 | module Search 10 | module AttributeToUpdate 11 | class << self 12 | # List of class defined in oneOf (OpenAPI v3) 13 | def openapi_one_of 14 | [ 15 | :"BuiltInOperation", 16 | :"String" 17 | ] 18 | end 19 | 20 | # Builds the object 21 | # @param [Mixed] Data to be matched against the list of oneOf items 22 | # @return [Object] Returns the model or the data itself 23 | def build(data) 24 | # Go through the list of oneOf items and attempt to identify the appropriate one. 25 | # Note: 26 | # - We do not attempt to check whether exactly one item matches. 27 | # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) 28 | # due to the way the deserialization is made in the base_object template (it just casts without verifying). 29 | # - TODO: scalar values are de facto behaving as if they were nullable. 30 | # - TODO: logging when debugging is set. 31 | openapi_one_of.each do |klass| 32 | begin 33 | # "nullable: true" 34 | next if klass == :AnyType 35 | typed_data = find_and_cast_into_type(klass, data) 36 | return typed_data if typed_data 37 | # rescue all errors so we keep iterating even if the current item lookup raises 38 | rescue 39 | end 40 | end 41 | 42 | openapi_one_of.include?(:AnyType) ? data : nil 43 | end 44 | 45 | private 46 | 47 | SchemaMismatchError = Class.new(StandardError) 48 | 49 | def find_and_cast_into_type(klass, data) 50 | return if data.nil? 51 | 52 | case klass.to_s 53 | when "Boolean" 54 | return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) 55 | when "Float" 56 | return data if data.instance_of?(Float) 57 | when "Integer" 58 | return data if data.instance_of?(Integer) 59 | when "Time" 60 | return Time.parse(data) 61 | when "Date" 62 | return Date.parse(data) 63 | when "String" 64 | return data if data.instance_of?(String) 65 | # "type: object" 66 | when "Object" 67 | return data if data.instance_of?(Hash) 68 | # "type: array" 69 | when /\AArray<(?.+)>\z/ 70 | if data.instance_of?(Array) 71 | sub_type = Regexp.last_match[:sub_type] 72 | return data.map { |item| find_and_cast_into_type(sub_type, item) } 73 | end 74 | # "type: object" with "additionalProperties: { ... }" 75 | when /\AHash.+)>\z/ 76 | if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } 77 | sub_type = Regexp.last_match[:sub_type] 78 | return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } 79 | end 80 | # model 81 | else 82 | const = Algolia::Search.const_get(klass) 83 | if const 84 | if const.respond_to?(:openapi_one_of) 85 | # nested oneOf model 86 | model = const.build(data) 87 | elsif const.respond_to?(:discriminator_attributes) 88 | if const.discriminator_attributes.all? { |attr| data.key?(attr) } 89 | model = const.build_from_hash(data) 90 | end 91 | else 92 | # maybe it's an enum, or doens't have discriminators 93 | model = const.build_from_hash(data) 94 | end 95 | 96 | return model if model 97 | end 98 | end 99 | 100 | # if no match by now, raise 101 | raise 102 | rescue 103 | raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" 104 | end 105 | end 106 | end 107 | end 108 | end 109 | --------------------------------------------------------------------------------