Sha256: 2a711df36177f3483cf1ccd350fa29bea13b3c6f01935f1f929b9f9db8e60243
Contents?: true
Size: 875 Bytes
Versions: 6
Compression:
Stored size: 875 Bytes
Contents
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.new(repository_or_domain) end def check! [domain, repository].each { |check| check.check! unless check.nil? } 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_method :to_h, :to_hash alias_method :as_json, :to_hash end end end
Version data entries
6 entries across 6 versions & 1 rubygems