Sha256: 4f951ac94421c96632428e64667bdc0b1c26699829a5cc212080f459c3faccc5

Contents?: true

Size: 713 Bytes

Versions: 18

Compression:

Stored size: 713 Bytes

Contents

module Pupa
  module Refinements
    # Faraday requires `params` to be a hash.
    module Connection
      # @see https://github.com/lostisland/faraday/blob/b8d90a59bafb8dd6e19488fae07945a7700f5664/lib/faraday/connection.rb#L137
      def get(url=nil, params=nil, headers=nil, &block)
        if String === params
          params = CGI.parse(params)

          # Flatten the parameters for Faraday.
          params.each do |key,value|
            if Array === value && value.size == 1
              params[key] = value.first
            end
          end
        end

        super(url, params, headers, &block)
      end
    end
  end
end

class Faraday::Connection
  prepend Pupa::Refinements::Connection
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
pupa-0.2.4 lib/pupa/refinements/faraday.rb
pupa-0.2.3 lib/pupa/refinements/faraday.rb
pupa-0.2.2 lib/pupa/refinements/faraday.rb
pupa-0.2.1 lib/pupa/refinements/faraday.rb
pupa-0.2.0 lib/pupa/refinements/faraday.rb
pupa-0.1.11 lib/pupa/refinements/faraday.rb
pupa-0.1.10 lib/pupa/refinements/faraday.rb
pupa-0.1.9 lib/pupa/refinements/faraday.rb
pupa-0.1.8 lib/pupa/refinements/faraday.rb
pupa-0.1.7 lib/pupa/refinements/faraday.rb
pupa-0.1.6 lib/pupa/refinements/faraday.rb
pupa-0.1.5 lib/pupa/refinements/faraday.rb
pupa-0.1.4 lib/pupa/refinements/faraday.rb
pupa-0.1.3 lib/pupa/refinements/faraday.rb
pupa-0.1.2 lib/pupa/refinements/faraday.rb
pupa-0.1.1 lib/pupa/refinements/faraday.rb
pupa-0.1.0 lib/pupa/refinements/faraday.rb
pupa-0.0.13 lib/pupa/refinements/faraday.rb