Sha256: 3fbe32f2a2b7add585c4fae6ee0289bad70982d3d7bab92502200d6f33fa52a4

Contents?: true

Size: 807 Bytes

Versions: 23

Compression:

Stored size: 807 Bytes

Contents

# frozen_string_literal: true

require "rack/utils"

module Doorkeeper
  module OAuth
    module Authorization
      class URIBuilder
        class << self
          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

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

          private

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

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
doorkeeper-5.8.1 lib/doorkeeper/oauth/authorization/uri_builder.rb
doorkeeper-5.8.0 lib/doorkeeper/oauth/authorization/uri_builder.rb
doorkeeper-5.7.1 lib/doorkeeper/oauth/authorization/uri_builder.rb
doorkeeper-5.7.0 lib/doorkeeper/oauth/authorization/uri_builder.rb
doorkeeper-5.6.9 lib/doorkeeper/oauth/authorization/uri_builder.rb
doorkeeper-5.6.8 lib/doorkeeper/oauth/authorization/uri_builder.rb
doorkeeper-5.6.7 lib/doorkeeper/oauth/authorization/uri_builder.rb
doorkeeper-5.6.6 lib/doorkeeper/oauth/authorization/uri_builder.rb
doorkeeper-5.6.5 lib/doorkeeper/oauth/authorization/uri_builder.rb
doorkeeper-5.6.4 lib/doorkeeper/oauth/authorization/uri_builder.rb
doorkeeper-5.6.3 lib/doorkeeper/oauth/authorization/uri_builder.rb
doorkeeper-5.6.2 lib/doorkeeper/oauth/authorization/uri_builder.rb
doorkeeper-5.6.1 lib/doorkeeper/oauth/authorization/uri_builder.rb
doorkeeper-5.6.0 lib/doorkeeper/oauth/authorization/uri_builder.rb
doorkeeper-5.6.0.rc2 lib/doorkeeper/oauth/authorization/uri_builder.rb
doorkeeper-5.6.0.rc1 lib/doorkeeper/oauth/authorization/uri_builder.rb
doorkeeper-5.5.4 lib/doorkeeper/oauth/authorization/uri_builder.rb
doorkeeper-5.5.3 lib/doorkeeper/oauth/authorization/uri_builder.rb
doorkeeper-5.5.2 lib/doorkeeper/oauth/authorization/uri_builder.rb
doorkeeper-5.5.1 lib/doorkeeper/oauth/authorization/uri_builder.rb