class GitHubPages::HealthCheck::Site

Attributes

domain[R]
repository[R]

Public Class Methods

new(repository_or_domain, access_token: nil) click to toggle source
# File lib/github-pages-health-check/site.rb, line 8
def initialize(repository_or_domain, access_token: nil)
  @repository = Repository.new(repository_or_domain, :access_token => access_token)
  @domain = @repository.domain
rescue GitHubPages::HealthCheck::Errors::InvalidRepositoryError
  @repository = nil
  @domain = Domain.redundant(repository_or_domain)
end

Public Instance Methods

as_json()
Alias for: to_hash
check!() click to toggle source
# File lib/github-pages-health-check/site.rb, line 16
def check!
  [domain, repository].compact.each(&:check!)
  true
end
to_h()
Alias for: to_hash
to_hash() click to toggle source
# File lib/github-pages-health-check/site.rb, line 21
def to_hash
  hash = (domain || {}).to_hash.dup
  hash = hash.merge(repository.to_hash) unless repository.nil?
  hash[:valid?] = valid?
  hash[:reason] = reason
  hash
end
Also aliased as: to_h, as_json