Class: Algolia::TransformationOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/algolia/api/search_client.rb

Overview

Configuration options for the ingestion transporter used by *_with_transformation helpers. When passed to SearchClient.with_transformation or set via set_transformation_options, the ingestion transporter is eagerly created using Ingestion API defaults (25s timeouts, no compression). Only fields explicitly set here override those defaults. See www.algolia.com/doc/libraries/ruby/v3/methods/ingestion

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(region, opts = {}) ⇒ TransformationOptions

Returns a new instance of TransformationOptions.



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/algolia/api/search_client.rb', line 25

def initialize(region, opts = {})
  if region.nil? || region.to_s.strip.empty?
    raise(
      ArgumentError,
      "`region` is required in `TransformationOptions`. See https://www.algolia.com/doc/libraries/ruby/v3/methods/ingestion"
    )
  end

  valid_keys = %i[connect_timeout read_timeout write_timeout hosts compression_type header_params]
  unknown = opts.keys - valid_keys
  unless unknown.empty?
    raise(
      ArgumentError,
      "Unknown TransformationOptions keys: #{unknown.join(", ")}. Valid keys are: #{valid_keys.join(", ")}"
    )
  end

  @region = region
  @connect_timeout = opts[:connect_timeout]
  @read_timeout = opts[:read_timeout]
  @write_timeout = opts[:write_timeout]
  @hosts = opts[:hosts]
  @compression_type = opts[:compression_type]
  @header_params = opts[:header_params]
end

Instance Attribute Details

#compression_typeObject

Returns the value of attribute compression_type.



15
16
17
# File 'lib/algolia/api/search_client.rb', line 15

def compression_type
  @compression_type
end

#connect_timeoutObject

Returns the value of attribute connect_timeout.



15
16
17
# File 'lib/algolia/api/search_client.rb', line 15

def connect_timeout
  @connect_timeout
end

#header_paramsObject

Returns the value of attribute header_params.



15
16
17
# File 'lib/algolia/api/search_client.rb', line 15

def header_params
  @header_params
end

#hostsObject

Returns the value of attribute hosts.



15
16
17
# File 'lib/algolia/api/search_client.rb', line 15

def hosts
  @hosts
end

#read_timeoutObject

Returns the value of attribute read_timeout.



15
16
17
# File 'lib/algolia/api/search_client.rb', line 15

def read_timeout
  @read_timeout
end

#regionObject

Returns the value of attribute region.



15
16
17
# File 'lib/algolia/api/search_client.rb', line 15

def region
  @region
end

#write_timeoutObject

Returns the value of attribute write_timeout.



15
16
17
# File 'lib/algolia/api/search_client.rb', line 15

def write_timeout
  @write_timeout
end