module Faraday::NestedParamsEncoder
def self.dehash(hash, depth)
Internal: convert a nested hash with purely numeric keys into an array.
def self.dehash(hash, depth) hash.each do |key, value| hash[key] = dehash(value, depth + 1) if value.kind_of?(Hash) end if depth > 0 && !hash.empty? && hash.keys.all? { |k| k =~ /^\d+$/ } hash.keys.sort.inject([]) { |all, key| all << hash[key] } else hash end end