Sha256: 10773eb238c128a41e2f36d5713ed2b841147a78c58c8763841a27bfbfbfb397
Contents?: true
Size: 869 Bytes
Versions: 21
Compression:
Stored size: 869 Bytes
Contents
# frozen_string_literal: true module GitHubPages module HealthCheck class Site < Checkable attr_reader :repository, :domain 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 def check! [domain, repository].compact.each(&:check!) true end 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 alias to_h to_hash alias as_json to_hash end end end
Version data entries
21 entries across 21 versions & 1 rubygems