class DLDInternet::OpenSRS::Domain::Get::Command

Public Instance Methods

all_info(domain) click to toggle source
# File lib/dldinternet/opensrs/domain/get/command.rb, line 16
def all_info(domain)
  command_pre(domain)

  answer = DLDInternet::OpenSRS::API::Domain::Get.new(options, @logger).GetAllInfo(domain)
  case @config[:format].to_s
  when /none|text/
    @config[:format] = :awesome
  end
  command_out answer
  0
end
dns(domain) click to toggle source
# File lib/dldinternet/opensrs/domain/get/command.rb, line 45
def dns(domain)
  command_pre(domain)
  @header = ->{ sprintf("%-10s\t%-48s", 'Nameserver','Hostname') }
  @format = ->(res) { sprintf("%-10s\t%-48s", res['sortorder'], res['name'] ) }

  answer = DLDInternet::OpenSRS::API::Domain::Get.new(options, @logger).GetDomainNameservers(domain).sort_by { |ns| ns['sortorder'].to_i }
  case @config[:format].to_s
  when /text|none/
    @header = ->{ sprintf("#{domain}\n%-10s\t%-48s", 'Nameserver','Hostname') }
    # output domain
    # output answer.sort_by { |ns| ns['sortorder'].to_i }.each { |ns| write "nameserver #{ns['sortorder']}: #{ns['name']}" }
  # else
  #   output answer
  end
  command_out answer
  0
end
list() click to toggle source
# File lib/dldinternet/opensrs/domain/get/command.rb, line 29
def list()
  command_pre()
  @header = ->{ sprintf("%-48s", 'Domainname') }
  @format = ->(res) { sprintf("%-48s", res ) }

  answer = DLDInternet::OpenSRS::API::Domain::Get.new(options, @logger).GetDomainList
  command_out answer
  0
end
nameservers(domain) click to toggle source
# File lib/dldinternet/opensrs/domain/get/command.rb, line 40
def nameservers(domain)
  dns(domain)
end
status(domain) click to toggle source
# File lib/dldinternet/opensrs/domain/get/command.rb, line 64
def status(domain)
  command_pre domain
  @header = ->{ sprintf("%-10s\t%-10s\t%-14s", 'Lock state','Can modify','Domain supports') }
  @format = ->(res) { sprintf("%-10s\t%-10s\t%-14s", res['lock_state'], res['can_modify'], res['domain_supports'] ) }

  answer = DLDInternet::OpenSRS::API::Domain::Get.new(options, @logger).GetDomainStatus(domain)
  case @config[:format].to_s
  when /text|none/
    @header = ->{ sprintf("#{domain}\n%-10s\t%-10s\t%-14s", 'Lock state','Can modify','Domain supports') }
    # write domain
    # answer.each { |k,v| write "#{k}: #{v}" }
  # else
  #   output answer
  end
  command_out answer
  0
end