Class: Pangea::RequestOptions

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/pangea/request_options.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from Internal::Type::BaseModel

#==, coerce, #deconstruct_keys, dump, fields, #initialize, #inspect, known_fields, optional, required, #to_h

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, type_info

Constructor Details

This class inherits a constructor from Pangea::Internal::Type::BaseModel

Instance Attribute Details

#max_retriesInteger?

Maximum number of retries to attempt after a failed initial request.

Returns:

  • (Integer, nil)


27
# File 'lib/pangea/request_options.rb', line 27

optional :max_retries, Integer

#timeoutFloat?

Request timeout in seconds.

Returns:

  • (Float, nil)


33
# File 'lib/pangea/request_options.rb', line 33

optional :timeout, Float

Class Method Details

.validate!(opts) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

Raises:

  • (ArgumentError)


10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/pangea/request_options.rb', line 10

def self.validate!(opts)
  case opts
  in Pangea::RequestOptions | Hash
    opts.to_h.each_key do |k|
      unless fields.include?(k)
        raise ArgumentError.new("Request `opts` keys must be one of #{fields.keys}, got #{k.inspect}")
      end
    end
  else
    raise ArgumentError.new("Request `opts` must be a Hash or RequestOptions, got #{opts.inspect}")
  end
end