Sha256: 29a0497cc8e32fa2243600477684184109cbb2f566e597bf8f84383e3165b58c

Contents?: true

Size: 815 Bytes

Versions: 34

Compression:

Stored size: 815 Bytes

Contents

# This is a monkey patch to pass Array
# params without an index.
#
# The problem is described in typhoeus/typhoeus issue #320:
# https://github.com/typhoeus/typhoeus/issues/320
#
# The fix is described in dylanfareed/ethon commit 548033a:
# https://github.com/dylanfareed/ethon/commit/548033a8557a48203b7d49f3f98812bd79bc05e4
#

require 'ethon'

module Ethon
  class Easy
    module Queryable

      private

      def recursively_generate_pairs(h, prefix, pairs)
        case h
        when Hash
          h.each_pair do |k,v|
            key = prefix.nil? ? k : "#{prefix}[#{k}]"
            pairs_for(v, key, pairs)
          end
        when Array
          h.each_with_index do |v, i|
            key = "#{prefix}[]"
            pairs_for(v, key, pairs)
          end
        end
      end

    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
ddy_remote_resource-1.3.4 lib/extensions/ethon/easy/queryable.rb
ddy_remote_resource-1.3.3 lib/extensions/ethon/easy/queryable.rb
ddy_remote_resource-1.3.2 lib/extensions/ethon/easy/queryable.rb
ddy_remote_resource-1.3.1 lib/extensions/ethon/easy/queryable.rb
ddy_remote_resource-1.2.3 lib/extensions/ethon/easy/queryable.rb
ddy_remote_resource-1.2.2 lib/extensions/ethon/easy/queryable.rb
ddy_remote_resource-1.2.1 lib/extensions/ethon/easy/queryable.rb
ddy_remote_resource-1.2.0 lib/extensions/ethon/easy/queryable.rb
ddy_remote_resource-1.1.2 lib/extensions/ethon/easy/queryable.rb
ddy_remote_resource-1.1.1 lib/extensions/ethon/easy/queryable.rb
ddy_remote_resource-1.1.0 lib/extensions/ethon/easy/queryable.rb
ddy_remote_resource-1.0.5 lib/extensions/ethon/easy/queryable.rb
ddy_remote_resource-1.0.4 lib/extensions/ethon/easy/queryable.rb
ddy_remote_resource-1.0.3 lib/extensions/ethon/easy/queryable.rb
ddy_remote_resource-1.0.2 lib/extensions/ethon/easy/queryable.rb
ddy_remote_resource-1.0.1 lib/extensions/ethon/easy/queryable.rb
ddy_remote_resource-1.0.0 lib/extensions/ethon/easy/queryable.rb
ddy_remote_resource-1.0.0.rc7 lib/extensions/ethon/easy/queryable.rb
ddy_remote_resource-1.0.0.rc6 lib/extensions/ethon/easy/queryable.rb
ddy_remote_resource-1.0.0.rc5 lib/extensions/ethon/easy/queryable.rb