def expand_path( path, params )
      template = Addressable::Template.new path

      expansions = {}
      query_values = params.dup
      query_values.delete :action
      query_values.delete :context
      query_values.delete :retries

      rest_api = query_values.delete :rest_api

      template.keys.map(&:to_sym).each do |key|
        value = query_values.delete key
        value = assert_param_presence(value, key) unless path =~ /{\/#{key}}/ && value.nil?
        expansions[key] = value
      end

      if rest_api
        query_values = if strict_params?
          api_spec.validate_params!(api: rest_api, params: query_values)
        else
          api_spec.select_params(api: rest_api, from: query_values)
        end
      end

      uri = template.expand(expansions)
      uri.query_values = query_values unless query_values.empty?
      uri.to_s
    end
def expand_path( path, params )
      template = Addressable::Template.new path

      expansions = {}
      query_values = params.dup
      query_values.delete :action
      query_values.delete :context
      query_values.delete :retries

      rest_api = query_values.delete :rest_api

      template.keys.map(&:to_sym).each do |key|
        value = query_values.delete key
        value = assert_param_presence(value, key) unless path =~ /{\/#{key}}/ && value.nil?
        expansions[key] = value
      end

      if rest_api
        query_values = if strict_params?
          api_spec.validate_params!(api: rest_api, params: query_values)
        else
          api_spec.select_params(api: rest_api, from: query_values)
        end
      end

      uri = template.expand(expansions)
      uri.query_values = query_values unless query_values.empty?
      uri.to_s
    end
Internal: Apply path expansions to the `path` and append query
 parameters to the `path`. We are using an Addressable::Template to
 replace '{expansion}' fields found in the path with the values extracted
 from the `params` Hash. Any remaining elements in the `params` hash are
 treated as query parameters and appended to the end of the path.

 path   - The path as a String
 params - Parameters Hash

 Examples

   expand_path('/foo{/bar}', {bar: 'hello', q: 'what', p: 2})
   #=> '/foo/hello?q=what&p=2'

   expand_path('/foo{/bar}{/baz}', {baz: 'no bar'}
   #=> '/foo/no%20bar'

 Returns an Addressable::Uri