module Irrc::Whoisd::Api
Private Instance Methods
error_code()
click to toggle source
See www.ripe.net/data-tools/support/documentation/ripe-database-query-reference-manual#a1–ripe-database-query-server-response-codes-and-messages for the error code
# File lib/irrc/whoisd/api.rb, line 37 def error_code /^%ERROR:(.*)$/ end
expand_aut_num_command(autnum, sources)
click to toggle source
# File lib/irrc/whoisd/api.rb, line 28 def expand_aut_num_command(autnum, sources) "-k -r #{source_option(sources)} -K -i origin #{autnum}" end
expand_route_set_command(route_set, sources)
click to toggle source
# File lib/irrc/whoisd/api.rb, line 20 def expand_route_set_command(route_set, sources) if sources && !sources.empty? "-k -r -s #{sources.join(',')} -T route-set #{route_set}" else "-k -r -a -T route-set #{route_set}" end end
expand_set_command(as_set, sources, type)
click to toggle source
# File lib/irrc/whoisd/api.rb, line 8 def expand_set_command(as_set, sources, type) "-k -r #{source_option(sources)} -T #{type} #{as_set}" end
parse_objects_from_set(result)
click to toggle source
# File lib/irrc/whoisd/api.rb, line 12 def parse_objects_from_set(result) if result =~ error_code raise $1 end result.scan(Irrc::Irr.members_tag).flatten.map {|i| i.split(/\s*,?\s+/)}.flatten end
parse_prefixes_from_aut_num(result, protocol)
click to toggle source
# File lib/irrc/whoisd/api.rb, line 32 def parse_prefixes_from_aut_num(result, protocol) result.scan(Irrc::Irr.route_tag(protocol)).flatten.uniq end
return_code()
click to toggle source
# File lib/irrc/whoisd/api.rb, line 41 def return_code /\n\n\n/ end
source_option(sources)
click to toggle source
# File lib/irrc/whoisd/api.rb, line 45 def source_option(sources) if sources && !sources.empty? "-s #{sources.join(',')}" else '-a' end end