class Doorkeeper::OAuth::Authorization::URIBuilder

def build_query(parameters = {})

def build_query(parameters = {})
  parameters.reject! { |_, value| value.blank? }
  Rack::Utils.build_query(parameters)
end

def uri_with_fragment(url, parameters = {})

def uri_with_fragment(url, parameters = {})
  uri = URI.parse(url)
  uri.fragment = build_query(parameters)
  uri.to_s
end

def uri_with_query(url, parameters = {})

def uri_with_query(url, parameters = {})
  uri = URI.parse(url)
  original_query = Rack::Utils.parse_query(uri.query)
  uri.query = build_query(original_query.merge(parameters))
  uri.to_s
end