class Fog::Brightbox::LinkHelper

Rough implementation to extract Brightbox identifiers from RFC5988 Link headers

@see tools.ietf.org/html/rfc5988

Public Class Methods

new(header) click to toggle source

@param [String] header The value assigned to the Link header

# File lib/fog/brightbox/link_helper.rb, line 9
def initialize(header)
  @header = header
  @parsed = false
end

Public Instance Methods

identifier() click to toggle source
# File lib/fog/brightbox/link_helper.rb, line 14
def identifier
  parse unless @parsed
  uri.path.split("/")[3]
end
uri() click to toggle source
# File lib/fog/brightbox/link_helper.rb, line 19
def uri
  parse unless @parsed
  URI.parse(@link)
end

Private Instance Methods

parse() click to toggle source
# File lib/fog/brightbox/link_helper.rb, line 26
def parse
  match = @header.match(/\A<([^>]*)>/)
  @link = match[1]
  @parsed = true
end