Class: NicInfo::Ns

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

Overview

deals with RDAP nameserver structures

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Ns

Returns a new instance of Ns.



52
53
54
55
56
57
# File 'lib/nicinfo/ns.rb', line 52

def initialize config
  @config = config
  @common = CommonJson.new config
  @entities = Array.new
  @asEventActors = Array.new
end

Instance Attribute Details

#asEventActorsObject

Returns the value of attribute asEventActors.



50
51
52
# File 'lib/nicinfo/ns.rb', line 50

def asEventActors
  @asEventActors
end

#entitiesObject

Returns the value of attribute entities.



50
51
52
# File 'lib/nicinfo/ns.rb', line 50

def entities
  @entities
end

#objectclassObject

Returns the value of attribute objectclass.



50
51
52
# File 'lib/nicinfo/ns.rb', line 50

def objectclass
  @objectclass
end

Instance Method Details

#displayObject



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/nicinfo/ns.rb', line 65

def display
  @config.logger.start_data_item
  @config.logger.data_title "[ NAME SERVER ]"
  @config.logger.terse "Handle", NicInfo::get_handle( @objectclass ), NicInfo::AttentionType::SUCCESS
  @config.logger.extra "Object Class Name", NicInfo::get_object_class_name( @objectclass, "nameserver", @config )
  @config.logger.terse "Host Name", NicInfo::get_ldhName( @objectclass ), NicInfo::AttentionType::SUCCESS
  @config.logger.terse "IDN Host Name", NicInfo::get_unicodeName( @objectclass ), NicInfo::AttentionType::SUCCESS
  ipAddrs = @objectclass[ "ipAddresses" ]
  if ipAddrs
    v6Addrs = ipAddrs[ "v6" ]
    v6Addrs.each do |v6|
      @config.logger.terse "IPv6 Address", v6, NicInfo::AttentionType::SUCCESS
    end if v6Addrs
    v4Addrs = ipAddrs[ "v4" ]
    v4Addrs.each do |v4|
      @config.logger.terse "IPv4 Address", v4, NicInfo::AttentionType::SUCCESS
    end if v4Addrs
  end
  @common.display_status @objectclass
  @common.display_events @objectclass
  @common.display_as_events_actors @asEventActors
  @common.display_port43 @objectclass
  @common.display_remarks @objectclass
  @common.display_links( get_cn, @objectclass )
  @config.logger.end_data_item
end

#get_cnObject



92
93
94
95
96
97
98
99
100
# File 'lib/nicinfo/ns.rb', line 92

def get_cn
  handle = NicInfo::get_handle @objectclass
  handle = NicInfo::get_ldhName @objectclass if !handle
  handle = "(unidentifiable nameserver #{object_id})" if !handle
  if (name = NicInfo::get_ldhName( @objectclass ) ) != nil
    return "#{name} ( #{handle} )"
  end
  return handle
end

#process(json_data) ⇒ Object



59
60
61
62
63
# File 'lib/nicinfo/ns.rb', line 59

def process json_data
  @objectclass = json_data
  @entities = @common.process_entities @objectclass
  return self
end

#to_nodeObject



102
103
104
# File 'lib/nicinfo/ns.rb', line 102

def to_node
  DataNode.new( get_cn, nil, NicInfo::get_self_link( NicInfo::get_links( @objectclass, @config ) ) )
end