Class: NicInfo::Entity
- Inherits:
-
Object
- Object
- NicInfo::Entity
- Defined in:
- lib/nicinfo/entity.rb
Overview
deals with RDAP entity structures
Instance Attribute Summary collapse
-
#asEventActors ⇒ Object
Returns the value of attribute asEventActors.
-
#asEvents ⇒ Object
Returns the value of attribute asEvents.
-
#autnums ⇒ Object
Returns the value of attribute autnums.
-
#entities ⇒ Object
Returns the value of attribute entities.
-
#networks ⇒ Object
Returns the value of attribute networks.
-
#objectclass ⇒ Object
Returns the value of attribute objectclass.
-
#selfhref ⇒ Object
Returns the value of attribute selfhref.
Instance Method Summary collapse
- #display ⇒ Object
- #get_cn ⇒ Object
-
#initialize(config) ⇒ Entity
constructor
A new instance of Entity.
- #process(json_data) ⇒ Object
- #to_node ⇒ Object
Constructor Details
#initialize(config) ⇒ Entity
Returns a new instance of Entity.
242 243 244 245 246 247 248 249 250 251 |
# File 'lib/nicinfo/entity.rb', line 242 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 |
Instance Attribute Details
#asEventActors ⇒ Object
Returns the value of attribute asEventActors.
239 240 241 |
# File 'lib/nicinfo/entity.rb', line 239 def asEventActors @asEventActors end |
#asEvents ⇒ Object
Returns the value of attribute asEvents.
238 239 240 |
# File 'lib/nicinfo/entity.rb', line 238 def asEvents @asEvents end |
#autnums ⇒ Object
Returns the value of attribute autnums.
240 241 242 |
# File 'lib/nicinfo/entity.rb', line 240 def autnums @autnums end |
#entities ⇒ Object
Returns the value of attribute entities.
239 240 241 |
# File 'lib/nicinfo/entity.rb', line 239 def entities @entities end |
#networks ⇒ Object
Returns the value of attribute networks.
240 241 242 |
# File 'lib/nicinfo/entity.rb', line 240 def networks @networks end |
#objectclass ⇒ Object
Returns the value of attribute objectclass.
239 240 241 |
# File 'lib/nicinfo/entity.rb', line 239 def objectclass @objectclass end |
#selfhref ⇒ Object
Returns the value of attribute selfhref.
238 239 240 |
# File 'lib/nicinfo/entity.rb', line 238 def selfhref @selfhref end |
Instance Method Details
#display ⇒ Object
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 |
# File 'lib/nicinfo/entity.rb', line 291 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 ⇒ Object
366 367 368 369 370 371 372 373 |
# File 'lib/nicinfo/entity.rb', line 366 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) ⇒ Object
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 |
# File 'lib/nicinfo/entity.rb', line 253 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.=NicInfo.( 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 ⇒ Object
375 376 377 |
# File 'lib/nicinfo/entity.rb', line 375 def to_node DataNode.new( get_cn, nil, @selfhref ) end |