Class: WSDL::Resolver::Source Private
- Inherits:
-
Object
- Object
- WSDL::Resolver::Source
- Defined in:
- lib/wsdl/resolver/source.rb
Overview
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.
Classifies WSDL and schema locations.
Supported location forms:
- HTTP(S) URL
- local file path (absolute or relative)
Constant Summary collapse
- HTTP_URL_PATTERN =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Pattern for matching HTTP/HTTPS URLs.
/\Ahttps?:/i- FILE_URL_PATTERN =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Pattern for matching file:// URLs.
/\Afile:/i- INLINE_XML_PATTERN =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Pattern for matching inline XML content.
/\A\s*</- URI_SCHEME_PATTERN =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Pattern for matching URI schemes.
/\A[a-z][a-z0-9+\-.]*:/i- WINDOWS_DRIVE_PREFIX_PATTERN =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Pattern for matching Windows drive prefixes (e.g., C:foo or C:\foo).
/\A[A-Za-z]:/- WINDOWS_DRIVE_ABSOLUTE_PATTERN =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Pattern for matching absolute Windows drive paths (e.g., C:\path or C:/path).
%r{\A[A-Za-z]:[\\/]}
Instance Attribute Summary collapse
- #value ⇒ String readonly private
Class Method Summary collapse
-
.validate_wsdl!(value) ⇒ Source
private
Validates a WSDL source input and returns a classified source.
Instance Method Summary collapse
- #absolute_file_path? ⇒ Boolean private
- #default_sandbox_paths ⇒ Array<String>? private
- #expanded_file_path ⇒ String private
- #file_path? ⇒ Boolean private
- #file_url? ⇒ Boolean private
-
#initialize(value) ⇒ Source
constructor
private
A new instance of Source.
- #inline_xml? ⇒ Boolean private
- #normalized_url ⇒ String private
- #relative_file_path? ⇒ Boolean private
-
#resolve_sandbox_paths(sandbox_paths) ⇒ Array<String>?
private
Resolves sandbox paths for this source.
- #sandbox_directory ⇒ String private
- #unsupported_scheme? ⇒ Boolean private
- #url? ⇒ Boolean private
Constructor Details
#initialize(value) ⇒ Source
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 Source.
69 70 71 |
# File 'lib/wsdl/resolver/source.rb', line 69 def initialize(value) @value = value end |
Instance Attribute Details
#value ⇒ String (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.
74 75 76 |
# File 'lib/wsdl/resolver/source.rb', line 74 def value @value end |
Class Method Details
.validate_wsdl!(value) ⇒ Source
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.
Validates a WSDL source input and returns a classified source.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/wsdl/resolver/source.rb', line 22 def validate_wsdl!(value) unless value.is_a?(String) && !value.empty? raise ArgumentError, 'WSDL source must be a non-empty String URL or file path' end source = new(value) if source.inline_xml? raise ArgumentError, 'Inline XML WSDL is not supported. Provide an HTTP(S) URL or a local file path.' end if source.file_url? raise ArgumentError, "file:// URLs are not supported: #{value.inspect}. " \ 'Provide an HTTP(S) URL or a local file path.' end if source.unsupported_scheme? raise ArgumentError, "Unsupported URL scheme for WSDL source #{value.inspect}. " \ 'Only HTTP(S) URLs and local file paths are supported.' end source end |
Instance Method Details
#absolute_file_path? ⇒ Boolean
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.
97 98 99 100 101 |
# File 'lib/wsdl/resolver/source.rb', line 97 def absolute_file_path? return false unless file_path? Pathname.new(@value).absolute? || windows_drive_absolute_path? end |
#default_sandbox_paths ⇒ Array<String>?
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.
131 132 133 134 135 136 |
# File 'lib/wsdl/resolver/source.rb', line 131 def default_sandbox_paths return nil if url? return [sandbox_directory] if file_path? nil end |
#expanded_file_path ⇒ String
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.
114 115 116 |
# File 'lib/wsdl/resolver/source.rb', line 114 def File.(@value) end |
#file_path? ⇒ Boolean
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.
92 93 94 |
# File 'lib/wsdl/resolver/source.rb', line 92 def file_path? !url? && !inline_xml? && !scheme? end |
#file_url? ⇒ Boolean
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.
82 83 84 |
# File 'lib/wsdl/resolver/source.rb', line 82 def file_url? @value.match?(FILE_URL_PATTERN) end |
#inline_xml? ⇒ Boolean
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.
87 88 89 |
# File 'lib/wsdl/resolver/source.rb', line 87 def inline_xml? @value.match?(INLINE_XML_PATTERN) end |
#normalized_url ⇒ String
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.
124 125 126 127 128 |
# File 'lib/wsdl/resolver/source.rb', line 124 def normalized_url URI.parse(@value).normalize.to_s rescue URI::InvalidURIError @value end |
#relative_file_path? ⇒ Boolean
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.
104 105 106 |
# File 'lib/wsdl/resolver/source.rb', line 104 def relative_file_path? file_path? && !absolute_file_path? end |
#resolve_sandbox_paths(sandbox_paths) ⇒ Array<String>?
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.
Resolves sandbox paths for this source.
When nil, falls back to #default_sandbox_paths which returns
the WSDL's parent directory for file sources or nil for URLs.
145 146 147 148 149 |
# File 'lib/wsdl/resolver/source.rb', line 145 def resolve_sandbox_paths(sandbox_paths) return sandbox_paths if sandbox_paths default_sandbox_paths end |
#sandbox_directory ⇒ String
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.
119 120 121 |
# File 'lib/wsdl/resolver/source.rb', line 119 def sandbox_directory File.dirname() end |
#unsupported_scheme? ⇒ Boolean
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.
109 110 111 |
# File 'lib/wsdl/resolver/source.rb', line 109 def unsupported_scheme? scheme? && !url? && !file_url? end |
#url? ⇒ Boolean
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.
77 78 79 |
# File 'lib/wsdl/resolver/source.rb', line 77 def url? @value.match?(HTTP_URL_PATTERN) end |