Class: AwsIp::Range
- Inherits:
-
Object
- Object
- AwsIp::Range
- Defined in:
- lib/aws_ip/range.rb
Constant Summary collapse
- BASE_URI =
'https://ip-ranges.amazonaws.com/ip-ranges.json'
Instance Method Summary collapse
- #get ⇒ Object
-
#initialize ⇒ Range
constructor
A new instance of Range.
Constructor Details
Instance Method Details
#get ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/aws_ip/range.rb', line 14 def get connection = if @proxy Net::HTTP::Proxy(@proxy.host, @proxy.port, @proxy.user, @proxy.password).new(@uri.host, @uri.port) else Net::HTTP.new(@uri.host, @uri.port) end connection.use_ssl = true response = connection.start { |http| http.get(@uri) } case response when Net::HTTPSuccess json = response.body JSON.parse(json) else # raise excpetion response.value end rescue => e puts e.stacktrace if ENV['DEBUG'] abort [e., @uri].join(' : ') end |