Sha256: 9c3ebb466a07a5461625b70b9fa81fe2bcf47a46444a42e8ba64ae924a178658

Contents?: true

Size: 677 Bytes

Versions: 42

Compression:

Stored size: 677 Bytes

Contents

module Fog
  module Brightbox
    # Rough implementation to extract Brightbox identifiers from RFC5988 Link headers
    #
    # @see https://tools.ietf.org/html/rfc5988
    #
    class LinkHelper
      # @param [String] header The value assigned to the Link header
      def initialize(header)
        @header = header
        @parsed = false
      end

      def identifier
        parse unless @parsed
        uri.path.split("/")[3]
      end

      def uri
        parse unless @parsed
        URI.parse(@link)
      end

      private

      def parse
        match = @header.match(/\A<([^>]*)>/)
        @link = match[1]
        @parsed = true
      end
    end
  end
end

Version data entries

42 entries across 40 versions & 3 rubygems

Version Path
fog-brightbox-1.11.0 lib/fog/brightbox/link_helper.rb
fog-brightbox-1.10.0 lib/fog/brightbox/link_helper.rb
fog-brightbox-1.9.1 lib/fog/brightbox/link_helper.rb
fog-brightbox-1.9.0 lib/fog/brightbox/link_helper.rb
fog-brightbox-1.8.2 lib/fog/brightbox/link_helper.rb
fog-brightbox-1.8.1 lib/fog/brightbox/link_helper.rb
fog-brightbox-1.8.0 lib/fog/brightbox/link_helper.rb
fog-brightbox-1.7.3 lib/fog/brightbox/link_helper.rb
fog-brightbox-1.7.2 lib/fog/brightbox/link_helper.rb
fog-brightbox-1.7.1 lib/fog/brightbox/link_helper.rb
fog-brightbox-1.7.0 lib/fog/brightbox/link_helper.rb
fog-brightbox-1.6.0 lib/fog/brightbox/link_helper.rb
fog-brightbox-1.5.0 lib/fog/brightbox/link_helper.rb
fog-brightbox-1.5.0.rc1 lib/fog/brightbox/link_helper.rb
fog-brightbox-1.4.2 lib/fog/brightbox/link_helper.rb
fog-brightbox-1.4.1 lib/fog/brightbox/link_helper.rb
fog-brightbox-1.4.0 lib/fog/brightbox/link_helper.rb
fog-brightbox-1.3.0 lib/fog/brightbox/link_helper.rb
fog-brightbox-1.2.0 lib/fog/brightbox/link_helper.rb
fog-brightbox-1.1.0 lib/fog/brightbox/link_helper.rb