Module: Pangea::Internal::Type::RequestParameters::Converter Private

Included in:
Models::AiGuard::TextGuardParams
Defined in:
lib/pangea/internal/type/request_parameters.rb

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

Instance Method Summary collapse

Instance Method Details

#dump_request(params) ⇒ 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.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/pangea/internal/type/request_parameters.rb', line 17

def dump_request(params)
  state = {can_retry: true}
  case (dumped = dump(params, state: state))
  in Hash
    options = Pangea::Internal::Util.coerce_hash(dumped[:request_options])
    request_options =
      case [options, state.fetch(:can_retry)]
      in [Hash | nil, false]
        {**options.to_h, max_retries: 0}
      else
        options
      end
    [dumped.except(:request_options), request_options]
  else
    [dumped, nil]
  end
end