module Binance::Utils::Faraday::CustomParamsEncoder
def self.encode(params)
def self.encode(params) if params.nil? nil elsif params.is_a?(Array) # The params have form [['key1', 'value1'], ['key2', 'value2']]. encode_array params elsif params.respond_to?(:to_hash) params = params.to_hash.map do |key, value| key = key.to_s if key.is_a?(Symbol) [key, value] end encode_array params else raise TypeError, "Can't encode #{params.class}." end end