Class: BGPView::Upstreams
- Inherits:
-
Object
- Object
- BGPView::Upstreams
- Defined in:
- lib/bgpview/upstreams.rb
Constant Summary collapse
- @@cache =
{}
Instance Attribute Summary collapse
-
#ipv4 ⇒ Object
readonly
Returns the value of attribute ipv4.
-
#ipv6 ⇒ Object
readonly
Returns the value of attribute ipv6.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(number) ⇒ Upstreams
constructor
A new instance of Upstreams.
Constructor Details
#initialize(number) ⇒ Upstreams
Returns a new instance of Upstreams.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/bgpview/upstreams.rb', line 12 def initialize(number) BGPView::Number.check(number) upstreams = BGPView::API.call("asn/#{number}/upstreams") @ipv4 = extract_as(upstreams, 'ipv4') @ipv6 = extract_as(upstreams, 'ipv6') @@cache[number] = self end |
Instance Attribute Details
#ipv4 ⇒ Object (readonly)
Returns the value of attribute ipv4.
10 11 12 |
# File 'lib/bgpview/upstreams.rb', line 10 def ipv4 @ipv4 end |
#ipv6 ⇒ Object (readonly)
Returns the value of attribute ipv6.
10 11 12 |
# File 'lib/bgpview/upstreams.rb', line 10 def ipv6 @ipv6 end |
Class Method Details
.find(number) ⇒ Object
23 24 25 |
# File 'lib/bgpview/upstreams.rb', line 23 def self.find(number) @@cache.key?(number) ? @@cache[number] : new(number) end |