Class: Aws::Endpoints::URL Private

Inherits:
Object
  • Object
show all
Defined in:
lib/aws-sdk-core/endpoints/url.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ URL

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of URL.

Raises:

  • (ArgumentError)


10
11
12
13
14
15
16
17
18
19
20
21
22
23
# 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

Instance Attribute Details

#authorityObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



26
27
28
# File 'lib/aws-sdk-core/endpoints/url.rb', line 26

def authority
  @authority
end

#is_ipObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



29
30
31
# File 'lib/aws-sdk-core/endpoints/url.rb', line 29

def is_ip
  @is_ip
end

#normalized_pathObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



28
29
30
# File 'lib/aws-sdk-core/endpoints/url.rb', line 28

def normalized_path
  @normalized_path
end

#pathObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



27
28
29
# File 'lib/aws-sdk-core/endpoints/url.rb', line 27

def path
  @path
end

#schemeObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



25
26
27
# File 'lib/aws-sdk-core/endpoints/url.rb', line 25

def scheme
  @scheme
end

Instance Method Details

#as_json(_options = {}) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



31
32
33
34
35
36
37
38
39
# 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