Class: GitHubPages::HealthCheck::CAA
- Inherits:
-
Object
- Object
- GitHubPages::HealthCheck::CAA
- Defined in:
- lib/github-pages-health-check/caa.rb
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
Instance Method Summary collapse
- #errored? ⇒ Boolean
-
#initialize(host) ⇒ CAA
constructor
A new instance of CAA.
- #lets_encrypt_allowed? ⇒ Boolean
- #records ⇒ Object
- #records_present? ⇒ Boolean
Constructor Details
#initialize(host) ⇒ CAA
Returns a new instance of CAA.
12 13 14 15 16 |
# File 'lib/github-pages-health-check/caa.rb', line 12 def initialize(host) raise ArgumentError, "host cannot be nil" if host.nil? @host = host end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
10 11 12 |
# File 'lib/github-pages-health-check/caa.rb', line 10 def error @error end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
9 10 11 |
# File 'lib/github-pages-health-check/caa.rb', line 9 def host @host end |
Instance Method Details
#errored? ⇒ Boolean
18 19 20 21 |
# File 'lib/github-pages-health-check/caa.rb', line 18 def errored? records # load the records first !error.nil? end |
#lets_encrypt_allowed? ⇒ Boolean
23 24 25 26 27 |
# File 'lib/github-pages-health-check/caa.rb', line 23 def lets_encrypt_allowed? return false if errored? return true unless records_present? records.any? { |r| r.property_value == "letsencrypt.org" } end |
#records ⇒ Object
34 35 36 |
# File 'lib/github-pages-health-check/caa.rb', line 34 def records @records ||= (get_caa_records(host) | get_caa_records(PublicSuffix.domain(host))) end |
#records_present? ⇒ Boolean
29 30 31 32 |
# File 'lib/github-pages-health-check/caa.rb', line 29 def records_present? return false if errored? records && !records.empty? end |