module Dnsmadeeasy_verify
Constants
- VERSION
Attributes
configuration[RW]
Public Class Methods
configure() { |configuration| ... }
click to toggle source
# File lib/dnsmadeeasy_verify.rb, line 44 def self.configure self.configuration ||= Configuration.new yield(configuration) end
domains_not_on_dnsmadeeasy()
click to toggle source
Returns all domains that are not correctly setup on DNS Made Easy
# File lib/dnsmadeeasy_verify.rb, line 27 def self.domains_not_on_dnsmadeeasy domains = self.list_domains domains_not_on_dnsmadeeasy = Hash.new domains.each do |k, v| domains_not_on_dnsmadeeasy[k] = v unless v.do_name_servers_contain("dnsmadeeasy.com") end domains_not_on_dnsmadeeasy end
list_domains()
click to toggle source
Returns all domains from DNS Made Easy
# File lib/dnsmadeeasy_verify.rb, line 11 def self.list_domains domains = Hash.new response = get_all_domains(Dnsmadeeasy_verify.configuration.dnsmadeeasy_api_key, Dnsmadeeasy_verify.configuration.dnsmadeeasy_api_secret) case response.status when 200 data = JSON.parse(response.body) data['data'].each do |child| domains[child["name"]] = Domain.new(child["id"],child["name"]) end end domains end
Private Class Methods
get_all_domains(api_key, api_secret)
click to toggle source
# File lib/dnsmadeeasy_verify/dnsmadeeasy_api.rb, line 25 def self.get_all_domains(api_key, api_secret) faraday = Faraday.new(:url => @base_uri) faraday.headers = get_auth_headers(api_key, api_secret) faraday.get '/V2.0/dns/managed/' end
get_auth_headers(api_key, api_secret)
click to toggle source
# File lib/dnsmadeeasy_verify/dnsmadeeasy_api.rb, line 15 def self.get_auth_headers(api_key, api_secret) date_of_request = Time.now().httpdate headers = { 'x-dnsme-apiKey' => api_key, 'x-dnsme-requestDate' => date_of_request, 'x-dnsme-hmac' => hmac_sha1(date_of_request,api_secret) } end
hmac_sha1(data, secret)
click to toggle source
# File lib/dnsmadeeasy_verify/dnsmadeeasy_api.rb, line 10 def self.hmac_sha1(data, secret) hmac = OpenSSL::HMAC.hexdigest(OpenSSL::Digest::Digest.new('sha1'), secret.encode("ASCII"), data.encode("ASCII")) end