def bind!(args = {})
      path_var_values   = args[:path]    || {}
      query_var_values  = args[:query]   || {}
      header_var_values = args[:headers] || {}

      @auth.each { |header, value| header_var_values[header] = value }.clear

      # Bind variables found in the path fragments.
      path_params_to_delete = []

      path_fragments.each { |fragment|
        if fragment.respond_to?(:to_str)
          # This fragment is a string which might contain {} substitutions.
          # Make any substitutions available to the provided path variables.
          self.class.embedded_param_names(fragment).each { |name|
            value = path_var_values[name] || path_var_values[name.to_sym]

            value = if param = path_params[name]
              path_params_to_delete << param
              param % value
            else
              Param.default.format(value, name)
            end

            fragment.gsub!("{#{name}}", value)
          }
        else
          # This fragment is an array of Param objects (style 'matrix'
          # or 'plain') which may be bound to strings. As substitutions
          # happen, the array will become a mixed array of Param objects
          # and strings.
          fragment.each_with_index { |param, i|
            next unless param.respond_to?(:name)

            name = param.name

            value = path_var_values[name] || path_var_values[name.to_sym]
            value = param % value
            fragment[i] = value if value

            path_params_to_delete << param
          }
        end
      }

      # Delete any embedded path parameters that are now bound from
      # our list of unbound parameters.
      path_params_to_delete.each { |p| path_params.delete(p.name) }

      # Bind query variable values to query parameters
      query_var_values.each { |name, value|
        param = query_params.delete(name.to_s)
        query_vars << param % value if param
      }

      # Bind header variables to header parameters
      header_var_values.each { |name, value|
        if param = header_params.delete(name.to_s)
          headers[name] = param % value
        else
          warn %Q{Ignoring unknown header parameter "#{name}"!}
        end
      }

      self
    end
def bind!(args = {})
      path_var_values   = args[:path]    || {}
      query_var_values  = args[:query]   || {}
      header_var_values = args[:headers] || {}

      @auth.each { |header, value| header_var_values[header] = value }.clear

      # Bind variables found in the path fragments.
      path_params_to_delete = []

      path_fragments.each { |fragment|
        if fragment.respond_to?(:to_str)
          # This fragment is a string which might contain {} substitutions.
          # Make any substitutions available to the provided path variables.
          self.class.embedded_param_names(fragment).each { |name|
            value = path_var_values[name] || path_var_values[name.to_sym]

            value = if param = path_params[name]
              path_params_to_delete << param
              param % value
            else
              Param.default.format(value, name)
            end

            fragment.gsub!("{#{name}}", value)
          }
        else
          # This fragment is an array of Param objects (style 'matrix'
          # or 'plain') which may be bound to strings. As substitutions
          # happen, the array will become a mixed array of Param objects
          # and strings.
          fragment.each_with_index { |param, i|
            next unless param.respond_to?(:name)

            name = param.name

            value = path_var_values[name] || path_var_values[name.to_sym]
            value = param % value
            fragment[i] = value if value

            path_params_to_delete << param
          }
        end
      }

      # Delete any embedded path parameters that are now bound from
      # our list of unbound parameters.
      path_params_to_delete.each { |p| path_params.delete(p.name) }

      # Bind query variable values to query parameters
      query_var_values.each { |name, value|
        param = query_params.delete(name.to_s)
        query_vars << param % value if param
      }

      # Bind header variables to header parameters
      header_var_values.each { |name, value|
        if param = header_params.delete(name.to_s)
          headers[name] = param % value
        else
          warn %Q{Ignoring unknown header parameter "#{name}"!}
        end
      }

      self
    end
Binds some or all of the unbound variables in this address to values.