Module: Reputable::BlockedPage

Defined in:
lib/reputable/blocked_page.rb

Overview

Simple HTML blocked page renderer for Rack/Rails usage.

Class Method Summary collapse

Class Method Details

.html(**options) ⇒ Object



35
36
37
# File 'lib/reputable/blocked_page.rb', line 35

def html(**options)
  build_html(**options)
end

.response(site_name: nil, support_email: nil, support_url: nil, client_ip: nil, heading: "Access blocked", message: nil, status: 403, show_ip: true) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/reputable/blocked_page.rb', line 7

def response(
  site_name: nil,
  support_email: nil,
  support_url: nil,
  client_ip: nil,
  heading: "Access blocked",
  message: nil,
  status: 403,
  show_ip: true
)
  html = build_html(
    site_name: site_name,
    support_email: support_email,
    support_url: support_url,
    client_ip: client_ip,
    heading: heading,
    message: message,
    show_ip: show_ip
  )

  headers = {
    "Content-Type" => "text/html; charset=utf-8",
    "Cache-Control" => "no-store"
  }

  [status, headers, [html]]
end