nicinfo 1.3.0.pre.alpha1 → 1.3.0.pre.alpha2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/nicinfo/autnum.rb +2 -2
- data/lib/nicinfo/common_json.rb +15 -14
- data/lib/nicinfo/config.rb +5 -3
- data/lib/nicinfo/constants.rb +1 -1
- data/lib/nicinfo/domain.rb +3 -3
- data/lib/nicinfo/entity.rb +4 -4
- data/lib/nicinfo/error_code.rb +17 -11
- data/lib/nicinfo/factory.rb +56 -0
- data/lib/nicinfo/ip.rb +2 -2
- data/lib/nicinfo/nicinfo_main.rb +8 -6
- data/lib/nicinfo/notices.rb +33 -27
- data/lib/nicinfo/ns.rb +2 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1541e4e748c2ac0eeddfefd4288d65ea85af1826
|
4
|
+
data.tar.gz: 49e3d7584b192966fe458b2cd57911d4e48d244e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a0849a883b4cd8339ee447054c1dbcd5638403b7e75038c507c8dcb6a48a4accacb862c005fa45da22c93590072502478b9011461b0a586cc7ecd0277a8ef55
|
7
|
+
data.tar.gz: cacddfe85ad2b640fd8b7622ca098dd7f3c4abca3e5245fdedf0c377935b3364395cb0b74ff272d2845f3b49f0b83f1495cb122f2ae71c668a85afbc0a42269b
|
data/lib/nicinfo/autnum.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2011
|
1
|
+
# Copyright (C) 2011-2017 American Registry for Internet Numbers
|
2
2
|
#
|
3
3
|
# Permission to use, copy, modify, and/or distribute this software for any
|
4
4
|
# purpose with or without fee is hereby granted, provided that the above
|
@@ -22,7 +22,7 @@ require 'nicinfo/data_tree'
|
|
22
22
|
module NicInfo
|
23
23
|
|
24
24
|
def NicInfo.display_autnum json_data, config, data_tree
|
25
|
-
autnum =
|
25
|
+
autnum = config.factory.new_autnum.process( json_data )
|
26
26
|
NicInfo::display_object_with_entities( autnum, config, data_tree )
|
27
27
|
end
|
28
28
|
|
data/lib/nicinfo/common_json.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2011
|
1
|
+
# Copyright (C) 2011-2017 American Registry for Internet Numbers
|
2
2
|
#
|
3
3
|
# Permission to use, copy, modify, and/or distribute this software for any
|
4
4
|
# purpose with or without fee is hereby granted, provided that the above
|
@@ -67,7 +67,7 @@ module NicInfo
|
|
67
67
|
entities = Array.new
|
68
68
|
json_entities = NicInfo::get_entitites( objectclass )
|
69
69
|
json_entities.each do |json_entity|
|
70
|
-
entity =
|
70
|
+
entity = @config.factory.new_entity
|
71
71
|
entity.process( json_entity )
|
72
72
|
entities << entity
|
73
73
|
end if json_entities
|
@@ -76,14 +76,15 @@ module NicInfo
|
|
76
76
|
|
77
77
|
def display_remarks objectclass
|
78
78
|
remarks = objectclass[ "remarks" ]
|
79
|
-
if
|
80
|
-
@config.
|
81
|
-
|
82
|
-
|
83
|
-
|
79
|
+
if remarks
|
80
|
+
excessive_notice = @config.factory.new_notices.is_excessive_notice(remarks)
|
81
|
+
if (excessive_notice && (@config.logger.data_amount != NicInfo::DataAmount::EXTRA_DATA))
|
82
|
+
@config.logger.datum "Excessive Remarks", "Use \"-V\" or \"--data extra\" to see them."
|
83
|
+
else
|
84
|
+
if remarks.instance_of?(Array)
|
84
85
|
remarks.each do |remark|
|
85
|
-
if remark.instance_of?(
|
86
|
-
title = remark[
|
86
|
+
if remark.instance_of?(Hash)
|
87
|
+
title = remark["title"]
|
87
88
|
@config.logger.datum "Remarks", "-- #{title} --" if title
|
88
89
|
descriptions = NicInfo::get_descriptions remark, @config
|
89
90
|
i = 1
|
@@ -97,11 +98,11 @@ module NicInfo
|
|
97
98
|
end if descriptions
|
98
99
|
links = NicInfo::get_links remark, @config
|
99
100
|
if links
|
100
|
-
@config.logger.datum "More", NicInfo::get_alternate_link(
|
101
|
-
@config.logger.datum "About", NicInfo::get_about_link(
|
102
|
-
@config.logger.datum "TOS", NicInfo::get_tos_link(
|
103
|
-
@config.logger.datum "(C)", NicInfo::get_copyright_link(
|
104
|
-
@config.logger.datum "License", NicInfo::get_license_link(
|
101
|
+
@config.logger.datum "More", NicInfo::get_alternate_link(links)
|
102
|
+
@config.logger.datum "About", NicInfo::get_about_link(links)
|
103
|
+
@config.logger.datum "TOS", NicInfo::get_tos_link(links)
|
104
|
+
@config.logger.datum "(C)", NicInfo::get_copyright_link(links)
|
105
|
+
@config.logger.datum "License", NicInfo::get_license_link(links)
|
105
106
|
end
|
106
107
|
else
|
107
108
|
@config.conf_msgs << "remark is not an object."
|
data/lib/nicinfo/config.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2011
|
1
|
+
# Copyright (C) 2011-2017 American Registry for Internet Numbers
|
2
2
|
#
|
3
3
|
# Permission to use, copy, modify, and/or distribute this software for any
|
4
4
|
# purpose with or without fee is hereby granted, provided that the above
|
@@ -15,9 +15,10 @@
|
|
15
15
|
|
16
16
|
require 'fileutils'
|
17
17
|
require 'time'
|
18
|
-
require 'nicinfo/nicinfo_logger'
|
19
18
|
require 'yaml'
|
20
19
|
require 'ostruct'
|
20
|
+
require 'nicinfo/nicinfo_logger'
|
21
|
+
require 'nicinfo/factory'
|
21
22
|
require 'nicinfo/constants'
|
22
23
|
|
23
24
|
module NicInfo
|
@@ -25,7 +26,7 @@ module NicInfo
|
|
25
26
|
# Handles configuration of the application
|
26
27
|
class Config
|
27
28
|
|
28
|
-
attr_accessor :logger, :config, :rdap_cache_dir, :options, :conf_msgs, :rdap_bootstrap_dir
|
29
|
+
attr_accessor :logger, :config, :rdap_cache_dir, :options, :conf_msgs, :rdap_bootstrap_dir, :factory
|
29
30
|
|
30
31
|
# Intializes the configuration with a place to look for the config file
|
31
32
|
# If the file doesn't exist, a default is used.
|
@@ -36,6 +37,7 @@ module NicInfo
|
|
36
37
|
@app_data = app_data
|
37
38
|
@logger = NicInfo::Logger.new
|
38
39
|
@conf_msgs = Array.new
|
40
|
+
@factory = NicInfo::Factory.new( self )
|
39
41
|
|
40
42
|
config_file_name = Config.formulate_config_file_name( @app_data )
|
41
43
|
if File.exist?( config_file_name )
|
data/lib/nicinfo/constants.rb
CHANGED
data/lib/nicinfo/domain.rb
CHANGED
@@ -32,7 +32,7 @@ module NicInfo
|
|
32
32
|
end
|
33
33
|
respObjs = ResponseObjSet.new config
|
34
34
|
obj_array.each do |array_object|
|
35
|
-
domain =
|
35
|
+
domain = config.factory.new_domain.process( array_object )
|
36
36
|
root = domain.to_node
|
37
37
|
data_node.add_root( root )
|
38
38
|
if !domain.entities.empty? or !domain.nameservers.empty?
|
@@ -112,13 +112,13 @@ module NicInfo
|
|
112
112
|
@entities = @common.process_entities @objectclass
|
113
113
|
json_nses = NicInfo::get_nameservers json_data
|
114
114
|
json_nses.each do |json_ns|
|
115
|
-
ns =
|
115
|
+
ns = @config.factory.new_ns
|
116
116
|
ns.process( json_ns )
|
117
117
|
@nameservers << ns
|
118
118
|
end if json_nses
|
119
119
|
json_net = NicInfo::get_network json_data
|
120
120
|
if json_net
|
121
|
-
ip =
|
121
|
+
ip = @config.factory.new_ip
|
122
122
|
ip.process json_net
|
123
123
|
@network = ip
|
124
124
|
end
|
data/lib/nicinfo/entity.rb
CHANGED
@@ -21,7 +21,7 @@ require 'nicinfo/data_tree'
|
|
21
21
|
module NicInfo
|
22
22
|
|
23
23
|
def NicInfo.display_entity json_data, config, data_tree
|
24
|
-
entity =
|
24
|
+
entity = config.factory.new_entity.process( json_data )
|
25
25
|
|
26
26
|
respobjs = ResponseObjSet.new config
|
27
27
|
root = entity.to_node
|
@@ -64,7 +64,7 @@ module NicInfo
|
|
64
64
|
if entity_array.instance_of? Array
|
65
65
|
display_array = Array.new
|
66
66
|
entity_array.each do |ea|
|
67
|
-
entity =
|
67
|
+
entity = config.factory.new_entity.process( ea )
|
68
68
|
display_array << entity
|
69
69
|
end
|
70
70
|
NicInfo.display_object_with_entities( display_array, config, data_tree )
|
@@ -258,7 +258,7 @@ module NicInfo
|
|
258
258
|
json_networks = NicInfo::get_networks( @objectclass )
|
259
259
|
json_networks.each do |json_network|
|
260
260
|
if json_network.is_a?( Hash )
|
261
|
-
network =
|
261
|
+
network = @config.factory.new_ip
|
262
262
|
network.process( json_network )
|
263
263
|
@networks << network
|
264
264
|
else
|
@@ -269,7 +269,7 @@ module NicInfo
|
|
269
269
|
json_autnums = NicInfo::get_autnums( @objectclass )
|
270
270
|
json_autnums.each do |json_autnum|
|
271
271
|
if json_autnum.is_a?( Hash )
|
272
|
-
autnum =
|
272
|
+
autnum = @config.factory.new_autnum
|
273
273
|
autnum.process( json_autnum )
|
274
274
|
@autnums << autnum
|
275
275
|
else
|
data/lib/nicinfo/error_code.rb
CHANGED
@@ -21,34 +21,40 @@ module NicInfo
|
|
21
21
|
# deals with RDAP error code structures
|
22
22
|
class ErrorCode
|
23
23
|
|
24
|
-
|
25
|
-
|
24
|
+
attr_accessor :config
|
25
|
+
|
26
|
+
def initialize( config )
|
27
|
+
@config = config
|
28
|
+
end
|
29
|
+
|
30
|
+
def display_error_code ec
|
31
|
+
@config.logger.start_data_item
|
26
32
|
title = ec[ "title" ]
|
27
33
|
if title == nil
|
28
34
|
title = ""
|
29
35
|
end
|
30
|
-
config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "[ ERROR ]", title
|
31
|
-
config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "Code", ec[ "errorCode" ]
|
36
|
+
@config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "[ ERROR ]", title
|
37
|
+
@config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "Code", ec[ "errorCode" ]
|
32
38
|
description = ec[ "description" ]
|
33
39
|
i = 1
|
34
40
|
description.each do |line|
|
35
|
-
config.logger.prose NicInfo::DataAmount::NORMAL_DATA, i.to_s, line
|
41
|
+
@config.logger.prose NicInfo::DataAmount::NORMAL_DATA, i.to_s, line
|
36
42
|
i = i + 1
|
37
43
|
end
|
38
44
|
links = ec[ "links" ]
|
39
45
|
if links
|
40
46
|
alternate = NicInfo.get_alternate_link links
|
41
|
-
config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "More", alternate if alternate
|
47
|
+
@config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "More", alternate if alternate
|
42
48
|
about = NicInfo.get_about_link links
|
43
|
-
config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "About", about if about
|
49
|
+
@config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "About", about if about
|
44
50
|
tos = NicInfo.get_tos_link links
|
45
|
-
config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "TOS", tos if tos
|
51
|
+
@config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "TOS", tos if tos
|
46
52
|
copyright = NicInfo.get_copyright_link links
|
47
|
-
config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "(C)", copyright if copyright
|
53
|
+
@config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "(C)", copyright if copyright
|
48
54
|
license = NicInfo.get_license_link links
|
49
|
-
config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "License", license if license
|
55
|
+
@config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "License", license if license
|
50
56
|
end
|
51
|
-
config.logger.end_data_item
|
57
|
+
@config.logger.end_data_item
|
52
58
|
end
|
53
59
|
|
54
60
|
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# Copyright (C) 2017 American Registry for Internet Numbers
|
2
|
+
#
|
3
|
+
# Permission to use, copy, modify, and/or distribute this software for any
|
4
|
+
# purpose with or without fee is hereby granted, provided that the above
|
5
|
+
# copyright notice and this permission notice appear in all copies.
|
6
|
+
#
|
7
|
+
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
8
|
+
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
9
|
+
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
10
|
+
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
11
|
+
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
12
|
+
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
13
|
+
# IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
14
|
+
|
15
|
+
module NicInfo
|
16
|
+
|
17
|
+
# Creates objects we want to mock
|
18
|
+
class Factory
|
19
|
+
|
20
|
+
attr_accessor :config
|
21
|
+
|
22
|
+
def initialize( config )
|
23
|
+
@config = config
|
24
|
+
end
|
25
|
+
|
26
|
+
def new_error_code
|
27
|
+
return ErrorCode.new( config )
|
28
|
+
end
|
29
|
+
|
30
|
+
def new_autnum
|
31
|
+
return Autnum.new( config )
|
32
|
+
end
|
33
|
+
|
34
|
+
def new_domain
|
35
|
+
return Domain.new( config )
|
36
|
+
end
|
37
|
+
|
38
|
+
def new_entity
|
39
|
+
return Entity.new( config )
|
40
|
+
end
|
41
|
+
|
42
|
+
def new_ip
|
43
|
+
return Ip.new( config )
|
44
|
+
end
|
45
|
+
|
46
|
+
def new_notices
|
47
|
+
return Notices.new( config )
|
48
|
+
end
|
49
|
+
|
50
|
+
def new_ns
|
51
|
+
return Ns.new( config )
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
data/lib/nicinfo/ip.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2011
|
1
|
+
# Copyright (C) 2011-2017 American Registry for Internet Numbers
|
2
2
|
#
|
3
3
|
# Permission to use, copy, modify, and/or distribute this software for any
|
4
4
|
# purpose with or without fee is hereby granted, provided that the above
|
@@ -25,7 +25,7 @@ require 'nicinfo/cidrs'
|
|
25
25
|
module NicInfo
|
26
26
|
|
27
27
|
def NicInfo.display_ip json_data, config, data_tree
|
28
|
-
ip =
|
28
|
+
ip = config.factory.new_ip.process( json_data )
|
29
29
|
NicInfo::display_object_with_entities( ip, config, data_tree )
|
30
30
|
end
|
31
31
|
|
data/lib/nicinfo/nicinfo_main.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2011
|
1
|
+
# Copyright (C) 2011-2017 American Registry for Internet Numbers
|
2
2
|
#
|
3
3
|
# Permission to use, copy, modify, and/or distribute this software for any
|
4
4
|
# purpose with or without fee is hereby granted, provided that the above
|
@@ -506,7 +506,7 @@ module NicInfo
|
|
506
506
|
end
|
507
507
|
else
|
508
508
|
json_data = do_rdap_query
|
509
|
-
display_rdap_query( json_data, true )
|
509
|
+
display_rdap_query( json_data, true ) if json_data
|
510
510
|
end
|
511
511
|
|
512
512
|
|
@@ -521,6 +521,7 @@ module NicInfo
|
|
521
521
|
end
|
522
522
|
|
523
523
|
def do_rdap_query
|
524
|
+
retval = nil
|
524
525
|
if @config.config[ NicInfo::BOOTSTRAP ][ NicInfo::BOOTSTRAP_URL ] == nil && !@config.options.url
|
525
526
|
bootstrap = Bootstrap.new( @config )
|
526
527
|
qtype = @config.options.query_type
|
@@ -578,7 +579,7 @@ module NicInfo
|
|
578
579
|
end
|
579
580
|
inspect_rdap_compliance json_data
|
580
581
|
cache_self_references json_data
|
581
|
-
json_data
|
582
|
+
retval = json_data
|
582
583
|
rescue JSON::ParserError => a
|
583
584
|
@config.logger.mesg( "Server returned invalid JSON!" )
|
584
585
|
rescue SocketError => a
|
@@ -617,6 +618,7 @@ module NicInfo
|
|
617
618
|
end
|
618
619
|
@config.logger.trace("Server response code was " + e.response.code)
|
619
620
|
end
|
621
|
+
return retval
|
620
622
|
end
|
621
623
|
|
622
624
|
def display_rdap_query json_data, show_help = true
|
@@ -627,7 +629,7 @@ module NicInfo
|
|
627
629
|
@config.logger.raw( DataAmount::TERSE_DATA, eval_json_value( value, json_data), false )
|
628
630
|
end
|
629
631
|
else
|
630
|
-
|
632
|
+
@config.factory.new_notices.display_notices json_data, @config.options.query_type == QueryType::BY_SERVER_HELP
|
631
633
|
if @config.options.query_type != QueryType::BY_SERVER_HELP
|
632
634
|
result_type = get_query_type_from_result( json_data )
|
633
635
|
if result_type != nil
|
@@ -694,8 +696,8 @@ module NicInfo
|
|
694
696
|
if res["content-type"] == NicInfo::RDAP_CONTENT_TYPE && res.body && res.body.to_s.size > 0
|
695
697
|
json_data = JSON.load( res.body )
|
696
698
|
inspect_rdap_compliance json_data
|
697
|
-
|
698
|
-
|
699
|
+
@config.factory.new_notices.display_notices json_data, true
|
700
|
+
@config.factory.new_error_code.display_error_code( json_data )
|
699
701
|
end
|
700
702
|
end
|
701
703
|
|
data/lib/nicinfo/notices.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2011
|
1
|
+
# Copyright (C) 2011-2017 American Registry for Internet Numbers
|
2
2
|
#
|
3
3
|
# Permission to use, copy, modify, and/or distribute this software for any
|
4
4
|
# purpose with or without fee is hereby granted, provided that the above
|
@@ -21,14 +21,20 @@ module NicInfo
|
|
21
21
|
# deals with RDAP notices structures
|
22
22
|
class Notices
|
23
23
|
|
24
|
-
|
24
|
+
attr_accessor :config
|
25
|
+
|
26
|
+
def initialize( config )
|
27
|
+
@config = config
|
28
|
+
end
|
29
|
+
|
30
|
+
def is_excessive_notice notices
|
25
31
|
return false if !notices
|
26
32
|
return false if notices.length == 0
|
27
33
|
return true if notices.length > 2
|
28
34
|
word_count = 0
|
29
35
|
line_count = 0
|
30
36
|
notices.each do |notice|
|
31
|
-
descriptions = NicInfo::get_descriptions notice, config
|
37
|
+
descriptions = NicInfo::get_descriptions notice, @config
|
32
38
|
descriptions.each do |line|
|
33
39
|
line_count = line_count + 1
|
34
40
|
word_count = word_count + line.length
|
@@ -40,69 +46,69 @@ module NicInfo
|
|
40
46
|
return false
|
41
47
|
end
|
42
48
|
|
43
|
-
def display_notices json_response,
|
49
|
+
def display_notices json_response, ignore_excessive
|
44
50
|
|
45
51
|
notices = json_response[ "notices" ]
|
46
52
|
return if notices == nil
|
47
|
-
if (
|
48
|
-
config.logger.start_data_item
|
49
|
-
config.logger.raw NicInfo::DataAmount::NORMAL_DATA, "Excessive Notices"
|
50
|
-
config.logger.raw NicInfo::DataAmount::NORMAL_DATA, "-----------------"
|
51
|
-
config.logger.raw NicInfo::DataAmount::NORMAL_DATA, "Response contains excessive notices."
|
52
|
-
config.logger.raw NicInfo::DataAmount::NORMAL_DATA, "Use the \"-V\" or \"--data extra\" options to see them."
|
53
|
-
config.logger.end_data_item
|
53
|
+
if (is_excessive_notice(notices) ) && (@config.logger.data_amount != NicInfo::DataAmount::EXTRA_DATA) && !ignore_excessive
|
54
|
+
@config.logger.start_data_item
|
55
|
+
@config.logger.raw NicInfo::DataAmount::NORMAL_DATA, "Excessive Notices"
|
56
|
+
@config.logger.raw NicInfo::DataAmount::NORMAL_DATA, "-----------------"
|
57
|
+
@config.logger.raw NicInfo::DataAmount::NORMAL_DATA, "Response contains excessive notices."
|
58
|
+
@config.logger.raw NicInfo::DataAmount::NORMAL_DATA, "Use the \"-V\" or \"--data extra\" options to see them."
|
59
|
+
@config.logger.end_data_item
|
54
60
|
else
|
55
61
|
notices.each do |notice|
|
56
|
-
display_single_notice notice
|
62
|
+
display_single_notice notice
|
57
63
|
end
|
58
64
|
end
|
59
65
|
|
60
66
|
end
|
61
67
|
|
62
|
-
def display_single_notice notice
|
63
|
-
config.logger.start_data_item
|
68
|
+
def display_single_notice notice
|
69
|
+
@config.logger.start_data_item
|
64
70
|
title = notice[ "title" ]
|
65
71
|
if title == nil
|
66
72
|
title = ""
|
67
73
|
end
|
68
|
-
config.conf_msgs << "'title' in 'notice' is not a string." unless title.instance_of?( String )
|
69
|
-
config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "[ NOTICE ]", title
|
74
|
+
@config.conf_msgs << "'title' in 'notice' is not a string." unless title.instance_of?( String )
|
75
|
+
@config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "[ NOTICE ]", title
|
70
76
|
type = notice[ "type" ]
|
71
77
|
if type != nil
|
72
|
-
config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "Type", NicInfo.capitalize( type )
|
78
|
+
@config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "Type", NicInfo.capitalize( type )
|
73
79
|
end
|
74
80
|
description = notice[ "description" ]
|
75
81
|
i = 1
|
76
82
|
if description.instance_of?( Array )
|
77
83
|
description.each do |line|
|
78
84
|
if line.instance_of?( String )
|
79
|
-
config.logger.prose NicInfo::DataAmount::NORMAL_DATA, i.to_s, line
|
85
|
+
@config.logger.prose NicInfo::DataAmount::NORMAL_DATA, i.to_s, line
|
80
86
|
i = i + 1
|
81
87
|
else
|
82
|
-
config.conf_msgs << "eleemnt of 'description' in 'notice' is not a string."
|
88
|
+
@config.conf_msgs << "eleemnt of 'description' in 'notice' is not a string."
|
83
89
|
end
|
84
90
|
end
|
85
91
|
else
|
86
|
-
config.conf_msgs << "'description' in 'notice' is not an array."
|
92
|
+
@config.conf_msgs << "'description' in 'notice' is not an array."
|
87
93
|
end
|
88
94
|
links = notice[ "links" ]
|
89
95
|
if links
|
90
96
|
if links.instance_of?( Array )
|
91
97
|
alternate = NicInfo.get_alternate_link links
|
92
|
-
config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "More", alternate if alternate
|
98
|
+
@config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "More", alternate if alternate
|
93
99
|
about = NicInfo.get_about_link links
|
94
|
-
config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "About", about if about
|
100
|
+
@config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "About", about if about
|
95
101
|
tos = NicInfo.get_tos_link links
|
96
|
-
config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "TOS", tos if tos
|
102
|
+
@config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "TOS", tos if tos
|
97
103
|
copyright = NicInfo.get_copyright_link links
|
98
|
-
config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "(C)", copyright if copyright
|
104
|
+
@config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "(C)", copyright if copyright
|
99
105
|
license = NicInfo.get_license_link links
|
100
|
-
config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "License", license if license
|
106
|
+
@config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "License", license if license
|
101
107
|
else
|
102
|
-
config.conf_msgs << "'links' is not an array."
|
108
|
+
@config.conf_msgs << "'links' is not an array."
|
103
109
|
end
|
104
110
|
end
|
105
|
-
config.logger.end_data_item
|
111
|
+
@config.logger.end_data_item
|
106
112
|
end
|
107
113
|
|
108
114
|
end
|
data/lib/nicinfo/ns.rb
CHANGED
@@ -22,7 +22,7 @@ require 'nicinfo/data_tree'
|
|
22
22
|
module NicInfo
|
23
23
|
|
24
24
|
def NicInfo.display_ns json_data, config, data_node
|
25
|
-
ns =
|
25
|
+
ns = config.factory.new_ns.process( json_data )
|
26
26
|
NicInfo::display_object_with_entities( ns, config, data_node )
|
27
27
|
end
|
28
28
|
|
@@ -32,7 +32,7 @@ module NicInfo
|
|
32
32
|
if ns_array.instance_of? Array
|
33
33
|
display_array = Array.new
|
34
34
|
ns_array.each do |ea|
|
35
|
-
ns =
|
35
|
+
ns = config.factory.new_ns.process( ea )
|
36
36
|
display_array << ns
|
37
37
|
end
|
38
38
|
NicInfo::display_object_with_entities( display_array, config, data_node )
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nicinfo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.0.pre.
|
4
|
+
version: 1.3.0.pre.alpha2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Newton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: netaddr
|
@@ -74,6 +74,7 @@ files:
|
|
74
74
|
- lib/nicinfo/entity.rb
|
75
75
|
- lib/nicinfo/enum.rb
|
76
76
|
- lib/nicinfo/error_code.rb
|
77
|
+
- lib/nicinfo/factory.rb
|
77
78
|
- lib/nicinfo/female-first-names.txt
|
78
79
|
- lib/nicinfo/ip.rb
|
79
80
|
- lib/nicinfo/key_data.rb
|
@@ -105,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
106
|
version: 1.3.1
|
106
107
|
requirements: []
|
107
108
|
rubyforge_project:
|
108
|
-
rubygems_version: 2.6.
|
109
|
+
rubygems_version: 2.6.14
|
109
110
|
signing_key:
|
110
111
|
specification_version: 4
|
111
112
|
summary: RDAP Client
|