class DKIM::Query::Domain
Represents the DKIM
keys of a domain.
Attributes
DKIM
Keys of the domain
@return [Hash{String => Key}]
Name of the domain
@return [String]
Public Class Methods
Initializes the domain.
@param [String] name
The domain name.
@param [Hash{String => Key}] keys
The DKIM Keys of the domain.
@api public
# File lib/dkim/query/domain.rb, line 36 def initialize(name,keys={}) @name = name @keys = keys end
Parses the DKIM
Keys.
@param [String] domain
The domain the keys belong to.
@param [Hash{String => String}] keys
The DKIM selectors and keys.
@return [Domain]
The domain and it's parsed DKIM keys.
@api semipublic
# File lib/dkim/query/domain.rb, line 55 def self.parse(domain,keys={}) keys = Hash[keys.map { |selector,record| [selector, Key.parse(record)] }] return new(domain,keys) end
Parses the DKIM
Keys.
@param [String] domain
The domain the keys belong to.
@param [Hash{String => String}] keys
The DKIM selectors and keys.
@return [Domain]
The domain and it's parsed DKIM keys.
@raise [Parslet::ParseFailed]
One of the keys was invalid.
@api semipublic
# File lib/dkim/query/domain.rb, line 80 def self.parse!(domain,keys={}) keys = Hash[keys.map { |selector,record| [selector, Key.parse!(record)] }] return new(domain,keys) end
Queries the domain for all DKIM
selectors.
@param [String] domain
The domain to query.
@option options [Array<String>] :selectors
sub-domain selectors.
@option options [Resolv::DNS] :resolver
@return [Domain]
The domain and it's DKIM Keys.
@api public
# File lib/dkim/query/domain.rb, line 104 def self.query(domain,options={}) parse(domain,Query.query(domain,options)) end
Public Instance Methods
Selects a key from the domain.
@param [String] selector
The selector.
@return [Key, nil]
The key within that selector.
# File lib/dkim/query/domain.rb, line 135 def [](selector) @keys[selector] end
Enumerates over each individual key.
@yield [key]
The given block will be passed each key.
@yieldparam [DKIM::Query::Key] key
A key belonging to the domain.
@return [Enumerator]
If no block was given, an Enumerator will be returned.
@api public
# File lib/dkim/query/domain.rb, line 122 def each(&block) @keys.each_value(&block) end