class Dnsblim::CLI::Tables::CheckTable

Public Class Methods

new() click to toggle source
# File lib/dnsblim/cli/tables.rb, line 190
def initialize
  @hl = HighLine.new(STDIN, STDOUT, 80, 1, 2, 1)
  self.formatter = 'nested'
end

Public Instance Methods

run(obj, options) click to toggle source
# File lib/dnsblim/cli/tables.rb, line 195
def run(obj, options)
  report(message: "Check on #{options[:ip_addr]}") do
    report(message: "MySQL Data for #{options[:ip_addr]}", color: 'green') do
      obj['reply']['mysql'].each do |key, value|
        return_string = ''
        case key
        when 'success'
          return_string = "Retrieval Success: #{value.to_s.capitalize}"
        when 'ip_addr'
          next
        when 'type'
          return_string = "Listing Type: #{value}"
        when 'removal_date'
          return_string = "Expiration Date: #{DateTime.parse(value).strftime('%c')}"
        when '_class'
          return_string = "Type Class: #{value}"
        end
        report(message: return_string, type: 'inline', complete: "\t ... retrieved") do
        end
      end
    end
    report(message: "DNS Results for #{options[:ip_addr]}", color: 'green') do
      obj['reply']['dns'].each do |key, value|
        return_string = ''
        case key
        when 'success'
          return_string = "Retrieval Success: #{value.to_s.capitalize}"
        when 'ip_addr'
          next
        when 'reply'
          return_string = "Record: #{value}"
        when 'listed'
          return_string = "Listed: #{value == 1 ? 'Yes' : 'No'}"
        end
        report(message: return_string, type: 'inline', complete: "\t ... retrieved") do
        end
      end
    end

    obj['reply'].each do |key, value|
      return_string = ''
      case key
      when 'mysql'
        next
      when 'dns'
        next
      when 'set_by'
        return_string = "Submitted By: #{value}"
      when 'reason'
        return_string = "Reason: #{value}"
      when 'set_by_id'
        return_string = "Key ID: #{value}"
      end
      report(message: return_string, type: 'inline', complete: "\t ... retrieved") do
      end
    end
  end
end