class CybridApiId::ApiClient

def build_request_body(header_params, form_params, body)

Returns:
  • (String) - HTTP body data in the form of string

Parameters:
  • body (Object) -- HTTP body (JSON/XML)
  • form_params (Hash) -- Query parameters
  • header_params (Hash) -- Header parameters
def build_request_body(header_params, form_params, body)
  # http form
  if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
      header_params['Content-Type'] == 'multipart/form-data'
    data = {}
    form_params.each do |key, value|
      case value
      when ::File, ::Array, nil
        # let typhoeus handle File, Array and nil parameters
        data[key] = value
      else
        data[key] = value.to_s
      end
    end
  elsif body
    data = body.is_a?(String) ? body : body.to_json
  else
    data = nil
  end
  data
end