Sha256: de2357ba2183171727e31d1a5e7b23b3fe74fcc4bd1337eb42a5cdfb10390c84
Contents?: true
Size: 1.03 KB
Versions: 4
Compression:
Stored size: 1.03 KB
Contents
# frozen_string_literal: true require_relative "base" module Neetob class CLI module Cloudflare class VerifySpf < Base attr_accessor :domain def initialize(domain) super() @domain = domain end def run zone_id = ZONE_IDS[domain.to_sym] raise(StandardError, "Domain '#{domain}' not found.") if zone_id.nil? url = create_url(zone_id, "dns_records") response = get(url) raise(StandardError, "No DNS records found") if response[:result].empty? spf_txt_records = response[:result].filter { |dns| dns[:type] == "TXT" && dns[:content].start_with?("v=spf1") } if spf_txt_records.count > 1 ui.error("More than one TXT record found for SPF") else ui.success("Only one TXT record for SPF present") end spf_txt_records.each_with_index do |dns, index| ui.info("SPF TXT #{index + 1}: #{dns[:content]}") end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems