lib/securitytrails/clients/history.rb in securitytrails-0.1.0 vs lib/securitytrails/clients/history.rb in securitytrails-0.1.1
- old
+ new
@@ -2,10 +2,12 @@
module SecurityTrails
module Clients
class History < Client
def get_dns_history(hostname, type, page = 1)
+ raise ArgumentError, "The API currently supports a, aaaa, mx, ns, soa and txt records." unless valid_type?(type)
+
get("/history/#{hostname}/dns/#{type.downcase}", page: page) { |json| json }
end
def get_all_dns_history(hostname, type)
first_page = get_dns_history(hostname, type, 1)
@@ -23,9 +25,15 @@
first_page
end
def get_whois_history(hostname)
get("/history/#{hostname}/whois/") { |json| json }
+ end
+
+ private
+
+ def valid_type?(type)
+ ["a", "aaaa", "mx", "ns", "soa", "txt"].include? type.downcase
end
end
end
end