class Aws::Endpoints::URL
@api private
Attributes
is_ip[R]
normalized_path[R]
path[R]
scheme[R]
Public Class Methods
new(url)
click to toggle source
# File lib/aws-sdk-core/endpoints/url.rb, line 10 def initialize(url) uri = URI(url) @scheme = uri.scheme # only support http and https schemes raise ArgumentError unless %w[https http].include?(@scheme) # do not support query raise ArgumentError if uri.query @authority = _authority(url, uri) @path = uri.path @normalized_path = uri.path + (uri.path[-1] == '/' ? '' : '/') @is_ip = _is_ip(uri.host) end
Public Instance Methods
as_json(_options = {})
click to toggle source
# File lib/aws-sdk-core/endpoints/url.rb, line 31 def as_json(_options = {}) { 'scheme' => scheme, 'authority' => authority, 'path' => path, 'normalizedPath' => normalized_path, 'isIp' => is_ip } end
Private Instance Methods
_is_ip(authority)
click to toggle source
# File lib/aws-sdk-core/endpoints/url.rb, line 52 def _is_ip(authority) IPAddr.new(authority) true rescue IPAddr::InvalidAddressError false end