Class: DLDInternet::OpenSRS::Domain::Get::Command
- Inherits:
-
Thor::Command
- Object
- Thor::Command
- DLDInternet::OpenSRS::Domain::Get::Command
- Defined in:
- lib/dldinternet/opensrs/domain/get/command.rb
Instance Method Summary collapse
- #all_info(domain) ⇒ Object
- #dns(domain) ⇒ Object
- #list ⇒ Object
- #nameservers(domain) ⇒ Object
- #status(domain) ⇒ Object
Instance Method Details
#all_info(domain) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/dldinternet/opensrs/domain/get/command.rb', line 16 def all_info(domain) command_pre(domain) answer = DLDInternet::OpenSRS::API::Domain::Get.new(, @logger).GetAllInfo(domain) case @config[:format].to_s when /none|text/ @config[:format] = :awesome end command_out answer 0 end |
#dns(domain) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# 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(, @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 ⇒ Object
29 30 31 32 33 34 35 36 37 |
# 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(, @logger).GetDomainList command_out answer 0 end |
#nameservers(domain) ⇒ Object
40 41 42 |
# File 'lib/dldinternet/opensrs/domain/get/command.rb', line 40 def nameservers(domain) dns(domain) end |
#status(domain) ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# 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(, @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 |