Sha256: 7cc8fd404a5b7bb4df8f48b715707643198849acf3a5e2fab108e8575e700c99
Contents?: true
Size: 810 Bytes
Versions: 6
Compression:
Stored size: 810 Bytes
Contents
require 'wrest' # Defines a DNS name server returned by http://public-dns.tk/ class Nameserver include Wrest::Components::Container always_has :id typecast ip: ->(ip) { IPAddr.new(ip) }, created_at: ->(date) { DateTime.iso8601(date) }, checked_at: ->(date) { DateTime.iso8601(date) }, updated_at: ->(date) { DateTime.iso8601(date) }, state_changed_at: ->(date) { DateTime.iso8601(date) } def ipv4? ip.ipv4? end def ipv6? ip.ipv6? end def valid? state == 'valid' end def invalid? state == 'invalid' end def age_minutes t1 = Time.now.to_i t2 = checked_at.to_i seconds_since_check = t1 - t2 minutes_since_check = seconds_since_check / 60 minutes_since_check end end
Version data entries
6 entries across 6 versions & 1 rubygems