Module: Bullion::Helpers::Service

Defined in:
lib/bullion/helpers/service.rb

Overview

Sinatra service helper methods

Instance Method Summary collapse

Instance Method Details

#add_acme_headers(nonce, additional: {}) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/bullion/helpers/service.rb', line 7

def add_acme_headers(nonce, additional: {})
  headers["Replay-Nonce"] = nonce
  add_link_relation("index", uri("/directory"))

  additional.each do |name, value|
    headers[name.to_s] = value.to_s
  end
end


16
17
18
19
20
# File 'lib/bullion/helpers/service.rb', line 16

def add_link_relation(type, value)
  cur = link_headers_to_hash(headers["Link"])
  cur[type] = value
  headers["Link"] = hashed_links_to_link_headers(cur)
end