class NicInfo::Entity
deals with RDAP entity structures
Attributes
asEventActors[RW]
asEvents[RW]
autnums[RW]
entities[RW]
networks[RW]
objectclass[RW]
selfhref[RW]
Public Class Methods
new(config)
click to toggle source
# File lib/nicinfo/entity.rb, line 244 def initialize config @config = config @jcard = JCard.new( config ) @common = CommonJson.new config @entity = nil @asEvents = Array.new @asEventActors = Array.new @selfhref = nil @entities = Array.new end
Public Instance Methods
display()
click to toggle source
# File lib/nicinfo/entity.rb, line 293 def display @config.logger.start_data_item @config.logger.data_title "[ ENTITY ]" @config.logger.terse "Handle", NicInfo::get_handle( @objectclass ), NicInfo::AttentionType::SUCCESS @config.logger.extra "Object Class Name", NicInfo::get_object_class_name( @objectclass, "entity", @config ) @jcard.fns.each do |fn| @config.logger.terse "Common Name", fn, NicInfo::AttentionType::SUCCESS end @jcard.names.each do |n| @config.logger.extra "Formal Name", n, NicInfo::AttentionType::SUCCESS end @jcard.orgs.each do |org| item_value = org.names.join( ", " ) if !org.type.empty? item_value << " ( #{org.type.join( ", " )} )" end @config.logger.terse "Organization", item_value, NicInfo::AttentionType::SUCCESS end @jcard.titles.each do |title| @config.logger.extra "Title", title end @jcard.roles.each do |role| @config.logger.extra "Organizational Role", role end @jcard.emails.each do |email| item_value = email.addr if !email.type.empty? item_value << " ( #{email.type.join( ", " )} )" end @config.logger.terse "Email", item_value end @jcard.phones.each do |phone| item_value = phone.number if phone.ext item_value << " Ext. #{phone.ext}" end if !phone.type.empty? item_value << " ( #{phone.type.join( ", " )} )" end @config.logger.terse "Phone", item_value end @common.display_string_array "roles", "Roles", @objectclass, DataAmount::TERSE_DATA @common.display_public_ids @objectclass @common.display_status @objectclass @common.display_port43 @objectclass @common.display_events @objectclass @jcard.adrs.each do |adr| if adr.type.empty? @config.logger.extra "Address", "-- for #{get_cn} --" else @config.logger.extra "Address", "( #{adr.type.join( ", " )} )" end if adr.structured @config.logger.extra "P.O. Box", adr.pobox @config.logger.extra "Apt/Suite", adr.extended @config.logger.extra "Street", adr.street @config.logger.extra "City", adr.locality @config.logger.extra "Region", adr.region @config.logger.extra "Postal Code", adr.postal @config.logger.extra "Country", adr.country else i = 1 adr.label.each do |line| @config.logger.extra i.to_s, line i = i + 1 end end end @config.logger.extra "Kind", @jcard.kind @common.display_as_events_actors @asEventActors @common.display_remarks @objectclass @common.display_links( get_cn, @objectclass ) @config.logger.end_data_item end
get_cn()
click to toggle source
# File lib/nicinfo/entity.rb, line 368 def get_cn handle = NicInfo::get_handle @objectclass handle = "(unidentifiable entity #{object_id})" if !handle if !@jcard.fns.empty? return "#{@jcard.fns[ 0 ] } ( #{handle} )" end return handle end
process(json_data)
click to toggle source
# File lib/nicinfo/entity.rb, line 255 def process json_data @objectclass = json_data @jcard.process json_data events = @objectclass[ "asEventActor" ] events.each do |event| eventActor = EventActor.new eventActor.eventAction=event[ "eventAction" ] eventActor.eventDate=event[ "eventDate" ] eventActor.related=NicInfo.get_related_link( NicInfo.get_links( event, @config ) ) @asEvents << eventActor end if events @selfhref = NicInfo::get_self_link( NicInfo::get_links( @objectclass, @config ) ) @entities = @common.process_entities @objectclass @networks = Array.new json_networks = NicInfo::get_networks( @objectclass ) json_networks.each do |json_network| if json_network.is_a?( Hash ) network = @config.factory.new_ip network.process( json_network ) @networks << network else @config.conf_msgs << "'networks' contains a string and not an object" end end if json_networks @autnums = Array.new json_autnums = NicInfo::get_autnums( @objectclass ) json_autnums.each do |json_autnum| if json_autnum.is_a?( Hash ) autnum = @config.factory.new_autnum autnum.process( json_autnum ) @autnums << autnum else @config.conf_msgs << "'autnums' contains a string and not an object" end end if json_autnums return self end
to_node()
click to toggle source
# File lib/nicinfo/entity.rb, line 377 def to_node DataNode.new( get_cn, nil, @selfhref ) end