Class: NicInfo::ErrorCode

Inherits:
Object
  • Object
show all
Defined in:
lib/nicinfo/error_code.rb

Overview

deals with RDAP error code structures

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ ErrorCode

Returns a new instance of ErrorCode.



26
27
28
# File 'lib/nicinfo/error_code.rb', line 26

def initialize( config )
  @config = config
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



24
25
26
# File 'lib/nicinfo/error_code.rb', line 24

def config
  @config
end

Instance Method Details

#display_error_code(ec) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/nicinfo/error_code.rb', line 30

def display_error_code ec
  @config.logger.start_data_item
  title = ec[ "title" ]
  if title == nil
    title = ""
  end
  @config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "[ ERROR ]", title, NicInfo::AttentionType::ERROR
  @config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "Code", ec[ "errorCode" ]
  description = ec[ "description" ]
  i = 1
  description.each do |line|
    @config.logger.prose NicInfo::DataAmount::NORMAL_DATA, i.to_s, line
    i = i + 1
  end
  links = ec[ "links" ]
  if links
    alternate = NicInfo.get_alternate_link links
    @config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "More", alternate if alternate
    about = NicInfo.get_about_link links
    @config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "About", about if about
    tos = NicInfo.get_tos_link links
    @config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "TOS", tos if tos
    copyright = NicInfo.get_copyright_link links
    @config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "(C)", copyright if copyright
    license = NicInfo.get_license_link links
    @config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "License", license if license
  end
  @config.logger.end_data_item
end