Sha256: 0900ddb52a32d20552446500975c2a3d6820de213f08da65b44406ab96a2ce7d

Contents?: true

Size: 961 Bytes

Versions: 49

Compression:

Stored size: 961 Bytes

Contents

module Fog
  module Core
    module Utils
      # This helper prepares a Hash of settings for passing into {Fog::Service.new}.
      #
      # The only special consideration is if +:header+ key is passed in the contents are unchanged. This
      # allows the headers to be passed through to requests to customise HTTP headers without them being
      # broken by the +#to_sym+ calls.
      #
      # @param [Hash] settings The String based Hash to prepare
      # @option settings [Hash] :headers Passed to the underlying {Fog::Core::Connection} unchanged
      # @return [Hash]
      #
      def self.prepare_service_settings(settings)
        if settings.is_a? Hash
          copy = []
          settings.each do |key, value|
            obj = ![:headers].include?(key) ? prepare_service_settings(value) : value
            copy.push(key.to_sym, obj)
          end
          Hash[*copy]
        else
          settings
        end
      end
    end
  end
end

Version data entries

49 entries across 46 versions & 3 rubygems

Version Path
fog-core-2.6.0 lib/fog/core/utils.rb
fog-core-2.5.0 lib/fog/core/utils.rb
fog-core-2.4.0 lib/fog/core/utils.rb
fog-core-2.3.0 lib/fog/core/utils.rb
fog-core-2.2.4 lib/fog/core/utils.rb
fog-core-2.2.3 lib/fog/core/utils.rb
fog-core-2.2.2 lib/fog/core/utils.rb
fog-core-2.2.1 lib/fog/core/utils.rb
fog-core-2.2.0 lib/fog/core/utils.rb
fog-core-2.1.2 lib/fog/core/utils.rb
fog-core-2.1.1 lib/fog/core/utils.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-core-1.45.0/lib/fog/core/utils.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-core-1.45.0/lib/fog/core/utils.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-core-2.1.0/lib/fog/core/utils.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-core-1.45.0/lib/fog/core/utils.rb
fog-core-2.1.0 lib/fog/core/utils.rb
fog-core-2.0.0 lib/fog/core/utils.rb
fog-core-1.45.0 lib/fog/core/utils.rb
fog-core-1.44.3 lib/fog/core/utils.rb
fog-core-1.44.2 lib/fog/core/utils.rb