Class: BGPView::Downstreams

Inherits:
Object
  • Object
show all
Defined in:
lib/bgpview/downstreams.rb

Constant Summary collapse

@@cache =
{}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(number) ⇒ Downstreams

Returns a new instance of Downstreams.



12
13
14
15
16
17
18
19
20
21
# File 'lib/bgpview/downstreams.rb', line 12

def initialize(number)
  BGPView::Number.check(number)

  downstreams = BGPView::API.call("asn/#{number}/downstreams")

  @ipv4 = extract_as(downstreams, 'ipv4')
  @ipv6 = extract_as(downstreams, 'ipv6')

  @@cache[number] = self
end

Instance Attribute Details

#ipv4Object (readonly)

Returns the value of attribute ipv4.



10
11
12
# File 'lib/bgpview/downstreams.rb', line 10

def ipv4
  @ipv4
end

#ipv6Object (readonly)

Returns the value of attribute ipv6.



10
11
12
# File 'lib/bgpview/downstreams.rb', line 10

def ipv6
  @ipv6
end

Class Method Details

.find(number) ⇒ Object



23
24
25
# File 'lib/bgpview/downstreams.rb', line 23

def self.find(number)
  @@cache.key?(number) ? @@cache[number] : new(number)
end