class HttpSignatures::HeaderList

Constants

ILLEGAL

cannot sign the signature headers

Public Class Methods

from_string(string) click to toggle source
# File lib/http_signatures/header_list.rb, line 7
def self.from_string(string)
  new(string.split(" "))
end
new(names) click to toggle source
# File lib/http_signatures/header_list.rb, line 11
def initialize(names)
  @names = names.map(&:downcase)
  validate_names!
end

Public Instance Methods

to_a() click to toggle source
# File lib/http_signatures/header_list.rb, line 16
def to_a
  @names.dup
end
to_str() click to toggle source
# File lib/http_signatures/header_list.rb, line 20
def to_str
  @names.join(" ")
end

Private Instance Methods

illegal_headers_present() click to toggle source
# File lib/http_signatures/header_list.rb, line 35
def illegal_headers_present
  ILLEGAL & @names
end
validate_names!() click to toggle source
# File lib/http_signatures/header_list.rb, line 26
def validate_names!
  if @names.empty?
    raise EmptyHeaderList
  end
  if illegal_headers_present.any?
    raise IllegalHeader, illegal_headers_present
  end
end